diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_SPI.c')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_SPI.c | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_SPI.c b/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_SPI.c new file mode 100644 index 000000000..9f31654fa --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_SPI.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013-2018 Arm Limited. All rights reserved. | ||
3 | * | ||
4 | * SPDX-License-Identifier: Apache-2.0 | ||
5 | * | ||
6 | * Licensed under the Apache License, Version 2.0 (the License); you may | ||
7 | * not use this file except in compliance with the License. | ||
8 | * You may obtain a copy of the License at | ||
9 | * | ||
10 | * www.apache.org/licenses/LICENSE-2.0 | ||
11 | * | ||
12 | * Unless required by applicable law or agreed to in writing, software | ||
13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
15 | * See the License for the specific language governing permissions and | ||
16 | * limitations under the License. | ||
17 | */ | ||
18 | |||
19 | #include "Driver_SPI.h" | ||
20 | |||
21 | #define ARM_SPI_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */ | ||
22 | |||
23 | /* Driver Version */ | ||
24 | static const ARM_DRIVER_VERSION DriverVersion = { | ||
25 | ARM_SPI_API_VERSION, | ||
26 | ARM_SPI_DRV_VERSION | ||
27 | }; | ||
28 | |||
29 | /* Driver Capabilities */ | ||
30 | static const ARM_SPI_CAPABILITIES DriverCapabilities = { | ||
31 | 1, /* Simplex Mode (Master and Slave) */ | ||
32 | 1, /* TI Synchronous Serial Interface */ | ||
33 | 1, /* Microwire Interface */ | ||
34 | 0 /* Signal Mode Fault event: \ref ARM_SPI_EVENT_MODE_FAULT */ | ||
35 | }; | ||
36 | |||
37 | // | ||
38 | // Functions | ||
39 | // | ||
40 | |||
41 | ARM_DRIVER_VERSION ARM_SPI_GetVersion(void) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | ARM_SPI_CAPABILITIES ARM_SPI_GetCapabilities(void) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | int32_t ARM_SPI_Initialize(ARM_SPI_SignalEvent_t cb_event) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | int32_t ARM_SPI_Uninitialize(void) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | int32_t ARM_SPI_PowerControl(ARM_POWER_STATE state) | ||
58 | { | ||
59 | switch (state) | ||
60 | { | ||
61 | case ARM_POWER_OFF: | ||
62 | break; | ||
63 | |||
64 | case ARM_POWER_LOW: | ||
65 | break; | ||
66 | |||
67 | case ARM_POWER_FULL: | ||
68 | break; | ||
69 | |||
70 | default: | ||
71 | return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | int32_t ARM_SPI_Send(const void *data, uint32_t num) | ||
76 | { | ||
77 | } | ||
78 | |||
79 | int32_t ARM_SPI_Receive(void *data, uint32_t num) | ||
80 | { | ||
81 | } | ||
82 | |||
83 | int32_t ARM_SPI_Transfer(const void *data_out, void *data_in, uint32_t num) | ||
84 | { | ||
85 | } | ||
86 | |||
87 | uint32_t ARM_SPI_GetDataCount(void) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | int32_t ARM_SPI_Control(uint32_t control, uint32_t arg) | ||
92 | { | ||
93 | switch (control & ARM_SPI_CONTROL_Msk) | ||
94 | { | ||
95 | default: | ||
96 | return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
97 | |||
98 | case ARM_SPI_MODE_INACTIVE: // SPI Inactive | ||
99 | return ARM_DRIVER_OK; | ||
100 | |||
101 | case ARM_SPI_MODE_MASTER: // SPI Master (Output on MOSI, Input on MISO); arg = Bus Speed in bps | ||
102 | break; | ||
103 | |||
104 | case ARM_SPI_MODE_SLAVE: // SPI Slave (Output on MISO, Input on MOSI) | ||
105 | break; | ||
106 | |||
107 | case ARM_SPI_MODE_MASTER_SIMPLEX: // SPI Master (Output/Input on MOSI); arg = Bus Speed in bps | ||
108 | case ARM_SPI_MODE_SLAVE_SIMPLEX: // SPI Slave (Output/Input on MISO) | ||
109 | return ARM_SPI_ERROR_MODE; | ||
110 | |||
111 | case ARM_SPI_SET_BUS_SPEED: // Set Bus Speed in bps; arg = value | ||
112 | break; | ||
113 | |||
114 | case ARM_SPI_GET_BUS_SPEED: // Get Bus Speed in bps | ||
115 | break; | ||
116 | |||
117 | case ARM_SPI_SET_DEFAULT_TX_VALUE: // Set default Transmit value; arg = value | ||
118 | break; | ||
119 | |||
120 | case ARM_SPI_CONTROL_SS: // Control Slave Select; arg = 0:inactive, 1:active | ||
121 | break; | ||
122 | |||
123 | case ARM_SPI_ABORT_TRANSFER: // Abort current data transfer | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | ARM_SPI_STATUS ARM_SPI_GetStatus(void) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | void ARM_SPI_SignalEvent(uint32_t event) | ||
133 | { | ||
134 | // function body | ||
135 | } | ||
136 | |||
137 | // End SPI Interface | ||
138 | |||
139 | ARM_DRIVER_SPI Driver_SPI = { | ||
140 | ARM_SPI_GetVersion, | ||
141 | ARM_SPI_GetCapabilities, | ||
142 | ARM_SPI_Initialize, | ||
143 | ARM_SPI_Uninitialize, | ||
144 | ARM_SPI_PowerControl, | ||
145 | ARM_SPI_Send, | ||
146 | ARM_SPI_Receive, | ||
147 | ARM_SPI_Transfer, | ||
148 | ARM_SPI_GetDataCount, | ||
149 | ARM_SPI_Control, | ||
150 | ARM_SPI_GetStatus | ||
151 | }; | ||