stm32f7xx_ll_sdmmc.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_LL_SDMMC_H
22 #define STM32F7xx_LL_SDMMC_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 #if defined(SDMMC1)
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32f7xx_hal_def.h"
32 
41 /* Exported types ------------------------------------------------------------*/
49 typedef struct
50 {
51  uint32_t ClockEdge;
54  uint32_t ClockBypass;
58  uint32_t ClockPowerSave;
62  uint32_t BusWide;
65  uint32_t HardwareFlowControl;
68  uint32_t ClockDiv;
71 }SDMMC_InitTypeDef;
72 
73 
77 typedef struct
78 {
79  uint32_t Argument;
84  uint32_t CmdIndex;
87  uint32_t Response;
90  uint32_t WaitForInterrupt;
94  uint32_t CPSM;
97 }SDMMC_CmdInitTypeDef;
98 
99 
103 typedef struct
104 {
105  uint32_t DataTimeOut;
107  uint32_t DataLength;
109  uint32_t DataBlockSize;
112  uint32_t TransferDir;
116  uint32_t TransferMode;
119  uint32_t DPSM;
122 }SDMMC_DataInitTypeDef;
123 
128 /* Exported constants --------------------------------------------------------*/
132 #define SDMMC_ERROR_NONE 0x00000000U
133 #define SDMMC_ERROR_CMD_CRC_FAIL 0x00000001U
134 #define SDMMC_ERROR_DATA_CRC_FAIL 0x00000002U
135 #define SDMMC_ERROR_CMD_RSP_TIMEOUT 0x00000004U
136 #define SDMMC_ERROR_DATA_TIMEOUT 0x00000008U
137 #define SDMMC_ERROR_TX_UNDERRUN 0x00000010U
138 #define SDMMC_ERROR_RX_OVERRUN 0x00000020U
139 #define SDMMC_ERROR_ADDR_MISALIGNED 0x00000040U
140 #define SDMMC_ERROR_BLOCK_LEN_ERR 0x00000080U
142 #define SDMMC_ERROR_ERASE_SEQ_ERR 0x00000100U
143 #define SDMMC_ERROR_BAD_ERASE_PARAM 0x00000200U
144 #define SDMMC_ERROR_WRITE_PROT_VIOLATION 0x00000400U
145 #define SDMMC_ERROR_LOCK_UNLOCK_FAILED 0x00000800U
147 #define SDMMC_ERROR_COM_CRC_FAILED 0x00001000U
148 #define SDMMC_ERROR_ILLEGAL_CMD 0x00002000U
149 #define SDMMC_ERROR_CARD_ECC_FAILED 0x00004000U
150 #define SDMMC_ERROR_CC_ERR 0x00008000U
151 #define SDMMC_ERROR_GENERAL_UNKNOWN_ERR 0x00010000U
152 #define SDMMC_ERROR_STREAM_READ_UNDERRUN 0x00020000U
153 #define SDMMC_ERROR_STREAM_WRITE_OVERRUN 0x00040000U
154 #define SDMMC_ERROR_CID_CSD_OVERWRITE 0x00080000U
155 #define SDMMC_ERROR_WP_ERASE_SKIP 0x00100000U
156 #define SDMMC_ERROR_CARD_ECC_DISABLED 0x00200000U
157 #define SDMMC_ERROR_ERASE_RESET 0x00400000U
159 #define SDMMC_ERROR_AKE_SEQ_ERR 0x00800000U
160 #define SDMMC_ERROR_INVALID_VOLTRANGE 0x01000000U
161 #define SDMMC_ERROR_ADDR_OUT_OF_RANGE 0x02000000U
162 #define SDMMC_ERROR_REQUEST_NOT_APPLICABLE 0x04000000U
163 #define SDMMC_ERROR_INVALID_PARAMETER 0x08000000U
164 #define SDMMC_ERROR_UNSUPPORTED_FEATURE 0x10000000U
165 #define SDMMC_ERROR_BUSY 0x20000000U
166 #define SDMMC_ERROR_DMA 0x40000000U
167 #define SDMMC_ERROR_TIMEOUT 0x80000000U
172 #define SDMMC_CMD_GO_IDLE_STATE 0U
173 #define SDMMC_CMD_SEND_OP_COND 1U
174 #define SDMMC_CMD_ALL_SEND_CID 2U
175 #define SDMMC_CMD_SET_REL_ADDR 3U
176 #define SDMMC_CMD_SET_DSR 4U
177 #define SDMMC_CMD_SDMMC_SEN_OP_COND 5U
179 #define SDMMC_CMD_HS_SWITCH 6U
180 #define SDMMC_CMD_SEL_DESEL_CARD 7U
181 #define SDMMC_CMD_HS_SEND_EXT_CSD 8U
183 #define SDMMC_CMD_SEND_CSD 9U
184 #define SDMMC_CMD_SEND_CID 10U
185 #define SDMMC_CMD_READ_DAT_UNTIL_STOP 11U
186 #define SDMMC_CMD_STOP_TRANSMISSION 12U
187 #define SDMMC_CMD_SEND_STATUS 13U
188 #define SDMMC_CMD_HS_BUSTEST_READ 14U
189 #define SDMMC_CMD_GO_INACTIVE_STATE 15U
190 #define SDMMC_CMD_SET_BLOCKLEN 16U
193 #define SDMMC_CMD_READ_SINGLE_BLOCK 17U
195 #define SDMMC_CMD_READ_MULT_BLOCK 18U
197 #define SDMMC_CMD_HS_BUSTEST_WRITE 19U
198 #define SDMMC_CMD_WRITE_DAT_UNTIL_STOP 20U
199 #define SDMMC_CMD_SET_BLOCK_COUNT 23U
200 #define SDMMC_CMD_WRITE_SINGLE_BLOCK 24U
202 #define SDMMC_CMD_WRITE_MULT_BLOCK 25U
203 #define SDMMC_CMD_PROG_CID 26U
204 #define SDMMC_CMD_PROG_CSD 27U
205 #define SDMMC_CMD_SET_WRITE_PROT 28U
206 #define SDMMC_CMD_CLR_WRITE_PROT 29U
207 #define SDMMC_CMD_SEND_WRITE_PROT 30U
208 #define SDMMC_CMD_SD_ERASE_GRP_START 32U
209 #define SDMMC_CMD_SD_ERASE_GRP_END 33U
210 #define SDMMC_CMD_ERASE_GRP_START 35U
212 #define SDMMC_CMD_ERASE_GRP_END 36U
214 #define SDMMC_CMD_ERASE 38U
215 #define SDMMC_CMD_FAST_IO 39U
216 #define SDMMC_CMD_GO_IRQ_STATE 40U
217 #define SDMMC_CMD_LOCK_UNLOCK 42U
219 #define SDMMC_CMD_APP_CMD 55U
221 #define SDMMC_CMD_GEN_CMD 56U
223 #define SDMMC_CMD_NO_CMD 64U
229 #define SDMMC_CMD_APP_SD_SET_BUSWIDTH 6U
231 #define SDMMC_CMD_SD_APP_STATUS 13U
232 #define SDMMC_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS 22U
234 #define SDMMC_CMD_SD_APP_OP_COND 41U
236 #define SDMMC_CMD_SD_APP_SET_CLR_CARD_DETECT 42U
237 #define SDMMC_CMD_SD_APP_SEND_SCR 51U
238 #define SDMMC_CMD_SDMMC_RW_DIRECT 52U
239 #define SDMMC_CMD_SDMMC_RW_EXTENDED 53U
245 #define SDMMC_CMD_SD_APP_GET_MKB 43U
246 #define SDMMC_CMD_SD_APP_GET_MID 44U
247 #define SDMMC_CMD_SD_APP_SET_CER_RN1 45U
248 #define SDMMC_CMD_SD_APP_GET_CER_RN2 46U
249 #define SDMMC_CMD_SD_APP_SET_CER_RES2 47U
250 #define SDMMC_CMD_SD_APP_GET_CER_RES1 48U
251 #define SDMMC_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK 18U
252 #define SDMMC_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK 25U
253 #define SDMMC_CMD_SD_APP_SECURE_ERASE 38U
254 #define SDMMC_CMD_SD_APP_CHANGE_SECURE_AREA 49U
255 #define SDMMC_CMD_SD_APP_SECURE_WRITE_MKB 48U
256 
260 #define SDMMC_OCR_ADDR_OUT_OF_RANGE 0x80000000U
261 #define SDMMC_OCR_ADDR_MISALIGNED 0x40000000U
262 #define SDMMC_OCR_BLOCK_LEN_ERR 0x20000000U
263 #define SDMMC_OCR_ERASE_SEQ_ERR 0x10000000U
264 #define SDMMC_OCR_BAD_ERASE_PARAM 0x08000000U
265 #define SDMMC_OCR_WRITE_PROT_VIOLATION 0x04000000U
266 #define SDMMC_OCR_LOCK_UNLOCK_FAILED 0x01000000U
267 #define SDMMC_OCR_COM_CRC_FAILED 0x00800000U
268 #define SDMMC_OCR_ILLEGAL_CMD 0x00400000U
269 #define SDMMC_OCR_CARD_ECC_FAILED 0x00200000U
270 #define SDMMC_OCR_CC_ERROR 0x00100000U
271 #define SDMMC_OCR_GENERAL_UNKNOWN_ERROR 0x00080000U
272 #define SDMMC_OCR_STREAM_READ_UNDERRUN 0x00040000U
273 #define SDMMC_OCR_STREAM_WRITE_OVERRUN 0x00020000U
274 #define SDMMC_OCR_CID_CSD_OVERWRITE 0x00010000U
275 #define SDMMC_OCR_WP_ERASE_SKIP 0x00008000U
276 #define SDMMC_OCR_CARD_ECC_DISABLED 0x00004000U
277 #define SDMMC_OCR_ERASE_RESET 0x00002000U
278 #define SDMMC_OCR_AKE_SEQ_ERROR 0x00000008U
279 #define SDMMC_OCR_ERRORBITS 0xFDFFE008U
280 
284 #define SDMMC_R6_GENERAL_UNKNOWN_ERROR 0x00002000U
285 #define SDMMC_R6_ILLEGAL_CMD 0x00004000U
286 #define SDMMC_R6_COM_CRC_FAILED 0x00008000U
287 
288 #define SDMMC_VOLTAGE_WINDOW_SD 0x80100000U
289 #define SDMMC_HIGH_CAPACITY 0x40000000U
290 #define SDMMC_STD_CAPACITY 0x00000000U
291 #define SDMMC_CHECK_PATTERN 0x000001AAU
292 #define SD_SWITCH_1_8V_CAPACITY 0x01000000U
293 
294 #define SDMMC_MAX_VOLT_TRIAL 0x0000FFFFU
295 
296 #define SDMMC_MAX_TRIAL 0x0000FFFFU
297 
298 #define SDMMC_ALLZERO 0x00000000U
299 
300 #define SDMMC_WIDE_BUS_SUPPORT 0x00040000U
301 #define SDMMC_SINGLE_BUS_SUPPORT 0x00010000U
302 #define SDMMC_CARD_LOCKED 0x02000000U
303 
304 #define SDMMC_DATATIMEOUT 0xFFFFFFFFU
305 
306 #define SDMMC_0TO7BITS 0x000000FFU
307 #define SDMMC_8TO15BITS 0x0000FF00U
308 #define SDMMC_16TO23BITS 0x00FF0000U
309 #define SDMMC_24TO31BITS 0xFF000000U
310 #define SDMMC_MAX_DATA_LENGTH 0x01FFFFFFU
311 
312 #define SDMMC_HALFFIFO 0x00000008U
313 #define SDMMC_HALFFIFOBYTES 0x00000020U
314 
318 #define SDMMC_CCCC_ERASE 0x00000020U
319 
320 #define SDMMC_CMDTIMEOUT 5000U /* Command send and response timeout */
321 #define SDMMC_MAXERASETIMEOUT 63000U /* Max erase Timeout 63 s */
322 #define SDMMC_STOPTRANSFERTIMEOUT 100000000U /* Timeout for STOP TRANSMISSION command */
323 
327 #define SDMMC_CLOCK_EDGE_RISING 0x00000000U
328 #define SDMMC_CLOCK_EDGE_FALLING SDMMC_CLKCR_NEGEDGE
329 
330 #define IS_SDMMC_CLOCK_EDGE(EDGE) (((EDGE) == SDMMC_CLOCK_EDGE_RISING) || \
331  ((EDGE) == SDMMC_CLOCK_EDGE_FALLING))
332 
339 #define SDMMC_CLOCK_BYPASS_DISABLE 0x00000000U
340 #define SDMMC_CLOCK_BYPASS_ENABLE SDMMC_CLKCR_BYPASS
341 
342 #define IS_SDMMC_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDMMC_CLOCK_BYPASS_DISABLE) || \
343  ((BYPASS) == SDMMC_CLOCK_BYPASS_ENABLE))
344 
351 #define SDMMC_CLOCK_POWER_SAVE_DISABLE 0x00000000U
352 #define SDMMC_CLOCK_POWER_SAVE_ENABLE SDMMC_CLKCR_PWRSAV
353 
354 #define IS_SDMMC_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDMMC_CLOCK_POWER_SAVE_DISABLE) || \
355  ((SAVE) == SDMMC_CLOCK_POWER_SAVE_ENABLE))
356 
363 #define SDMMC_BUS_WIDE_1B 0x00000000U
364 #define SDMMC_BUS_WIDE_4B SDMMC_CLKCR_WIDBUS_0
365 #define SDMMC_BUS_WIDE_8B SDMMC_CLKCR_WIDBUS_1
366 
367 #define IS_SDMMC_BUS_WIDE(WIDE) (((WIDE) == SDMMC_BUS_WIDE_1B) || \
368  ((WIDE) == SDMMC_BUS_WIDE_4B) || \
369  ((WIDE) == SDMMC_BUS_WIDE_8B))
370 
377 #define SDMMC_HARDWARE_FLOW_CONTROL_DISABLE 0x00000000U
378 #define SDMMC_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_CLKCR_HWFC_EN
379 
380 #define IS_SDMMC_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_DISABLE) || \
381  ((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_ENABLE))
382 
389 #define IS_SDMMC_CLKDIV(DIV) ((DIV) <= 0xFFU)
390 
397 #define IS_SDMMC_CMD_INDEX(INDEX) ((INDEX) < 0x40U)
398 
405 #define SDMMC_RESPONSE_NO 0x00000000U
406 #define SDMMC_RESPONSE_SHORT SDMMC_CMD_WAITRESP_0
407 #define SDMMC_RESPONSE_LONG SDMMC_CMD_WAITRESP
408 
409 #define IS_SDMMC_RESPONSE(RESPONSE) (((RESPONSE) == SDMMC_RESPONSE_NO) || \
410  ((RESPONSE) == SDMMC_RESPONSE_SHORT) || \
411  ((RESPONSE) == SDMMC_RESPONSE_LONG))
412 
419 #define SDMMC_WAIT_NO 0x00000000U
420 #define SDMMC_WAIT_IT SDMMC_CMD_WAITINT
421 #define SDMMC_WAIT_PEND SDMMC_CMD_WAITPEND
422 
423 #define IS_SDMMC_WAIT(WAIT) (((WAIT) == SDMMC_WAIT_NO) || \
424  ((WAIT) == SDMMC_WAIT_IT) || \
425  ((WAIT) == SDMMC_WAIT_PEND))
426 
433 #define SDMMC_CPSM_DISABLE 0x00000000U
434 #define SDMMC_CPSM_ENABLE SDMMC_CMD_CPSMEN
435 
436 #define IS_SDMMC_CPSM(CPSM) (((CPSM) == SDMMC_CPSM_DISABLE) || \
437  ((CPSM) == SDMMC_CPSM_ENABLE))
438 
445 #define SDMMC_RESP1 0x00000000U
446 #define SDMMC_RESP2 0x00000004U
447 #define SDMMC_RESP3 0x00000008U
448 #define SDMMC_RESP4 0x0000000CU
449 
450 #define IS_SDMMC_RESP(RESP) (((RESP) == SDMMC_RESP1) || \
451  ((RESP) == SDMMC_RESP2) || \
452  ((RESP) == SDMMC_RESP3) || \
453  ((RESP) == SDMMC_RESP4))
454 
461 #define IS_SDMMC_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFFU)
462 
469 #define SDMMC_DATABLOCK_SIZE_1B 0x00000000U
470 #define SDMMC_DATABLOCK_SIZE_2B SDMMC_DCTRL_DBLOCKSIZE_0
471 #define SDMMC_DATABLOCK_SIZE_4B SDMMC_DCTRL_DBLOCKSIZE_1
472 #define SDMMC_DATABLOCK_SIZE_8B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1)
473 #define SDMMC_DATABLOCK_SIZE_16B SDMMC_DCTRL_DBLOCKSIZE_2
474 #define SDMMC_DATABLOCK_SIZE_32B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2)
475 #define SDMMC_DATABLOCK_SIZE_64B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
476 #define SDMMC_DATABLOCK_SIZE_128B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
477 #define SDMMC_DATABLOCK_SIZE_256B SDMMC_DCTRL_DBLOCKSIZE_3
478 #define SDMMC_DATABLOCK_SIZE_512B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_3)
479 #define SDMMC_DATABLOCK_SIZE_1024B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
480 #define SDMMC_DATABLOCK_SIZE_2048B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
481 #define SDMMC_DATABLOCK_SIZE_4096B (SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
482 #define SDMMC_DATABLOCK_SIZE_8192B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
483 #define SDMMC_DATABLOCK_SIZE_16384B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
484 
485 #define IS_SDMMC_BLOCK_SIZE(SIZE) (((SIZE) == SDMMC_DATABLOCK_SIZE_1B) || \
486  ((SIZE) == SDMMC_DATABLOCK_SIZE_2B) || \
487  ((SIZE) == SDMMC_DATABLOCK_SIZE_4B) || \
488  ((SIZE) == SDMMC_DATABLOCK_SIZE_8B) || \
489  ((SIZE) == SDMMC_DATABLOCK_SIZE_16B) || \
490  ((SIZE) == SDMMC_DATABLOCK_SIZE_32B) || \
491  ((SIZE) == SDMMC_DATABLOCK_SIZE_64B) || \
492  ((SIZE) == SDMMC_DATABLOCK_SIZE_128B) || \
493  ((SIZE) == SDMMC_DATABLOCK_SIZE_256B) || \
494  ((SIZE) == SDMMC_DATABLOCK_SIZE_512B) || \
495  ((SIZE) == SDMMC_DATABLOCK_SIZE_1024B) || \
496  ((SIZE) == SDMMC_DATABLOCK_SIZE_2048B) || \
497  ((SIZE) == SDMMC_DATABLOCK_SIZE_4096B) || \
498  ((SIZE) == SDMMC_DATABLOCK_SIZE_8192B) || \
499  ((SIZE) == SDMMC_DATABLOCK_SIZE_16384B))
500 
507 #define SDMMC_TRANSFER_DIR_TO_CARD 0x00000000U
508 #define SDMMC_TRANSFER_DIR_TO_SDMMC SDMMC_DCTRL_DTDIR
509 
510 #define IS_SDMMC_TRANSFER_DIR(DIR) (((DIR) == SDMMC_TRANSFER_DIR_TO_CARD) || \
511  ((DIR) == SDMMC_TRANSFER_DIR_TO_SDMMC))
512 
519 #define SDMMC_TRANSFER_MODE_BLOCK 0x00000000U
520 #define SDMMC_TRANSFER_MODE_STREAM SDMMC_DCTRL_DTMODE
521 
522 #define IS_SDMMC_TRANSFER_MODE(MODE) (((MODE) == SDMMC_TRANSFER_MODE_BLOCK) || \
523  ((MODE) == SDMMC_TRANSFER_MODE_STREAM))
524 
531 #define SDMMC_DPSM_DISABLE 0x00000000U
532 #define SDMMC_DPSM_ENABLE SDMMC_DCTRL_DTEN
533 
534 #define IS_SDMMC_DPSM(DPSM) (((DPSM) == SDMMC_DPSM_DISABLE) ||\
535  ((DPSM) == SDMMC_DPSM_ENABLE))
536 
543 #define SDMMC_READ_WAIT_MODE_DATA2 0x00000000U
544 #define SDMMC_READ_WAIT_MODE_CLK (SDMMC_DCTRL_RWMOD)
545 
546 #define IS_SDMMC_READWAIT_MODE(MODE) (((MODE) == SDMMC_READ_WAIT_MODE_CLK) || \
547  ((MODE) == SDMMC_READ_WAIT_MODE_DATA2))
548 
555 #define SDMMC_IT_CCRCFAIL SDMMC_MASK_CCRCFAILIE
556 #define SDMMC_IT_DCRCFAIL SDMMC_MASK_DCRCFAILIE
557 #define SDMMC_IT_CTIMEOUT SDMMC_MASK_CTIMEOUTIE
558 #define SDMMC_IT_DTIMEOUT SDMMC_MASK_DTIMEOUTIE
559 #define SDMMC_IT_TXUNDERR SDMMC_MASK_TXUNDERRIE
560 #define SDMMC_IT_RXOVERR SDMMC_MASK_RXOVERRIE
561 #define SDMMC_IT_CMDREND SDMMC_MASK_CMDRENDIE
562 #define SDMMC_IT_CMDSENT SDMMC_MASK_CMDSENTIE
563 #define SDMMC_IT_DATAEND SDMMC_MASK_DATAENDIE
564 #define SDMMC_IT_DBCKEND SDMMC_MASK_DBCKENDIE
565 #define SDMMC_IT_CMDACT SDMMC_MASK_CMDACTIE
566 #define SDMMC_IT_TXACT SDMMC_MASK_TXACTIE
567 #define SDMMC_IT_RXACT SDMMC_MASK_RXACTIE
568 #define SDMMC_IT_TXFIFOHE SDMMC_MASK_TXFIFOHEIE
569 #define SDMMC_IT_RXFIFOHF SDMMC_MASK_RXFIFOHFIE
570 #define SDMMC_IT_TXFIFOF SDMMC_MASK_TXFIFOFIE
571 #define SDMMC_IT_RXFIFOF SDMMC_MASK_RXFIFOFIE
572 #define SDMMC_IT_TXFIFOE SDMMC_MASK_TXFIFOEIE
573 #define SDMMC_IT_RXFIFOE SDMMC_MASK_RXFIFOEIE
574 #define SDMMC_IT_TXDAVL SDMMC_MASK_TXDAVLIE
575 #define SDMMC_IT_RXDAVL SDMMC_MASK_RXDAVLIE
576 #define SDMMC_IT_SDIOIT SDMMC_MASK_SDIOITIE
577 
584 #define SDMMC_FLAG_CCRCFAIL SDMMC_STA_CCRCFAIL
585 #define SDMMC_FLAG_DCRCFAIL SDMMC_STA_DCRCFAIL
586 #define SDMMC_FLAG_CTIMEOUT SDMMC_STA_CTIMEOUT
587 #define SDMMC_FLAG_DTIMEOUT SDMMC_STA_DTIMEOUT
588 #define SDMMC_FLAG_TXUNDERR SDMMC_STA_TXUNDERR
589 #define SDMMC_FLAG_RXOVERR SDMMC_STA_RXOVERR
590 #define SDMMC_FLAG_CMDREND SDMMC_STA_CMDREND
591 #define SDMMC_FLAG_CMDSENT SDMMC_STA_CMDSENT
592 #define SDMMC_FLAG_DATAEND SDMMC_STA_DATAEND
593 #define SDMMC_FLAG_DBCKEND SDMMC_STA_DBCKEND
594 #define SDMMC_FLAG_CMDACT SDMMC_STA_CMDACT
595 #define SDMMC_FLAG_TXACT SDMMC_STA_TXACT
596 #define SDMMC_FLAG_RXACT SDMMC_STA_RXACT
597 #define SDMMC_FLAG_TXFIFOHE SDMMC_STA_TXFIFOHE
598 #define SDMMC_FLAG_RXFIFOHF SDMMC_STA_RXFIFOHF
599 #define SDMMC_FLAG_TXFIFOF SDMMC_STA_TXFIFOF
600 #define SDMMC_FLAG_RXFIFOF SDMMC_STA_RXFIFOF
601 #define SDMMC_FLAG_TXFIFOE SDMMC_STA_TXFIFOE
602 #define SDMMC_FLAG_RXFIFOE SDMMC_STA_RXFIFOE
603 #define SDMMC_FLAG_TXDAVL SDMMC_STA_TXDAVL
604 #define SDMMC_FLAG_RXDAVL SDMMC_STA_RXDAVL
605 #define SDMMC_FLAG_SDIOIT SDMMC_STA_SDIOIT
606 #define SDMMC_STATIC_FLAGS ((uint32_t)(SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_CTIMEOUT |\
607  SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_TXUNDERR | SDMMC_FLAG_RXOVERR |\
608  SDMMC_FLAG_CMDREND | SDMMC_FLAG_CMDSENT | SDMMC_FLAG_DATAEND |\
609  SDMMC_FLAG_DBCKEND | SDMMC_FLAG_SDIOIT))
610 
611 #define SDMMC_STATIC_CMD_FLAGS ((uint32_t)(SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_CTIMEOUT | SDMMC_FLAG_CMDREND |\
612  SDMMC_FLAG_CMDSENT))
613 
614 #define SDMMC_STATIC_DATA_FLAGS ((uint32_t)(SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_TXUNDERR |\
615  SDMMC_FLAG_RXOVERR | SDMMC_FLAG_DATAEND | SDMMC_FLAG_DBCKEND))
616 
624 /* Exported macro ------------------------------------------------------------*/
633 /* ---------------------- SDMMC registers bit mask --------------------------- */
634 /* --- CLKCR Register ---*/
635 /* CLKCR register clear mask */
636 #define CLKCR_CLEAR_MASK ((uint32_t)(SDMMC_CLKCR_CLKDIV | SDMMC_CLKCR_PWRSAV |\
637  SDMMC_CLKCR_BYPASS | SDMMC_CLKCR_WIDBUS |\
638  SDMMC_CLKCR_NEGEDGE | SDMMC_CLKCR_HWFC_EN))
639 
640 /* --- DCTRL Register ---*/
641 /* SDMMC DCTRL Clear Mask */
642 #define DCTRL_CLEAR_MASK ((uint32_t)(SDMMC_DCTRL_DTEN | SDMMC_DCTRL_DTDIR |\
643  SDMMC_DCTRL_DTMODE | SDMMC_DCTRL_DBLOCKSIZE))
644 
645 /* --- CMD Register ---*/
646 /* CMD Register clear mask */
647 #define CMD_CLEAR_MASK ((uint32_t)(SDMMC_CMD_CMDINDEX | SDMMC_CMD_WAITRESP |\
648  SDMMC_CMD_WAITINT | SDMMC_CMD_WAITPEND |\
649  SDMMC_CMD_CPSMEN | SDMMC_CMD_SDIOSUSPEND))
650 
651 /* SDMMC Initialization Frequency (400KHz max) */
652 #define SDMMC_INIT_CLK_DIV ((uint8_t)0x76) /* 48MHz / (SDMMC_INIT_CLK_DIV + 2) < 400KHz */
653 
654 /* SDMMC Data Transfer Frequency (25MHz max) */
655 #define SDMMC_TRANSFER_CLK_DIV ((uint8_t)0x0) /* 48MHz / (SDMMC_TRANSFER_CLK_DIV + 2) < 25MHz */
656 
670 #define __SDMMC_ENABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR |= SDMMC_CLKCR_CLKEN)
671 
677 #define __SDMMC_DISABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR &= ~SDMMC_CLKCR_CLKEN)
678 
684 #define __SDMMC_DMA_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_DMAEN)
685 
691 #define __SDMMC_DMA_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_DMAEN)
692 
722 #define __SDMMC_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
723 
753 #define __SDMMC_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
754 
784 #define __SDMMC_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != 0U)
785 
786 
805 #define __SDMMC_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
806 
836 #define __SDMMC_GET_IT (__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
837 
855 #define __SDMMC_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
856 
862 #define __SDMMC_START_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTART)
863 
869 #define __SDMMC_START_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTART)
870 
876 #define __SDMMC_STOP_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTOP)
877 
883 #define __SDMMC_STOP_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTOP)
884 
890 #define __SDMMC_OPERATION_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_SDIOEN)
891 
897 #define __SDMMC_OPERATION_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_SDIOEN)
898 
904 #define __SDMMC_SUSPEND_CMD_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_SDIOSUSPEND)
905 
911 #define __SDMMC_SUSPEND_CMD_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_SDIOSUSPEND)
912 
921 /* Exported functions --------------------------------------------------------*/
926 /* Initialization/de-initialization functions **********************************/
930 HAL_StatusTypeDef SDMMC_Init(SDMMC_TypeDef *SDMMCx, SDMMC_InitTypeDef Init);
935 /* I/O operation functions *****************************************************/
939 uint32_t SDMMC_ReadFIFO(SDMMC_TypeDef *SDMMCx);
940 HAL_StatusTypeDef SDMMC_WriteFIFO(SDMMC_TypeDef *SDMMCx, uint32_t *pWriteData);
945 /* Peripheral Control functions ************************************************/
949 HAL_StatusTypeDef SDMMC_PowerState_ON(SDMMC_TypeDef *SDMMCx);
950 HAL_StatusTypeDef SDMMC_PowerState_OFF(SDMMC_TypeDef *SDMMCx);
951 uint32_t SDMMC_GetPowerState(SDMMC_TypeDef *SDMMCx);
952 
953 /* Command path state machine (CPSM) management functions */
954 HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command);
955 uint8_t SDMMC_GetCommandResponse(SDMMC_TypeDef *SDMMCx);
956 uint32_t SDMMC_GetResponse(SDMMC_TypeDef *SDMMCx, uint32_t Response);
957 
958 /* Data path state machine (DPSM) management functions */
959 HAL_StatusTypeDef SDMMC_ConfigData(SDMMC_TypeDef *SDMMCx, SDMMC_DataInitTypeDef* Data);
960 uint32_t SDMMC_GetDataCounter(SDMMC_TypeDef *SDMMCx);
961 uint32_t SDMMC_GetFIFOCount(SDMMC_TypeDef *SDMMCx);
962 
963 /* SDMMC Cards mode management functions */
964 HAL_StatusTypeDef SDMMC_SetSDMMCReadWaitMode(SDMMC_TypeDef *SDMMCx, uint32_t SDMMC_ReadWaitMode);
965 
966 /* SDMMC Commands management functions */
967 uint32_t SDMMC_CmdBlockLength(SDMMC_TypeDef *SDMMCx, uint32_t BlockSize);
968 uint32_t SDMMC_CmdReadSingleBlock(SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
969 uint32_t SDMMC_CmdReadMultiBlock(SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
970 uint32_t SDMMC_CmdWriteSingleBlock(SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
971 uint32_t SDMMC_CmdWriteMultiBlock(SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
972 uint32_t SDMMC_CmdEraseStartAdd(SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
973 uint32_t SDMMC_CmdSDEraseStartAdd(SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
974 uint32_t SDMMC_CmdEraseEndAdd(SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
975 uint32_t SDMMC_CmdSDEraseEndAdd(SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
976 uint32_t SDMMC_CmdErase(SDMMC_TypeDef *SDMMCx);
977 uint32_t SDMMC_CmdStopTransfer(SDMMC_TypeDef *SDMMCx);
978 uint32_t SDMMC_CmdSelDesel(SDMMC_TypeDef *SDMMCx, uint64_t Addr);
979 uint32_t SDMMC_CmdGoIdleState(SDMMC_TypeDef *SDMMCx);
980 uint32_t SDMMC_CmdOperCond(SDMMC_TypeDef *SDMMCx);
981 uint32_t SDMMC_CmdAppCommand(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
982 uint32_t SDMMC_CmdAppOperCommand(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
983 uint32_t SDMMC_CmdBusWidth(SDMMC_TypeDef *SDMMCx, uint32_t BusWidth);
984 uint32_t SDMMC_CmdSendSCR(SDMMC_TypeDef *SDMMCx);
985 uint32_t SDMMC_CmdSendCID(SDMMC_TypeDef *SDMMCx);
986 uint32_t SDMMC_CmdSendCSD(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
987 uint32_t SDMMC_CmdSetRelAdd(SDMMC_TypeDef *SDMMCx, uint16_t *pRCA);
988 uint32_t SDMMC_CmdSendStatus(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
989 uint32_t SDMMC_CmdStatusRegister(SDMMC_TypeDef *SDMMCx);
990 uint32_t SDMMC_CmdOpCondition(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
991 uint32_t SDMMC_CmdSwitch(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
992 
1009 #endif /* SDMMC1 */
1010 
1011 #ifdef __cplusplus
1012 }
1013 #endif
1014 
1015 #endif /* STM32F7xx_LL_SDMMC_H */
1016 
1017 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Init
napi_value Init(napi_env env, napi_value exports)
Definition: porcupine/demo/c/pvrecorder/node/pv_recorder_napi.c:197
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
Command
static FMC_SDRAM_CommandTypeDef Command
Definition: stm32f769i_discovery_sdram.c:125
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
SDMMC_TypeDef
SD host Interface.
Definition: stm32f769xx.h:889


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53