38
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32f4xx_ll_sdmmc.h
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.2.0
|
|
6 * @date 26-December-2014
|
|
7 * @brief Header file of SDMMC HAL module.
|
|
8 ******************************************************************************
|
|
9 * @attention
|
|
10 *
|
|
11 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
|
12 *
|
|
13 * Redistribution and use in source and binary forms, with or without modification,
|
|
14 * are permitted provided that the following conditions are met:
|
|
15 * 1. Redistributions of source code must retain the above copyright notice,
|
|
16 * this list of conditions and the following disclaimer.
|
|
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18 * this list of conditions and the following disclaimer in the documentation
|
|
19 * and/or other materials provided with the distribution.
|
|
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
21 * may be used to endorse or promote products derived from this software
|
|
22 * without specific prior written permission.
|
|
23 *
|
|
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 *
|
|
35 ******************************************************************************
|
|
36 */
|
|
37
|
|
38 /* Define to prevent recursive inclusion -------------------------------------*/
|
|
39 #ifndef __STM32F4xx_LL_SDMMC_H
|
|
40 #define __STM32F4xx_LL_SDMMC_H
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 extern "C" {
|
|
44 #endif
|
|
45
|
|
46 /* Includes ------------------------------------------------------------------*/
|
|
47 #include "stm32f4xx_hal_def.h"
|
|
48
|
|
49 /** @addtogroup STM32F4xx_Driver
|
|
50 * @{
|
|
51 */
|
|
52
|
|
53 /** @addtogroup SDMMC_LL
|
|
54 * @{
|
|
55 */
|
|
56
|
|
57 /* Exported types ------------------------------------------------------------*/
|
|
58 /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types
|
|
59 * @{
|
|
60 */
|
|
61
|
|
62 /**
|
|
63 * @brief SDMMC Configuration Structure definition
|
|
64 */
|
|
65 typedef struct
|
|
66 {
|
|
67 uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made.
|
|
68 This parameter can be a value of @ref SDIO_Clock_Edge */
|
|
69
|
|
70 uint32_t ClockBypass; /*!< Specifies whether the SDIO Clock divider bypass is
|
|
71 enabled or disabled.
|
|
72 This parameter can be a value of @ref SDIO_Clock_Bypass */
|
|
73
|
|
74 uint32_t ClockPowerSave; /*!< Specifies whether SDIO Clock output is enabled or
|
|
75 disabled when the bus is idle.
|
|
76 This parameter can be a value of @ref SDIO_Clock_Power_Save */
|
|
77
|
|
78 uint32_t BusWide; /*!< Specifies the SDIO bus width.
|
|
79 This parameter can be a value of @ref SDIO_Bus_Wide */
|
|
80
|
|
81 uint32_t HardwareFlowControl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled.
|
|
82 This parameter can be a value of @ref SDIO_Hardware_Flow_Control */
|
|
83
|
|
84 uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDIO controller.
|
|
85 This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
|
|
86
|
|
87 }SDIO_InitTypeDef;
|
|
88
|
|
89
|
|
90 /**
|
|
91 * @brief SDIO Command Control structure
|
|
92 */
|
|
93 typedef struct
|
|
94 {
|
|
95 uint32_t Argument; /*!< Specifies the SDIO command argument which is sent
|
|
96 to a card as part of a command message. If a command
|
|
97 contains an argument, it must be loaded into this register
|
|
98 before writing the command to the command register. */
|
|
99
|
|
100 uint32_t CmdIndex; /*!< Specifies the SDIO command index. It must be Min_Data = 0 and
|
|
101 Max_Data = 64 */
|
|
102
|
|
103 uint32_t Response; /*!< Specifies the SDIO response type.
|
|
104 This parameter can be a value of @ref SDIO_Response_Type */
|
|
105
|
|
106 uint32_t WaitForInterrupt; /*!< Specifies whether SDIO wait for interrupt request is
|
|
107 enabled or disabled.
|
|
108 This parameter can be a value of @ref SDIO_Wait_Interrupt_State */
|
|
109
|
|
110 uint32_t CPSM; /*!< Specifies whether SDIO Command path state machine (CPSM)
|
|
111 is enabled or disabled.
|
|
112 This parameter can be a value of @ref SDIO_CPSM_State */
|
|
113 }SDIO_CmdInitTypeDef;
|
|
114
|
|
115
|
|
116 /**
|
|
117 * @brief SDIO Data Control structure
|
|
118 */
|
|
119 typedef struct
|
|
120 {
|
|
121 uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
|
|
122
|
|
123 uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */
|
|
124
|
|
125 uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer.
|
|
126 This parameter can be a value of @ref SDIO_Data_Block_Size */
|
|
127
|
|
128 uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer
|
|
129 is a read or write.
|
|
130 This parameter can be a value of @ref SDIO_Transfer_Direction */
|
|
131
|
|
132 uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
|
|
133 This parameter can be a value of @ref SDIO_Transfer_Type */
|
|
134
|
|
135 uint32_t DPSM; /*!< Specifies whether SDIO Data path state machine (DPSM)
|
|
136 is enabled or disabled.
|
|
137 This parameter can be a value of @ref SDIO_DPSM_State */
|
|
138 }SDIO_DataInitTypeDef;
|
|
139
|
|
140 /**
|
|
141 * @}
|
|
142 */
|
|
143
|
|
144 /* Exported constants --------------------------------------------------------*/
|
|
145 /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants
|
|
146 * @{
|
|
147 */
|
|
148
|
|
149 /** @defgroup SDIO_Clock_Edge Clock Edge
|
|
150 * @{
|
|
151 */
|
|
152 #define SDIO_CLOCK_EDGE_RISING ((uint32_t)0x00000000)
|
|
153 #define SDIO_CLOCK_EDGE_FALLING SDIO_CLKCR_NEGEDGE
|
|
154
|
|
155 #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_CLOCK_EDGE_RISING) || \
|
|
156 ((EDGE) == SDIO_CLOCK_EDGE_FALLING))
|
|
157 /**
|
|
158 * @}
|
|
159 */
|
|
160
|
|
161 /** @defgroup SDIO_Clock_Bypass Clock Bypass
|
|
162 * @{
|
|
163 */
|
|
164 #define SDIO_CLOCK_BYPASS_DISABLE ((uint32_t)0x00000000)
|
|
165 #define SDIO_CLOCK_BYPASS_ENABLE SDIO_CLKCR_BYPASS
|
|
166
|
|
167 #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_CLOCK_BYPASS_DISABLE) || \
|
|
168 ((BYPASS) == SDIO_CLOCK_BYPASS_ENABLE))
|
|
169 /**
|
|
170 * @}
|
|
171 */
|
|
172
|
|
173 /** @defgroup SDIO_Clock_Power_Save Clock Power Saving
|
|
174 * @{
|
|
175 */
|
|
176 #define SDIO_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000)
|
|
177 #define SDIO_CLOCK_POWER_SAVE_ENABLE SDIO_CLKCR_PWRSAV
|
|
178
|
|
179 #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_CLOCK_POWER_SAVE_DISABLE) || \
|
|
180 ((SAVE) == SDIO_CLOCK_POWER_SAVE_ENABLE))
|
|
181 /**
|
|
182 * @}
|
|
183 */
|
|
184
|
|
185 /** @defgroup SDIO_Bus_Wide Bus Width
|
|
186 * @{
|
|
187 */
|
|
188 #define SDIO_BUS_WIDE_1B ((uint32_t)0x00000000)
|
|
189 #define SDIO_BUS_WIDE_4B SDIO_CLKCR_WIDBUS_0
|
|
190 #define SDIO_BUS_WIDE_8B SDIO_CLKCR_WIDBUS_1
|
|
191
|
|
192 #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BUS_WIDE_1B) || \
|
|
193 ((WIDE) == SDIO_BUS_WIDE_4B) || \
|
|
194 ((WIDE) == SDIO_BUS_WIDE_8B))
|
|
195 /**
|
|
196 * @}
|
|
197 */
|
|
198
|
|
199 /** @defgroup SDIO_Hardware_Flow_Control Hardware Flow Control
|
|
200 * @{
|
|
201 */
|
|
202 #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000)
|
|
203 #define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDIO_CLKCR_HWFC_EN
|
|
204
|
|
205 #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_DISABLE) || \
|
|
206 ((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_ENABLE))
|
|
207 /**
|
|
208 * @}
|
|
209 */
|
|
210
|
|
211 /** @defgroup SDIO_Clock_Division Clock Division
|
|
212 * @{
|
|
213 */
|
|
214 #define IS_SDIO_CLKDIV(DIV) ((DIV) <= 0xFF)
|
|
215 /**
|
|
216 * @}
|
|
217 */
|
|
218
|
|
219 /** @defgroup SDIO_Command_Index Command Index
|
|
220 * @{
|
|
221 */
|
|
222 #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40)
|
|
223 /**
|
|
224 * @}
|
|
225 */
|
|
226
|
|
227 /** @defgroup SDIO_Response_Type Response Type
|
|
228 * @{
|
|
229 */
|
|
230 #define SDIO_RESPONSE_NO ((uint32_t)0x00000000)
|
|
231 #define SDIO_RESPONSE_SHORT SDIO_CMD_WAITRESP_0
|
|
232 #define SDIO_RESPONSE_LONG SDIO_CMD_WAITRESP
|
|
233
|
|
234 #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_RESPONSE_NO) || \
|
|
235 ((RESPONSE) == SDIO_RESPONSE_SHORT) || \
|
|
236 ((RESPONSE) == SDIO_RESPONSE_LONG))
|
|
237 /**
|
|
238 * @}
|
|
239 */
|
|
240
|
|
241 /** @defgroup SDIO_Wait_Interrupt_State Wait Interrupt
|
|
242 * @{
|
|
243 */
|
|
244 #define SDIO_WAIT_NO ((uint32_t)0x00000000)
|
|
245 #define SDIO_WAIT_IT SDIO_CMD_WAITINT
|
|
246 #define SDIO_WAIT_PEND SDIO_CMD_WAITPEND
|
|
247
|
|
248 #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_WAIT_NO) || \
|
|
249 ((WAIT) == SDIO_WAIT_IT) || \
|
|
250 ((WAIT) == SDIO_WAIT_PEND))
|
|
251 /**
|
|
252 * @}
|
|
253 */
|
|
254
|
|
255 /** @defgroup SDIO_CPSM_State CPSM State
|
|
256 * @{
|
|
257 */
|
|
258 #define SDIO_CPSM_DISABLE ((uint32_t)0x00000000)
|
|
259 #define SDIO_CPSM_ENABLE SDIO_CMD_CPSMEN
|
|
260
|
|
261 #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_DISABLE) || \
|
|
262 ((CPSM) == SDIO_CPSM_ENABLE))
|
|
263 /**
|
|
264 * @}
|
|
265 */
|
|
266
|
|
267 /** @defgroup SDIO_Response_Registers Response Register
|
|
268 * @{
|
|
269 */
|
|
270 #define SDIO_RESP1 ((uint32_t)0x00000000)
|
|
271 #define SDIO_RESP2 ((uint32_t)0x00000004)
|
|
272 #define SDIO_RESP3 ((uint32_t)0x00000008)
|
|
273 #define SDIO_RESP4 ((uint32_t)0x0000000C)
|
|
274
|
|
275 #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || \
|
|
276 ((RESP) == SDIO_RESP2) || \
|
|
277 ((RESP) == SDIO_RESP3) || \
|
|
278 ((RESP) == SDIO_RESP4))
|
|
279 /**
|
|
280 * @}
|
|
281 */
|
|
282
|
|
283 /** @defgroup SDIO_Data_Length Data Lenght
|
|
284 * @{
|
|
285 */
|
|
286 #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF)
|
|
287 /**
|
|
288 * @}
|
|
289 */
|
|
290
|
|
291 /** @defgroup SDIO_Data_Block_Size Data Block Size
|
|
292 * @{
|
|
293 */
|
|
294 #define SDIO_DATABLOCK_SIZE_1B ((uint32_t)0x00000000)
|
|
295 #define SDIO_DATABLOCK_SIZE_2B SDIO_DCTRL_DBLOCKSIZE_0
|
|
296 #define SDIO_DATABLOCK_SIZE_4B SDIO_DCTRL_DBLOCKSIZE_1
|
|
297 #define SDIO_DATABLOCK_SIZE_8B ((uint32_t)0x00000030)
|
|
298 #define SDIO_DATABLOCK_SIZE_16B SDIO_DCTRL_DBLOCKSIZE_2
|
|
299 #define SDIO_DATABLOCK_SIZE_32B ((uint32_t)0x00000050)
|
|
300 #define SDIO_DATABLOCK_SIZE_64B ((uint32_t)0x00000060)
|
|
301 #define SDIO_DATABLOCK_SIZE_128B ((uint32_t)0x00000070)
|
|
302 #define SDIO_DATABLOCK_SIZE_256B SDIO_DCTRL_DBLOCKSIZE_3
|
|
303 #define SDIO_DATABLOCK_SIZE_512B ((uint32_t)0x00000090)
|
|
304 #define SDIO_DATABLOCK_SIZE_1024B ((uint32_t)0x000000A0)
|
|
305 #define SDIO_DATABLOCK_SIZE_2048B ((uint32_t)0x000000B0)
|
|
306 #define SDIO_DATABLOCK_SIZE_4096B ((uint32_t)0x000000C0)
|
|
307 #define SDIO_DATABLOCK_SIZE_8192B ((uint32_t)0x000000D0)
|
|
308 #define SDIO_DATABLOCK_SIZE_16384B ((uint32_t)0x000000E0)
|
|
309
|
|
310 #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DATABLOCK_SIZE_1B) || \
|
|
311 ((SIZE) == SDIO_DATABLOCK_SIZE_2B) || \
|
|
312 ((SIZE) == SDIO_DATABLOCK_SIZE_4B) || \
|
|
313 ((SIZE) == SDIO_DATABLOCK_SIZE_8B) || \
|
|
314 ((SIZE) == SDIO_DATABLOCK_SIZE_16B) || \
|
|
315 ((SIZE) == SDIO_DATABLOCK_SIZE_32B) || \
|
|
316 ((SIZE) == SDIO_DATABLOCK_SIZE_64B) || \
|
|
317 ((SIZE) == SDIO_DATABLOCK_SIZE_128B) || \
|
|
318 ((SIZE) == SDIO_DATABLOCK_SIZE_256B) || \
|
|
319 ((SIZE) == SDIO_DATABLOCK_SIZE_512B) || \
|
|
320 ((SIZE) == SDIO_DATABLOCK_SIZE_1024B) || \
|
|
321 ((SIZE) == SDIO_DATABLOCK_SIZE_2048B) || \
|
|
322 ((SIZE) == SDIO_DATABLOCK_SIZE_4096B) || \
|
|
323 ((SIZE) == SDIO_DATABLOCK_SIZE_8192B) || \
|
|
324 ((SIZE) == SDIO_DATABLOCK_SIZE_16384B))
|
|
325 /**
|
|
326 * @}
|
|
327 */
|
|
328
|
|
329 /** @defgroup SDIO_Transfer_Direction Transfer Direction
|
|
330 * @{
|
|
331 */
|
|
332 #define SDIO_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000)
|
|
333 #define SDIO_TRANSFER_DIR_TO_SDIO SDIO_DCTRL_DTDIR
|
|
334
|
|
335 #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TRANSFER_DIR_TO_CARD) || \
|
|
336 ((DIR) == SDIO_TRANSFER_DIR_TO_SDIO))
|
|
337 /**
|
|
338 * @}
|
|
339 */
|
|
340
|
|
341 /** @defgroup SDIO_Transfer_Type Transfer Type
|
|
342 * @{
|
|
343 */
|
|
344 #define SDIO_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000)
|
|
345 #define SDIO_TRANSFER_MODE_STREAM SDIO_DCTRL_DTMODE
|
|
346
|
|
347 #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TRANSFER_MODE_BLOCK) || \
|
|
348 ((MODE) == SDIO_TRANSFER_MODE_STREAM))
|
|
349 /**
|
|
350 * @}
|
|
351 */
|
|
352
|
|
353 /** @defgroup SDIO_DPSM_State DPSM State
|
|
354 * @{
|
|
355 */
|
|
356 #define SDIO_DPSM_DISABLE ((uint32_t)0x00000000)
|
|
357 #define SDIO_DPSM_ENABLE SDIO_DCTRL_DTEN
|
|
358
|
|
359 #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_DISABLE) ||\
|
|
360 ((DPSM) == SDIO_DPSM_ENABLE))
|
|
361 /**
|
|
362 * @}
|
|
363 */
|
|
364
|
|
365 /** @defgroup SDIO_Read_Wait_Mode Read Wait Mode
|
|
366 * @{
|
|
367 */
|
|
368 #define SDIO_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000)
|
|
369 #define SDIO_READ_WAIT_MODE_CLK ((uint32_t)0x00000001)
|
|
370
|
|
371 #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_READ_WAIT_MODE_CLK) || \
|
|
372 ((MODE) == SDIO_READ_WAIT_MODE_DATA2))
|
|
373 /**
|
|
374 * @}
|
|
375 */
|
|
376
|
|
377 /** @defgroup SDIO_Interrupt_sources Interrupt Sources
|
|
378 * @{
|
|
379 */
|
|
380 #define SDIO_IT_CCRCFAIL SDIO_STA_CCRCFAIL
|
|
381 #define SDIO_IT_DCRCFAIL SDIO_STA_DCRCFAIL
|
|
382 #define SDIO_IT_CTIMEOUT SDIO_STA_CTIMEOUT
|
|
383 #define SDIO_IT_DTIMEOUT SDIO_STA_DTIMEOUT
|
|
384 #define SDIO_IT_TXUNDERR SDIO_STA_TXUNDERR
|
|
385 #define SDIO_IT_RXOVERR SDIO_STA_RXOVERR
|
|
386 #define SDIO_IT_CMDREND SDIO_STA_CMDREND
|
|
387 #define SDIO_IT_CMDSENT SDIO_STA_CMDSENT
|
|
388 #define SDIO_IT_DATAEND SDIO_STA_DATAEND
|
|
389 #define SDIO_IT_STBITERR SDIO_STA_STBITERR
|
|
390 #define SDIO_IT_DBCKEND SDIO_STA_DBCKEND
|
|
391 #define SDIO_IT_CMDACT SDIO_STA_CMDACT
|
|
392 #define SDIO_IT_TXACT SDIO_STA_TXACT
|
|
393 #define SDIO_IT_RXACT SDIO_STA_RXACT
|
|
394 #define SDIO_IT_TXFIFOHE SDIO_STA_TXFIFOHE
|
|
395 #define SDIO_IT_RXFIFOHF SDIO_STA_RXFIFOHF
|
|
396 #define SDIO_IT_TXFIFOF SDIO_STA_TXFIFOF
|
|
397 #define SDIO_IT_RXFIFOF SDIO_STA_RXFIFOF
|
|
398 #define SDIO_IT_TXFIFOE SDIO_STA_TXFIFOE
|
|
399 #define SDIO_IT_RXFIFOE SDIO_STA_RXFIFOE
|
|
400 #define SDIO_IT_TXDAVL SDIO_STA_TXDAVL
|
|
401 #define SDIO_IT_RXDAVL SDIO_STA_RXDAVL
|
|
402 #define SDIO_IT_SDIOIT SDIO_STA_SDIOIT
|
|
403 #define SDIO_IT_CEATAEND SDIO_STA_CEATAEND
|
|
404 /**
|
|
405 * @}
|
|
406 */
|
|
407
|
|
408 /** @defgroup SDIO_Flags Flags
|
|
409 * @{
|
|
410 */
|
|
411 #define SDIO_FLAG_CCRCFAIL SDIO_STA_CCRCFAIL
|
|
412 #define SDIO_FLAG_DCRCFAIL SDIO_STA_DCRCFAIL
|
|
413 #define SDIO_FLAG_CTIMEOUT SDIO_STA_CTIMEOUT
|
|
414 #define SDIO_FLAG_DTIMEOUT SDIO_STA_DTIMEOUT
|
|
415 #define SDIO_FLAG_TXUNDERR SDIO_STA_TXUNDERR
|
|
416 #define SDIO_FLAG_RXOVERR SDIO_STA_RXOVERR
|
|
417 #define SDIO_FLAG_CMDREND SDIO_STA_CMDREND
|
|
418 #define SDIO_FLAG_CMDSENT SDIO_STA_CMDSENT
|
|
419 #define SDIO_FLAG_DATAEND SDIO_STA_DATAEND
|
|
420 #define SDIO_FLAG_STBITERR SDIO_STA_STBITERR
|
|
421 #define SDIO_FLAG_DBCKEND SDIO_STA_DBCKEND
|
|
422 #define SDIO_FLAG_CMDACT SDIO_STA_CMDACT
|
|
423 #define SDIO_FLAG_TXACT SDIO_STA_TXACT
|
|
424 #define SDIO_FLAG_RXACT SDIO_STA_RXACT
|
|
425 #define SDIO_FLAG_TXFIFOHE SDIO_STA_TXFIFOHE
|
|
426 #define SDIO_FLAG_RXFIFOHF SDIO_STA_RXFIFOHF
|
|
427 #define SDIO_FLAG_TXFIFOF SDIO_STA_TXFIFOF
|
|
428 #define SDIO_FLAG_RXFIFOF SDIO_STA_RXFIFOF
|
|
429 #define SDIO_FLAG_TXFIFOE SDIO_STA_TXFIFOE
|
|
430 #define SDIO_FLAG_RXFIFOE SDIO_STA_RXFIFOE
|
|
431 #define SDIO_FLAG_TXDAVL SDIO_STA_TXDAVL
|
|
432 #define SDIO_FLAG_RXDAVL SDIO_STA_RXDAVL
|
|
433 #define SDIO_FLAG_SDIOIT SDIO_STA_SDIOIT
|
|
434 #define SDIO_FLAG_CEATAEND SDIO_STA_CEATAEND
|
|
435 /**
|
|
436 * @}
|
|
437 */
|
|
438
|
|
439 /**
|
|
440 * @}
|
|
441 */
|
|
442 /* Exported macro ------------------------------------------------------------*/
|
|
443 /** @defgroup SDMMC_LL_Exported_macros SDMMC_LL Exported Macros
|
|
444 * @{
|
|
445 */
|
|
446
|
|
447 /** @defgroup SDMMC_LL_Alias_Region Bit Address in the alias region
|
|
448 * @{
|
|
449 */
|
|
450 /* ------------ SDIO registers bit address in the alias region -------------- */
|
|
451 #define SDIO_OFFSET (SDIO_BASE - PERIPH_BASE)
|
|
452
|
|
453 /* --- CLKCR Register ---*/
|
|
454 /* Alias word address of CLKEN bit */
|
|
455 #define CLKCR_OFFSET (SDIO_OFFSET + 0x04)
|
|
456 #define CLKEN_BITNUMBER 0x08
|
|
457 #define CLKCR_CLKEN_BB (PERIPH_BB_BASE + (CLKCR_OFFSET * 32) + (CLKEN_BITNUMBER * 4))
|
|
458
|
|
459 /* --- CMD Register ---*/
|
|
460 /* Alias word address of SDIOSUSPEND bit */
|
|
461 #define CMD_OFFSET (SDIO_OFFSET + 0x0C)
|
|
462 #define SDIOSUSPEND_BITNUMBER 0x0B
|
|
463 #define CMD_SDIOSUSPEND_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (SDIOSUSPEND_BITNUMBER * 4))
|
|
464
|
|
465 /* Alias word address of ENCMDCOMPL bit */
|
|
466 #define ENCMDCOMPL_BITNUMBER 0x0C
|
|
467 #define CMD_ENCMDCOMPL_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ENCMDCOMPL_BITNUMBER * 4))
|
|
468
|
|
469 /* Alias word address of NIEN bit */
|
|
470 #define NIEN_BITNUMBER 0x0D
|
|
471 #define CMD_NIEN_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (NIEN_BITNUMBER * 4))
|
|
472
|
|
473 /* Alias word address of ATACMD bit */
|
|
474 #define ATACMD_BITNUMBER 0x0E
|
|
475 #define CMD_ATACMD_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32) + (ATACMD_BITNUMBER * 4))
|
|
476
|
|
477 /* --- DCTRL Register ---*/
|
|
478 /* Alias word address of DMAEN bit */
|
|
479 #define DCTRL_OFFSET (SDIO_OFFSET + 0x2C)
|
|
480 #define DMAEN_BITNUMBER 0x03
|
|
481 #define DCTRL_DMAEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (DMAEN_BITNUMBER * 4))
|
|
482
|
|
483 /* Alias word address of RWSTART bit */
|
|
484 #define RWSTART_BITNUMBER 0x08
|
|
485 #define DCTRL_RWSTART_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTART_BITNUMBER * 4))
|
|
486
|
|
487 /* Alias word address of RWSTOP bit */
|
|
488 #define RWSTOP_BITNUMBER 0x09
|
|
489 #define DCTRL_RWSTOP_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWSTOP_BITNUMBER * 4))
|
|
490
|
|
491 /* Alias word address of RWMOD bit */
|
|
492 #define RWMOD_BITNUMBER 0x0A
|
|
493 #define DCTRL_RWMOD_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (RWMOD_BITNUMBER * 4))
|
|
494
|
|
495 /* Alias word address of SDIOEN bit */
|
|
496 #define SDIOEN_BITNUMBER 0x0B
|
|
497 #define DCTRL_SDIOEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32) + (SDIOEN_BITNUMBER * 4))
|
|
498 /**
|
|
499 * @}
|
|
500 */
|
|
501
|
|
502 /** @defgroup SDMMC_LL_Register Bits And Addresses Definitions
|
|
503 * @brief SDMMC_LL registers bit address in the alias region
|
|
504 * @{
|
|
505 */
|
|
506
|
|
507 /* ---------------------- SDIO registers bit mask --------------------------- */
|
|
508 /* --- CLKCR Register ---*/
|
|
509 /* CLKCR register clear mask */
|
|
510 #define CLKCR_CLEAR_MASK ((uint32_t)(SDIO_CLKCR_CLKDIV | SDIO_CLKCR_PWRSAV |\
|
|
511 SDIO_CLKCR_BYPASS | SDIO_CLKCR_WIDBUS |\
|
|
512 SDIO_CLKCR_NEGEDGE | SDIO_CLKCR_HWFC_EN))
|
|
513
|
|
514 /* --- PWRCTRL Register ---*/
|
|
515 /* --- DCTRL Register ---*/
|
|
516 /* SDIO DCTRL Clear Mask */
|
|
517 #define DCTRL_CLEAR_MASK ((uint32_t)(SDIO_DCTRL_DTEN | SDIO_DCTRL_DTDIR |\
|
|
518 SDIO_DCTRL_DTMODE | SDIO_DCTRL_DBLOCKSIZE))
|
|
519
|
|
520 /* --- CMD Register ---*/
|
|
521 /* CMD Register clear mask */
|
|
522 #define CMD_CLEAR_MASK ((uint32_t)(SDIO_CMD_CMDINDEX | SDIO_CMD_WAITRESP |\
|
|
523 SDIO_CMD_WAITINT | SDIO_CMD_WAITPEND |\
|
|
524 SDIO_CMD_CPSMEN | SDIO_CMD_SDIOSUSPEND))
|
|
525
|
|
526 /* SDIO RESP Registers Address */
|
|
527 #define SDIO_RESP_ADDR ((uint32_t)(SDIO_BASE + 0x14))
|
|
528
|
|
529 /* SDIO Initialization Frequency (400KHz max) */
|
|
530 #define SDIO_INIT_CLK_DIV ((uint8_t)0x76)
|
|
531
|
|
532 /* SDIO Data Transfer Frequency (25MHz max) */
|
|
533 #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0)
|
|
534 /**
|
|
535 * @}
|
|
536 */
|
|
537
|
|
538 /** @defgroup SDMMC_LL_Interrupt_Clock Interrupt And Clock Configuration
|
|
539 * @brief macros to handle interrupts and specific clock configurations
|
|
540 * @{
|
|
541 */
|
|
542
|
|
543 /**
|
|
544 * @brief Enable the SDIO device.
|
|
545 * @retval None
|
|
546 */
|
|
547 #define __SDIO_ENABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = ENABLE)
|
|
548
|
|
549 /**
|
|
550 * @brief Disable the SDIO device.
|
|
551 * @retval None
|
|
552 */
|
|
553 #define __SDIO_DISABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = DISABLE)
|
|
554
|
|
555 /**
|
|
556 * @brief Enable the SDIO DMA transfer.
|
|
557 * @retval None
|
|
558 */
|
|
559 #define __SDIO_DMA_ENABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = ENABLE)
|
|
560
|
|
561 /**
|
|
562 * @brief Disable the SDIO DMA transfer.
|
|
563 * @retval None
|
|
564 */
|
|
565 #define __SDIO_DMA_DISABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = DISABLE)
|
|
566
|
|
567 /**
|
|
568 * @brief Enable the SDIO device interrupt.
|
|
569 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
570 * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be enabled.
|
|
571 * This parameter can be one or a combination of the following values:
|
|
572 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
|
573 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
|
574 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
|
575 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
|
576 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
|
577 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
|
578 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
|
579 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
|
580 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
|
581 * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
|
|
582 * bus mode interrupt
|
|
583 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
|
584 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
|
585 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
|
586 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
|
587 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
|
588 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
|
589 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
|
590 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
|
591 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
|
592 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
|
593 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
|
594 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
|
595 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
|
596 * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
|
|
597 * @retval None
|
|
598 */
|
|
599 #define __SDIO_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
|
|
600
|
|
601 /**
|
|
602 * @brief Disable the SDIO device interrupt.
|
|
603 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
604 * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be disabled.
|
|
605 * This parameter can be one or a combination of the following values:
|
|
606 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
|
607 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
|
608 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
|
609 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
|
610 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
|
611 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
|
612 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
|
613 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
|
614 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
|
615 * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
|
|
616 * bus mode interrupt
|
|
617 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
|
618 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
|
619 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
|
620 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
|
621 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
|
622 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
|
623 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
|
624 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
|
625 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
|
626 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
|
627 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
|
628 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
|
629 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
|
630 * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
|
|
631 * @retval None
|
|
632 */
|
|
633 #define __SDIO_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
|
|
634
|
|
635 /**
|
|
636 * @brief Checks whether the specified SDIO flag is set or not.
|
|
637 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
638 * @param __FLAG__: specifies the flag to check.
|
|
639 * This parameter can be one of the following values:
|
|
640 * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
|
|
641 * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
|
|
642 * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
|
|
643 * @arg SDIO_FLAG_DTIMEOUT: Data timeout
|
|
644 * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
|
|
645 * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
|
|
646 * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
|
|
647 * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
|
|
648 * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
|
|
649 * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode.
|
|
650 * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
|
|
651 * @arg SDIO_FLAG_CMDACT: Command transfer in progress
|
|
652 * @arg SDIO_FLAG_TXACT: Data transmit in progress
|
|
653 * @arg SDIO_FLAG_RXACT: Data receive in progress
|
|
654 * @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty
|
|
655 * @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full
|
|
656 * @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full
|
|
657 * @arg SDIO_FLAG_RXFIFOF: Receive FIFO full
|
|
658 * @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty
|
|
659 * @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty
|
|
660 * @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO
|
|
661 * @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO
|
|
662 * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
|
|
663 * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61
|
|
664 * @retval The new state of SDIO_FLAG (SET or RESET).
|
|
665 */
|
|
666 #define __SDIO_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != RESET)
|
|
667
|
|
668
|
|
669 /**
|
|
670 * @brief Clears the SDIO pending flags.
|
|
671 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
672 * @param __FLAG__: specifies the flag to clear.
|
|
673 * This parameter can be one or a combination of the following values:
|
|
674 * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
|
|
675 * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
|
|
676 * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
|
|
677 * @arg SDIO_FLAG_DTIMEOUT: Data timeout
|
|
678 * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
|
|
679 * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
|
|
680 * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
|
|
681 * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
|
|
682 * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
|
|
683 * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode
|
|
684 * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
|
|
685 * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
|
|
686 * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61
|
|
687 * @retval None
|
|
688 */
|
|
689 #define __SDIO_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
|
|
690
|
|
691 /**
|
|
692 * @brief Checks whether the specified SDIO interrupt has occurred or not.
|
|
693 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
694 * @param __INTERRUPT__: specifies the SDIO interrupt source to check.
|
|
695 * This parameter can be one of the following values:
|
|
696 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
|
697 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
|
698 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
|
699 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
|
700 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
|
701 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
|
702 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
|
703 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
|
704 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
|
705 * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
|
|
706 * bus mode interrupt
|
|
707 * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
|
708 * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
|
709 * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
|
710 * @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
|
711 * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
|
712 * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
|
713 * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
|
714 * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
|
715 * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
|
716 * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
|
717 * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
|
718 * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
|
719 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
|
720 * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
|
|
721 * @retval The new state of SDIO_IT (SET or RESET).
|
|
722 */
|
|
723 #define __SDIO_GET_IT (__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
|
|
724
|
|
725 /**
|
|
726 * @brief Clears the SDIO's interrupt pending bits.
|
|
727 * @param __INSTANCE__ : Pointer to SDIO register base
|
|
728 * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
|
|
729 * This parameter can be one or a combination of the following values:
|
|
730 * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
|
731 * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
|
732 * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
|
733 * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
|
734 * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
|
735 * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
|
736 * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
|
737 * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
|
738 * @arg SDIO_IT_DATAEND: Data end (data counter, SDIO_DCOUNT, is zero) interrupt
|
|
739 * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
|
|
740 * bus mode interrupt
|
|
741 * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
|
742 * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61
|
|
743 * @retval None
|
|
744 */
|
|
745 #define __SDIO_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
|
|
746
|
|
747 /**
|
|
748 * @brief Enable Start the SD I/O Read Wait operation.
|
|
749 * @retval None
|
|
750 */
|
|
751 #define __SDIO_START_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = ENABLE)
|
|
752
|
|
753 /**
|
|
754 * @brief Disable Start the SD I/O Read Wait operations.
|
|
755 * @retval None
|
|
756 */
|
|
757 #define __SDIO_START_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = DISABLE)
|
|
758
|
|
759 /**
|
|
760 * @brief Enable Start the SD I/O Read Wait operation.
|
|
761 * @retval None
|
|
762 */
|
|
763 #define __SDIO_STOP_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = ENABLE)
|
|
764
|
|
765 /**
|
|
766 * @brief Disable Stop the SD I/O Read Wait operations.
|
|
767 * @retval None
|
|
768 */
|
|
769 #define __SDIO_STOP_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = DISABLE)
|
|
770
|
|
771 /**
|
|
772 * @brief Enable the SD I/O Mode Operation.
|
|
773 * @retval None
|
|
774 */
|
|
775 #define __SDIO_OPERATION_ENABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = ENABLE)
|
|
776
|
|
777 /**
|
|
778 * @brief Disable the SD I/O Mode Operation.
|
|
779 * @retval None
|
|
780 */
|
|
781 #define __SDIO_OPERATION_DISABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = DISABLE)
|
|
782
|
|
783 /**
|
|
784 * @brief Enable the SD I/O Suspend command sending.
|
|
785 * @retval None
|
|
786 */
|
|
787 #define __SDIO_SUSPEND_CMD_ENABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = ENABLE)
|
|
788
|
|
789 /**
|
|
790 * @brief Disable the SD I/O Suspend command sending.
|
|
791 * @retval None
|
|
792 */
|
|
793 #define __SDIO_SUSPEND_CMD_DISABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = DISABLE)
|
|
794
|
|
795 /**
|
|
796 * @brief Enable the command completion signal.
|
|
797 * @retval None
|
|
798 */
|
|
799 #define __SDIO_CEATA_CMD_COMPLETION_ENABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = ENABLE)
|
|
800
|
|
801 /**
|
|
802 * @brief Disable the command completion signal.
|
|
803 * @retval None
|
|
804 */
|
|
805 #define __SDIO_CEATA_CMD_COMPLETION_DISABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = DISABLE)
|
|
806
|
|
807 /**
|
|
808 * @brief Enable the CE-ATA interrupt.
|
|
809 * @retval None
|
|
810 */
|
|
811 #define __SDIO_CEATA_ENABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)0)
|
|
812
|
|
813 /**
|
|
814 * @brief Disable the CE-ATA interrupt.
|
|
815 * @retval None
|
|
816 */
|
|
817 #define __SDIO_CEATA_DISABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)1)
|
|
818
|
|
819 /**
|
|
820 * @brief Enable send CE-ATA command (CMD61).
|
|
821 * @retval None
|
|
822 */
|
|
823 #define __SDIO_CEATA_SENDCMD_ENABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = ENABLE)
|
|
824
|
|
825 /**
|
|
826 * @brief Disable send CE-ATA command (CMD61).
|
|
827 * @retval None
|
|
828 */
|
|
829 #define __SDIO_CEATA_SENDCMD_DISABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = DISABLE)
|
|
830
|
|
831 /**
|
|
832 * @}
|
|
833 */
|
|
834
|
|
835 /**
|
|
836 * @}
|
|
837 */
|
|
838
|
|
839 /* Exported functions --------------------------------------------------------*/
|
|
840 /** @addtogroup SDMMC_LL_Exported_Functions
|
|
841 * @{
|
|
842 */
|
|
843
|
|
844 /* Initialization/de-initialization functions **********************************/
|
|
845 /** @addtogroup HAL_SDMMC_LL_Group1
|
|
846 * @{
|
|
847 */
|
|
848 HAL_StatusTypeDef SDIO_Init(SDIO_TypeDef *SDIOx, SDIO_InitTypeDef Init);
|
|
849 /**
|
|
850 * @}
|
|
851 */
|
|
852
|
|
853 /* I/O operation functions *****************************************************/
|
|
854 /** @addtogroup HAL_SDMMC_LL_Group2
|
|
855 * @{
|
|
856 */
|
|
857 /* Blocking mode: Polling */
|
|
858 uint32_t SDIO_ReadFIFO(SDIO_TypeDef *SDIOx);
|
|
859 HAL_StatusTypeDef SDIO_WriteFIFO(SDIO_TypeDef *SDIOx, uint32_t *pWriteData);
|
|
860 /**
|
|
861 * @}
|
|
862 */
|
|
863
|
|
864 /* Peripheral Control functions ************************************************/
|
|
865 /** @addtogroup HAL_SDMMC_LL_Group3
|
|
866 * @{
|
|
867 */
|
|
868 HAL_StatusTypeDef SDIO_PowerState_ON(SDIO_TypeDef *SDIOx);
|
|
869 HAL_StatusTypeDef SDIO_PowerState_OFF(SDIO_TypeDef *SDIOx);
|
|
870 uint32_t SDIO_GetPowerState(SDIO_TypeDef *SDIOx);
|
|
871
|
|
872 /* Command path state machine (CPSM) management functions */
|
|
873 HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *SDIO_CmdInitStruct);
|
|
874 uint8_t SDIO_GetCommandResponse(SDIO_TypeDef *SDIOx);
|
|
875 uint32_t SDIO_GetResponse(uint32_t SDIO_RESP);
|
|
876
|
|
877 /* Data path state machine (DPSM) management functions */
|
|
878 HAL_StatusTypeDef SDIO_DataConfig(SDIO_TypeDef *SDIOx, SDIO_DataInitTypeDef* SDIO_DataInitStruct);
|
|
879 uint32_t SDIO_GetDataCounter(SDIO_TypeDef *SDIOx);
|
|
880 uint32_t SDIO_GetFIFOCount(SDIO_TypeDef *SDIOx);
|
|
881
|
|
882 /* SDIO IO Cards mode management functions */
|
|
883 HAL_StatusTypeDef SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode);
|
|
884
|
|
885 /**
|
|
886 * @}
|
|
887 */
|
|
888
|
|
889 /**
|
|
890 * @}
|
|
891 */
|
|
892
|
|
893 /**
|
|
894 * @}
|
|
895 */
|
|
896
|
|
897 /**
|
|
898 * @}
|
|
899 */
|
|
900
|
|
901 #ifdef __cplusplus
|
|
902 }
|
|
903 #endif
|
|
904
|
|
905 #endif /* __STM32F4xx_LL_SDMMC_H */
|
|
906
|
|
907 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|