diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_MCI.c')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_MCI.c | 219 |
1 files changed, 219 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_MCI.c b/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_MCI.c new file mode 100644 index 000000000..a51507457 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/CMSIS/Driver/DriverTemplates/Driver_MCI.c | |||
@@ -0,0 +1,219 @@ | |||
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_MCI.h" | ||
20 | |||
21 | #define ARM_MCI_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */ | ||
22 | |||
23 | /* Driver Version */ | ||
24 | static const ARM_DRIVER_VERSION DriverVersion = { | ||
25 | ARM_MCI_API_VERSION, | ||
26 | ARM_MCI_DRV_VERSION | ||
27 | }; | ||
28 | |||
29 | /* Driver Capabilities */ | ||
30 | static const ARM_MCI_CAPABILITIES DriverCapabilities = { | ||
31 | 0, /* cd_state */ | ||
32 | 0, /* cd_event */ | ||
33 | 0, /* vdd */ | ||
34 | 0, /* vdd_1v8 */ | ||
35 | 0, /* vccq */ | ||
36 | 0, /* vccq_1v8 */ | ||
37 | 0, /* vccq_1v2 */ | ||
38 | 1, /* data_width_4 */ | ||
39 | 1, /* data_width_8 */ | ||
40 | 0, /* data_width_4_ddr */ | ||
41 | 0, /* data_width_8_ddr */ | ||
42 | 0, /* high_speed */ | ||
43 | 0, /* uhs_signaling */ | ||
44 | 0, /* uhs_tuning */ | ||
45 | 0, /* uhs_sdr50 */ | ||
46 | 0, /* uhs_sdr104 */ | ||
47 | 0, /* uhs_ddr50 */ | ||
48 | 0, /* uhs_driver_type_a */ | ||
49 | 0, /* uhs_driver_type_c */ | ||
50 | 0, /* uhs_driver_type_d */ | ||
51 | 1, /* sdio_interrupt */ | ||
52 | 1, /* read_wait */ | ||
53 | 0, /* suspend_resume */ | ||
54 | 0, /* mmc_interrupt */ | ||
55 | 0, /* mmc_boot */ | ||
56 | 0, /* ccs */ | ||
57 | 0 /* ccs_timeout */ | ||
58 | }; | ||
59 | |||
60 | // | ||
61 | // Functions | ||
62 | // | ||
63 | |||
64 | ARM_DRIVER_VERSION ARM_MCI_GetVersion(void) | ||
65 | { | ||
66 | } | ||
67 | |||
68 | ARM_MCI_CAPABILITIES ARM_MCI_GetCapabilities(void) | ||
69 | { | ||
70 | } | ||
71 | |||
72 | int32_t ARM_MCI_Initialize(ARM_MCI_SignalEvent_t cb_event) | ||
73 | { | ||
74 | } | ||
75 | |||
76 | int32_t ARM_MCI_Uninitialize(void) | ||
77 | { | ||
78 | } | ||
79 | |||
80 | int32_t ARM_MCI_PowerControl(ARM_POWER_STATE state) | ||
81 | { | ||
82 | switch (state) | ||
83 | { | ||
84 | case ARM_POWER_OFF: | ||
85 | break; | ||
86 | |||
87 | case ARM_POWER_LOW: | ||
88 | break; | ||
89 | |||
90 | case ARM_POWER_FULL: | ||
91 | break; | ||
92 | |||
93 | default: | ||
94 | return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | int32_t ARM_MCI_CardPower(uint32_t voltage) | ||
99 | { | ||
100 | switch (voltage & ARM_MCI_POWER_VDD_Msk) | ||
101 | { | ||
102 | case ARM_MCI_POWER_VDD_OFF: | ||
103 | return ARM_DRIVER_OK; | ||
104 | |||
105 | case ARM_MCI_POWER_VDD_3V3: | ||
106 | return ARM_DRIVER_OK; | ||
107 | |||
108 | default: | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | int32_t ARM_MCI_ReadCD(void) | ||
114 | { | ||
115 | } | ||
116 | |||
117 | int32_t ARM_MCI_ReadWP(void) | ||
118 | { | ||
119 | } | ||
120 | |||
121 | int32_t ARM_MCI_SendCommand(uint32_t cmd, uint32_t arg, uint32_t flags, uint32_t *response) | ||
122 | { | ||
123 | } | ||
124 | |||
125 | int32_t ARM_MCI_SetupTransfer(uint8_t *data, uint32_t block_count, uint32_t block_size, uint32_t mode) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | int32_t ARM_MCI_AbortTransfer(void) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | int32_t ARM_MCI_Control(uint32_t control, uint32_t arg) | ||
134 | { | ||
135 | switch (control) | ||
136 | { | ||
137 | case ARM_MCI_BUS_SPEED: | ||
138 | break; | ||
139 | |||
140 | case ARM_MCI_BUS_SPEED_MODE: | ||
141 | break; | ||
142 | |||
143 | case ARM_MCI_BUS_CMD_MODE: | ||
144 | /* Implement external pull-up control to support MMC cards in open-drain mode */ | ||
145 | /* Default mode is push-pull and is configured in Driver_MCI0.Initialize() */ | ||
146 | if (arg == ARM_MCI_BUS_CMD_PUSH_PULL) | ||
147 | { | ||
148 | /* Configure external circuit to work in push-pull mode */ | ||
149 | } | ||
150 | else if (arg == ARM_MCI_BUS_CMD_OPEN_DRAIN) | ||
151 | { | ||
152 | /* Configure external circuit to work in open-drain mode */ | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
157 | } | ||
158 | break; | ||
159 | |||
160 | case ARM_MCI_BUS_DATA_WIDTH: | ||
161 | switch (arg) | ||
162 | { | ||
163 | case ARM_MCI_BUS_DATA_WIDTH_1: | ||
164 | break; | ||
165 | case ARM_MCI_BUS_DATA_WIDTH_4: | ||
166 | break; | ||
167 | case ARM_MCI_BUS_DATA_WIDTH_8: | ||
168 | break; | ||
169 | default: | ||
170 | return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
171 | } | ||
172 | break; | ||
173 | |||
174 | case ARM_MCI_CONTROL_RESET: | ||
175 | break; | ||
176 | |||
177 | case ARM_MCI_CONTROL_CLOCK_IDLE: | ||
178 | break; | ||
179 | |||
180 | case ARM_MCI_DATA_TIMEOUT: | ||
181 | break; | ||
182 | |||
183 | case ARM_MCI_MONITOR_SDIO_INTERRUPT: | ||
184 | break; | ||
185 | |||
186 | case ARM_MCI_CONTROL_READ_WAIT: | ||
187 | break; | ||
188 | |||
189 | case ARM_MCI_DRIVER_STRENGTH: | ||
190 | default: return ARM_DRIVER_ERROR_UNSUPPORTED; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | ARM_MCI_STATUS ARM_MCI_GetStatus(void) | ||
195 | { | ||
196 | } | ||
197 | |||
198 | void ARM_MCI_SignalEvent(uint32_t event) | ||
199 | { | ||
200 | // function body | ||
201 | } | ||
202 | |||
203 | // End MCI Interface | ||
204 | |||
205 | ARM_DRIVER_MCI Driver_MCI = { | ||
206 | ARM_MCI_GetVersion, | ||
207 | ARM_MCI_GetCapabilities, | ||
208 | ARM_MCI_Initialize, | ||
209 | ARM_MCI_Uninitialize, | ||
210 | ARM_MCI_PowerControl, | ||
211 | ARM_MCI_CardPower, | ||
212 | ARM_MCI_ReadCD, | ||
213 | ARM_MCI_ReadWP, | ||
214 | ARM_MCI_SendCommand, | ||
215 | ARM_MCI_SetupTransfer, | ||
216 | ARM_MCI_AbortTransfer, | ||
217 | ARM_MCI_Control, | ||
218 | ARM_MCI_GetStatus | ||
219 | }; | ||