5 |
6 | #define xil_printf printf
7 |
8 |
9 | #endif /* end of protection macro */
10 |
--------------------------------------------------------------------------------
/spi-loader/linux/sw/lib/readme.txt:
--------------------------------------------------------------------------------
1 | This folder holds files reused from Xilinx SDK at https://github.com/Xilinx/embeddedsw. Some files were modified some weren't.
--------------------------------------------------------------------------------
/spi-loader/linux/sw/lib/src/xspi_i.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | *
3 | * Copyright (C) 2001 - 2014 Xilinx, Inc. All rights reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * Use of the Software is limited solely to applications:
16 | * (a) running on a Xilinx device, or
17 | * (b) that interact with a Xilinx device through a bus or interconnect.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 | * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | * SOFTWARE.
26 | *
27 | * Except as contained in this notice, the name of the Xilinx shall not be used
28 | * in advertising or otherwise to promote the sale, use or other dealings in
29 | * this Software without prior written authorization from Xilinx.
30 | *
31 | ******************************************************************************/
32 | /*****************************************************************************/
33 | /**
34 | *
35 | * @file xspi_i.h
36 | * @addtogroup spi_v4_4
37 | * @{
38 | *
39 | * This header file contains internal identifiers. It is intended for internal
40 | * use only.
41 | *
42 | *
43 | * MODIFICATION HISTORY:
44 | *
45 | * Ver Who Date Changes
46 | * ----- ---- -------- -----------------------------------------------
47 | * 1.00a rpm 10/11/01 First release
48 | * 1.00b jhl 03/14/02 Repartitioned driver for smaller files.
49 | * 1.00b rpm 04/24/02 Moved register definitions to xspi_l.h
50 | * 1.11a wgr 03/22/07 Converted to new coding style.
51 | * 1.12a sv 03/28/08 Removed the Macro for statistics, moved the interrupt
52 | * register definitions and bit definitions to _l.h.
53 | * 2.00a sv 07/30/08 Removed the Macro for statistics, moved the interrupt
54 | * register definitions and bit definitions to _l.h.
55 | *
56 | *
57 | ******************************************************************************/
58 |
59 | #ifndef XSPI_I_H /* prevent circular inclusions */
60 | #define XSPI_I_H /* by using protection macros */
61 |
62 | #ifdef __cplusplus
63 | extern "C" {
64 | #endif
65 |
66 | /***************************** Include Files *********************************/
67 |
68 | #include "xil_types.h"
69 | #include "xil_assert.h"
70 | #include "xspi_l.h"
71 |
72 | /************************** Constant Definitions *****************************/
73 |
74 | /**************************** Type Definitions *******************************/
75 |
76 | /***************** Macros (Inline Functions) Definitions *********************/
77 |
78 | /************************** Function Prototypes ******************************/
79 |
80 | void XSpi_Abort(XSpi *InstancePtr);
81 |
82 | /************************** Variable Definitions *****************************/
83 |
84 | extern XSpi_Config XSpi_ConfigTable[];
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* end of protection macro */
91 | /** @} */
92 |
--------------------------------------------------------------------------------
/spi-loader/linux/sw/lib/src/xspi_stats.c:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | *
3 | * Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the "Software"), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * Use of the Software is limited solely to applications:
16 | * (a) running on a Xilinx device, or
17 | * (b) that interact with a Xilinx device through a bus or interconnect.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 | * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | * SOFTWARE.
26 | *
27 | * Except as contained in this notice, the name of the Xilinx shall not be used
28 | * in advertising or otherwise to promote the sale, use or other dealings in
29 | * this Software without prior written authorization from Xilinx.
30 | *
31 | ******************************************************************************/
32 | /*****************************************************************************/
33 | /**
34 | *
35 | * @file xspi_stats.c
36 | * @addtogroup spi_v4_4
37 | * @{
38 | *
39 | * This component contains the implementation of statistics functions for the
40 | * XSpi driver component.
41 | *
42 | *
43 | * MODIFICATION HISTORY:
44 | *
45 | * Ver Who Date Changes
46 | * ----- ---- -------- -----------------------------------------------
47 | * 1.00b jhl 03/14/02 First release
48 | * 1.00b rpm 04/25/02 Changed macro naming convention
49 | * 1.11a wgr 03/22/07 Converted to new coding style.
50 | * 1.12a sv 03/28/08 Removed the call to the Macro for clearing statistics.
51 | * 2.00a sv 07/30/08 Removed the call to the Macro for clearing statistics.
52 | * 3.00a ktn 10/28/09 Updated all the register accesses as 32 bit access.
53 | * Updated driver to use the HAL APIs/macros.
54 | *
55 | *
56 | ******************************************************************************/
57 |
58 | /***************************** Include Files *********************************/
59 |
60 | #include "xspi.h"
61 | #include "xspi_i.h"
62 |
63 | /************************** Constant Definitions *****************************/
64 |
65 |
66 | /**************************** Type Definitions *******************************/
67 |
68 |
69 | /***************** Macros (Inline Functions) Definitions *********************/
70 |
71 |
72 | /************************** Function Prototypes ******************************/
73 |
74 |
75 | /************************** Variable Definitions *****************************/
76 |
77 |
78 | /*****************************************************************************/
79 | /**
80 | *
81 | * Gets a copy of the statistics for an SPI device.
82 | *
83 | * @param InstancePtr is a pointer to the XSpi instance to be worked on.
84 | * @param StatsPtr is a pointer to a XSpi_Stats structure which will get a
85 | * copy of current statistics.
86 | *
87 | * @return None.
88 | *
89 | * @note Statistics are not updated in polled mode of operation.
90 | *
91 | ******************************************************************************/
92 | void XSpi_GetStats(XSpi *InstancePtr, XSpi_Stats *StatsPtr)
93 | {
94 | Xil_AssertVoid(InstancePtr != NULL);
95 | Xil_AssertVoid(StatsPtr != NULL);
96 | Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
97 |
98 | StatsPtr->ModeFaults = InstancePtr->Stats.ModeFaults;
99 | StatsPtr->XmitUnderruns = InstancePtr->Stats.XmitUnderruns;
100 | StatsPtr->RecvOverruns = InstancePtr->Stats.RecvOverruns;
101 | StatsPtr->SlaveModeFaults = InstancePtr->Stats.SlaveModeFaults;
102 | StatsPtr->BytesTransferred = InstancePtr->Stats.BytesTransferred;
103 | StatsPtr->NumInterrupts = InstancePtr->Stats.NumInterrupts;
104 | }
105 |
106 | /*****************************************************************************/
107 | /**
108 | *
109 | * Clears the statistics for the SPI device.
110 | *
111 | * @param InstancePtr is a pointer to the XSpi instance to be worked on.
112 | *
113 | * @return None.
114 | *
115 | * @note Statistics are not updated in polled mode of operation.
116 | *
117 | ******************************************************************************/
118 | void XSpi_ClearStats(XSpi *InstancePtr)
119 | {
120 | Xil_AssertVoid(InstancePtr != NULL);
121 | Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
122 |
123 | InstancePtr->Stats.ModeFaults = 0;
124 | InstancePtr->Stats.XmitUnderruns = 0;
125 | InstancePtr->Stats.RecvOverruns = 0;
126 | InstancePtr->Stats.SlaveModeFaults = 0;
127 | InstancePtr->Stats.BytesTransferred = 0;
128 | InstancePtr->Stats.NumInterrupts = 0;
129 |
130 | }
131 | /** @} */
132 |
--------------------------------------------------------------------------------