20#ifndef STM32H7xx_LL_SDMMC_H
21#define STM32H7xx_LL_SDMMC_H
65#if (USE_SD_TRANSCEIVER != 0U)
66 uint32_t TranceiverPresent;
131#define SDMMC_ERROR_NONE ((uint32_t)0x00000000U)
132#define SDMMC_ERROR_CMD_CRC_FAIL ((uint32_t)0x00000001U)
133#define SDMMC_ERROR_DATA_CRC_FAIL ((uint32_t)0x00000002U)
134#define SDMMC_ERROR_CMD_RSP_TIMEOUT ((uint32_t)0x00000004U)
135#define SDMMC_ERROR_DATA_TIMEOUT ((uint32_t)0x00000008U)
136#define SDMMC_ERROR_TX_UNDERRUN ((uint32_t)0x00000010U)
137#define SDMMC_ERROR_RX_OVERRUN ((uint32_t)0x00000020U)
138#define SDMMC_ERROR_ADDR_MISALIGNED ((uint32_t)0x00000040U)
139#define SDMMC_ERROR_BLOCK_LEN_ERR ((uint32_t)0x00000080U)
140#define SDMMC_ERROR_ERASE_SEQ_ERR ((uint32_t)0x00000100U)
141#define SDMMC_ERROR_BAD_ERASE_PARAM ((uint32_t)0x00000200U)
142#define SDMMC_ERROR_WRITE_PROT_VIOLATION ((uint32_t)0x00000400U)
143#define SDMMC_ERROR_LOCK_UNLOCK_FAILED ((uint32_t)0x00000800U)
144#define SDMMC_ERROR_COM_CRC_FAILED ((uint32_t)0x00001000U)
145#define SDMMC_ERROR_ILLEGAL_CMD ((uint32_t)0x00002000U)
146#define SDMMC_ERROR_CARD_ECC_FAILED ((uint32_t)0x00004000U)
147#define SDMMC_ERROR_CC_ERR ((uint32_t)0x00008000U)
148#define SDMMC_ERROR_GENERAL_UNKNOWN_ERR ((uint32_t)0x00010000U)
149#define SDMMC_ERROR_STREAM_READ_UNDERRUN ((uint32_t)0x00020000U)
150#define SDMMC_ERROR_STREAM_WRITE_OVERRUN ((uint32_t)0x00040000U)
151#define SDMMC_ERROR_CID_CSD_OVERWRITE ((uint32_t)0x00080000U)
152#define SDMMC_ERROR_WP_ERASE_SKIP ((uint32_t)0x00100000U)
153#define SDMMC_ERROR_CARD_ECC_DISABLED ((uint32_t)0x00200000U)
154#define SDMMC_ERROR_ERASE_RESET ((uint32_t)0x00400000U)
155#define SDMMC_ERROR_AKE_SEQ_ERR ((uint32_t)0x00800000U)
156#define SDMMC_ERROR_INVALID_VOLTRANGE ((uint32_t)0x01000000U)
157#define SDMMC_ERROR_ADDR_OUT_OF_RANGE ((uint32_t)0x02000000U)
158#define SDMMC_ERROR_REQUEST_NOT_APPLICABLE ((uint32_t)0x04000000U)
159#define SDMMC_ERROR_INVALID_PARAMETER ((uint32_t)0x08000000U)
160#define SDMMC_ERROR_UNSUPPORTED_FEATURE ((uint32_t)0x10000000U)
161#define SDMMC_ERROR_BUSY ((uint32_t)0x20000000U)
162#define SDMMC_ERROR_DMA ((uint32_t)0x40000000U)
163#define SDMMC_ERROR_TIMEOUT ((uint32_t)0x80000000U)
168#define SDMMC_CMD_GO_IDLE_STATE ((uint8_t)0U)
169#define SDMMC_CMD_SEND_OP_COND ((uint8_t)1U)
170#define SDMMC_CMD_ALL_SEND_CID ((uint8_t)2U)
171#define SDMMC_CMD_SET_REL_ADDR ((uint8_t)3U)
172#define SDMMC_CMD_SET_DSR ((uint8_t)4U)
173#define SDMMC_CMD_SDMMC_SEN_OP_COND ((uint8_t)5U)
174#define SDMMC_CMD_HS_SWITCH ((uint8_t)6U)
175#define SDMMC_CMD_SEL_DESEL_CARD ((uint8_t)7U)
176#define SDMMC_CMD_HS_SEND_EXT_CSD ((uint8_t)8U)
177#define SDMMC_CMD_SEND_CSD ((uint8_t)9U)
178#define SDMMC_CMD_SEND_CID ((uint8_t)10U)
179#define SDMMC_CMD_VOLTAGE_SWITCH ((uint8_t)11U)
180#define SDMMC_CMD_STOP_TRANSMISSION ((uint8_t)12U)
181#define SDMMC_CMD_SEND_STATUS ((uint8_t)13U)
182#define SDMMC_CMD_HS_BUSTEST_READ ((uint8_t)14U)
183#define SDMMC_CMD_GO_INACTIVE_STATE ((uint8_t)15U)
184#define SDMMC_CMD_SET_BLOCKLEN ((uint8_t)16U)
186#define SDMMC_CMD_READ_SINGLE_BLOCK ((uint8_t)17U)
187#define SDMMC_CMD_READ_MULT_BLOCK ((uint8_t)18U)
188#define SDMMC_CMD_HS_BUSTEST_WRITE ((uint8_t)19U)
189#define SDMMC_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20U)
190#define SDMMC_CMD_SET_BLOCK_COUNT ((uint8_t)23U)
191#define SDMMC_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24U)
192#define SDMMC_CMD_WRITE_MULT_BLOCK ((uint8_t)25U)
193#define SDMMC_CMD_PROG_CID ((uint8_t)26U)
194#define SDMMC_CMD_PROG_CSD ((uint8_t)27U)
195#define SDMMC_CMD_SET_WRITE_PROT ((uint8_t)28U)
196#define SDMMC_CMD_CLR_WRITE_PROT ((uint8_t)29U)
197#define SDMMC_CMD_SEND_WRITE_PROT ((uint8_t)30U)
198#define SDMMC_CMD_SD_ERASE_GRP_START ((uint8_t)32U)
199#define SDMMC_CMD_SD_ERASE_GRP_END ((uint8_t)33U)
200#define SDMMC_CMD_ERASE_GRP_START ((uint8_t)35U)
201#define SDMMC_CMD_ERASE_GRP_END ((uint8_t)36U)
202#define SDMMC_CMD_ERASE ((uint8_t)38U)
203#define SDMMC_CMD_FAST_IO ((uint8_t)39U)
204#define SDMMC_CMD_GO_IRQ_STATE ((uint8_t)40U)
205#define SDMMC_CMD_LOCK_UNLOCK ((uint8_t)42U)
206#define SDMMC_CMD_APP_CMD ((uint8_t)55U)
207#define SDMMC_CMD_GEN_CMD ((uint8_t)56U)
208#define SDMMC_CMD_NO_CMD ((uint8_t)64U)
214#define SDMMC_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6U)
215#define SDMMC_CMD_SD_APP_STATUS ((uint8_t)13U)
216#define SDMMC_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22U)
217#define SDMMC_CMD_SD_APP_OP_COND ((uint8_t)41U)
218#define SDMMC_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42U)
219#define SDMMC_CMD_SD_APP_SEND_SCR ((uint8_t)51U)
220#define SDMMC_CMD_SDMMC_RW_DIRECT ((uint8_t)52U)
221#define SDMMC_CMD_SDMMC_RW_EXTENDED ((uint8_t)53U)
226#define SDMMC_CMD_MMC_SLEEP_AWAKE ((uint8_t)5U)
232#define SDMMC_CMD_SD_APP_GET_MKB ((uint8_t)43U)
233#define SDMMC_CMD_SD_APP_GET_MID ((uint8_t)44U)
234#define SDMMC_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45U)
235#define SDMMC_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46U)
236#define SDMMC_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47U)
237#define SDMMC_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48U)
238#define SDMMC_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18U)
239#define SDMMC_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25U)
240#define SDMMC_CMD_SD_APP_SECURE_ERASE ((uint8_t)38U)
241#define SDMMC_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49U)
242#define SDMMC_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48U)
247#define SDMMC_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000U)
248#define SDMMC_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000U)
249#define SDMMC_OCR_BLOCK_LEN_ERR ((uint32_t)0x20000000U)
250#define SDMMC_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000U)
251#define SDMMC_OCR_BAD_ERASE_PARAM ((uint32_t)0x08000000U)
252#define SDMMC_OCR_WRITE_PROT_VIOLATION ((uint32_t)0x04000000U)
253#define SDMMC_OCR_LOCK_UNLOCK_FAILED ((uint32_t)0x01000000U)
254#define SDMMC_OCR_COM_CRC_FAILED ((uint32_t)0x00800000U)
255#define SDMMC_OCR_ILLEGAL_CMD ((uint32_t)0x00400000U)
256#define SDMMC_OCR_CARD_ECC_FAILED ((uint32_t)0x00200000U)
257#define SDMMC_OCR_CC_ERROR ((uint32_t)0x00100000U)
258#define SDMMC_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000U)
259#define SDMMC_OCR_STREAM_READ_UNDERRUN ((uint32_t)0x00040000U)
260#define SDMMC_OCR_STREAM_WRITE_OVERRUN ((uint32_t)0x00020000U)
261#define SDMMC_OCR_CID_CSD_OVERWRITE ((uint32_t)0x00010000U)
262#define SDMMC_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000U)
263#define SDMMC_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000U)
264#define SDMMC_OCR_ERASE_RESET ((uint32_t)0x00002000U)
265#define SDMMC_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008U)
266#define SDMMC_OCR_ERRORBITS ((uint32_t)0xFDFFE008U)
271#define SDMMC_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000U)
272#define SDMMC_R6_ILLEGAL_CMD ((uint32_t)0x00004000U)
273#define SDMMC_R6_COM_CRC_FAILED ((uint32_t)0x00008000U)
275#define SDMMC_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000U)
276#define SDMMC_HIGH_CAPACITY ((uint32_t)0x40000000U)
277#define SDMMC_STD_CAPACITY ((uint32_t)0x00000000U)
278#define SDMMC_CHECK_PATTERN ((uint32_t)0x000001AAU)
279#define SD_SWITCH_1_8V_CAPACITY ((uint32_t)0x01000000U)
280#define SDMMC_DDR50_SWITCH_PATTERN ((uint32_t)0x80FFFF04U)
281#define SDMMC_SDR104_SWITCH_PATTERN ((uint32_t)0x80FF1F03U)
282#define SDMMC_SDR50_SWITCH_PATTERN ((uint32_t)0x80FF1F02U)
283#define SDMMC_SDR25_SWITCH_PATTERN ((uint32_t)0x80FFFF01U)
284#define SDMMC_SDR12_SWITCH_PATTERN ((uint32_t)0x80FFFF00U)
286#define SDMMC_MAX_VOLT_TRIAL ((uint32_t)0x0000FFFFU)
288#define SDMMC_MAX_TRIAL ((uint32_t)0x0000FFFFU)
290#define SDMMC_ALLZERO ((uint32_t)0x00000000U)
292#define SDMMC_WIDE_BUS_SUPPORT ((uint32_t)0x00040000U)
293#define SDMMC_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000U)
294#define SDMMC_CARD_LOCKED ((uint32_t)0x02000000U)
296#ifndef SDMMC_DATATIMEOUT
297#define SDMMC_DATATIMEOUT ((uint32_t)0xFFFFFFFFU)
299#define SDMMC_0TO7BITS ((uint32_t)0x000000FFU)
300#define SDMMC_8TO15BITS ((uint32_t)0x0000FF00U)
301#define SDMMC_16TO23BITS ((uint32_t)0x00FF0000U)
302#define SDMMC_24TO31BITS ((uint32_t)0xFF000000U)
303#define SDMMC_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFFU)
305#define SDMMC_HALFFIFO ((uint32_t)0x00000008U)
306#define SDMMC_HALFFIFOBYTES ((uint32_t)0x00000020U)
311#define SDMMC_CCCC_ERASE ((uint32_t)0x00000020U)
313#define SDMMC_CMDTIMEOUT ((uint32_t)5000U)
314#define SDMMC_MAXERASETIMEOUT ((uint32_t)63000U)
315#define SDMMC_STOPTRANSFERTIMEOUT ((uint32_t)100000000U)
321#define SDMMC_CLOCK_EDGE_RISING ((uint32_t)0x00000000U)
322#define SDMMC_CLOCK_EDGE_FALLING SDMMC_CLKCR_NEGEDGE
324#define IS_SDMMC_CLOCK_EDGE(EDGE) (((EDGE) == SDMMC_CLOCK_EDGE_RISING) || \
325 ((EDGE) == SDMMC_CLOCK_EDGE_FALLING))
334#define SDMMC_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000U)
335#define SDMMC_CLOCK_POWER_SAVE_ENABLE SDMMC_CLKCR_PWRSAV
337#define IS_SDMMC_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDMMC_CLOCK_POWER_SAVE_DISABLE) || \
338 ((SAVE) == SDMMC_CLOCK_POWER_SAVE_ENABLE))
347#define SDMMC_BUS_WIDE_1B ((uint32_t)0x00000000U)
348#define SDMMC_BUS_WIDE_4B SDMMC_CLKCR_WIDBUS_0
349#define SDMMC_BUS_WIDE_8B SDMMC_CLKCR_WIDBUS_1
351#define IS_SDMMC_BUS_WIDE(WIDE) (((WIDE) == SDMMC_BUS_WIDE_1B) || \
352 ((WIDE) == SDMMC_BUS_WIDE_4B) || \
353 ((WIDE) == SDMMC_BUS_WIDE_8B))
362#define SDMMC_SPEED_MODE_AUTO ((uint32_t)0x00000000U)
363#define SDMMC_SPEED_MODE_DEFAULT ((uint32_t)0x00000001U)
364#define SDMMC_SPEED_MODE_HIGH ((uint32_t)0x00000002U)
365#define SDMMC_SPEED_MODE_ULTRA ((uint32_t)0x00000003U)
366#define SDMMC_SPEED_MODE_ULTRA_SDR104 SDMMC_SPEED_MODE_ULTRA
367#define SDMMC_SPEED_MODE_DDR ((uint32_t)0x00000004U)
368#define SDMMC_SPEED_MODE_ULTRA_SDR50 ((uint32_t)0x00000005U)
370#define IS_SDMMC_SPEED_MODE(MODE) (((MODE) == SDMMC_SPEED_MODE_AUTO) || \
371 ((MODE) == SDMMC_SPEED_MODE_DEFAULT) || \
372 ((MODE) == SDMMC_SPEED_MODE_HIGH) || \
373 ((MODE) == SDMMC_SPEED_MODE_ULTRA) || \
374 ((MODE) == SDMMC_SPEED_MODE_ULTRA_SDR50) || \
375 ((MODE) == SDMMC_SPEED_MODE_DDR))
385#define SDMMC_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000U)
386#define SDMMC_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_CLKCR_HWFC_EN
388#define IS_SDMMC_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_DISABLE) || \
389 ((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_ENABLE))
399#define IS_SDMMC_CLKDIV(DIV) ((DIV) < 0x400U)
408#define SDMMC_TRANSCEIVER_UNKNOWN ((uint32_t)0x00000000U)
409#define SDMMC_TRANSCEIVER_NOT_PRESENT ((uint32_t)0x00000001U)
410#define SDMMC_TRANSCEIVER_PRESENT ((uint32_t)0x00000002U)
420#define IS_SDMMC_CMD_INDEX(INDEX) ((INDEX) < 0x40U)
429#define SDMMC_RESPONSE_NO ((uint32_t)0x00000000U)
430#define SDMMC_RESPONSE_SHORT SDMMC_CMD_WAITRESP_0
431#define SDMMC_RESPONSE_LONG SDMMC_CMD_WAITRESP
433#define IS_SDMMC_RESPONSE(RESPONSE) (((RESPONSE) == SDMMC_RESPONSE_NO) || \
434 ((RESPONSE) == SDMMC_RESPONSE_SHORT) || \
435 ((RESPONSE) == SDMMC_RESPONSE_LONG))
444#define SDMMC_WAIT_NO ((uint32_t)0x00000000U)
445#define SDMMC_WAIT_IT SDMMC_CMD_WAITINT
446#define SDMMC_WAIT_PEND SDMMC_CMD_WAITPEND
448#define IS_SDMMC_WAIT(WAIT) (((WAIT) == SDMMC_WAIT_NO) || \
449 ((WAIT) == SDMMC_WAIT_IT) || \
450 ((WAIT) == SDMMC_WAIT_PEND))
459#define SDMMC_CPSM_DISABLE ((uint32_t)0x00000000U)
460#define SDMMC_CPSM_ENABLE SDMMC_CMD_CPSMEN
462#define IS_SDMMC_CPSM(CPSM) (((CPSM) == SDMMC_CPSM_DISABLE) || \
463 ((CPSM) == SDMMC_CPSM_ENABLE))
472#define SDMMC_RESP1 ((uint32_t)0x00000000U)
473#define SDMMC_RESP2 ((uint32_t)0x00000004U)
474#define SDMMC_RESP3 ((uint32_t)0x00000008U)
475#define SDMMC_RESP4 ((uint32_t)0x0000000CU)
477#define IS_SDMMC_RESP(RESP) (((RESP) == SDMMC_RESP1) || \
478 ((RESP) == SDMMC_RESP2) || \
479 ((RESP) == SDMMC_RESP3) || \
480 ((RESP) == SDMMC_RESP4))
486#define SDMMC_DISABLE_IDMA ((uint32_t)0x00000000)
487#define SDMMC_ENABLE_IDMA_SINGLE_BUFF (SDMMC_IDMA_IDMAEN)
488#define SDMMC_ENABLE_IDMA_DOUBLE_BUFF0 (SDMMC_IDMA_IDMAEN | SDMMC_IDMA_IDMABMODE)
489#define SDMMC_ENABLE_IDMA_DOUBLE_BUFF1 (SDMMC_IDMA_IDMAEN | SDMMC_IDMA_IDMABMODE | SDMMC_IDMA_IDMABACT)
499#define IS_SDMMC_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFFU)
508#define SDMMC_DATABLOCK_SIZE_1B ((uint32_t)0x00000000U)
509#define SDMMC_DATABLOCK_SIZE_2B SDMMC_DCTRL_DBLOCKSIZE_0
510#define SDMMC_DATABLOCK_SIZE_4B SDMMC_DCTRL_DBLOCKSIZE_1
511#define SDMMC_DATABLOCK_SIZE_8B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1)
512#define SDMMC_DATABLOCK_SIZE_16B SDMMC_DCTRL_DBLOCKSIZE_2
513#define SDMMC_DATABLOCK_SIZE_32B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2)
514#define SDMMC_DATABLOCK_SIZE_64B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
515#define SDMMC_DATABLOCK_SIZE_128B (SDMMC_DCTRL_DBLOCKSIZE_0| \
516 SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
517#define SDMMC_DATABLOCK_SIZE_256B SDMMC_DCTRL_DBLOCKSIZE_3
518#define SDMMC_DATABLOCK_SIZE_512B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_3)
519#define SDMMC_DATABLOCK_SIZE_1024B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
520#define SDMMC_DATABLOCK_SIZE_2048B (SDMMC_DCTRL_DBLOCKSIZE_0| \
521 SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
522#define SDMMC_DATABLOCK_SIZE_4096B (SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
523#define SDMMC_DATABLOCK_SIZE_8192B (SDMMC_DCTRL_DBLOCKSIZE_0| \
524 SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
525#define SDMMC_DATABLOCK_SIZE_16384B (SDMMC_DCTRL_DBLOCKSIZE_1| \
526 SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
528#define IS_SDMMC_BLOCK_SIZE(SIZE) (((SIZE) == SDMMC_DATABLOCK_SIZE_1B) || \
529 ((SIZE) == SDMMC_DATABLOCK_SIZE_2B) || \
530 ((SIZE) == SDMMC_DATABLOCK_SIZE_4B) || \
531 ((SIZE) == SDMMC_DATABLOCK_SIZE_8B) || \
532 ((SIZE) == SDMMC_DATABLOCK_SIZE_16B) || \
533 ((SIZE) == SDMMC_DATABLOCK_SIZE_32B) || \
534 ((SIZE) == SDMMC_DATABLOCK_SIZE_64B) || \
535 ((SIZE) == SDMMC_DATABLOCK_SIZE_128B) || \
536 ((SIZE) == SDMMC_DATABLOCK_SIZE_256B) || \
537 ((SIZE) == SDMMC_DATABLOCK_SIZE_512B) || \
538 ((SIZE) == SDMMC_DATABLOCK_SIZE_1024B) || \
539 ((SIZE) == SDMMC_DATABLOCK_SIZE_2048B) || \
540 ((SIZE) == SDMMC_DATABLOCK_SIZE_4096B) || \
541 ((SIZE) == SDMMC_DATABLOCK_SIZE_8192B) || \
542 ((SIZE) == SDMMC_DATABLOCK_SIZE_16384B))
551#define SDMMC_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000U)
552#define SDMMC_TRANSFER_DIR_TO_SDMMC SDMMC_DCTRL_DTDIR
554#define IS_SDMMC_TRANSFER_DIR(DIR) (((DIR) == SDMMC_TRANSFER_DIR_TO_CARD) || \
555 ((DIR) == SDMMC_TRANSFER_DIR_TO_SDMMC))
564#define SDMMC_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000U)
565#define SDMMC_TRANSFER_MODE_STREAM SDMMC_DCTRL_DTMODE_1
567#define IS_SDMMC_TRANSFER_MODE(MODE) (((MODE) == SDMMC_TRANSFER_MODE_BLOCK) || \
568 ((MODE) == SDMMC_TRANSFER_MODE_STREAM))
577#define SDMMC_DPSM_DISABLE ((uint32_t)0x00000000U)
578#define SDMMC_DPSM_ENABLE SDMMC_DCTRL_DTEN
580#define IS_SDMMC_DPSM(DPSM) (((DPSM) == SDMMC_DPSM_DISABLE) ||\
581 ((DPSM) == SDMMC_DPSM_ENABLE))
590#define SDMMC_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000U)
591#define SDMMC_READ_WAIT_MODE_CLK (SDMMC_DCTRL_RWMOD)
593#define IS_SDMMC_READWAIT_MODE(MODE) (((MODE) == SDMMC_READ_WAIT_MODE_CLK) || \
594 ((MODE) == SDMMC_READ_WAIT_MODE_DATA2))
603#define SDMMC_IT_CCRCFAIL SDMMC_MASK_CCRCFAILIE
604#define SDMMC_IT_DCRCFAIL SDMMC_MASK_DCRCFAILIE
605#define SDMMC_IT_CTIMEOUT SDMMC_MASK_CTIMEOUTIE
606#define SDMMC_IT_DTIMEOUT SDMMC_MASK_DTIMEOUTIE
607#define SDMMC_IT_TXUNDERR SDMMC_MASK_TXUNDERRIE
608#define SDMMC_IT_RXOVERR SDMMC_MASK_RXOVERRIE
609#define SDMMC_IT_CMDREND SDMMC_MASK_CMDRENDIE
610#define SDMMC_IT_CMDSENT SDMMC_MASK_CMDSENTIE
611#define SDMMC_IT_DATAEND SDMMC_MASK_DATAENDIE
612#define SDMMC_IT_DHOLD SDMMC_MASK_DHOLDIE
613#define SDMMC_IT_DBCKEND SDMMC_MASK_DBCKENDIE
614#define SDMMC_IT_DABORT SDMMC_MASK_DABORTIE
615#define SDMMC_IT_TXFIFOHE SDMMC_MASK_TXFIFOHEIE
616#define SDMMC_IT_RXFIFOHF SDMMC_MASK_RXFIFOHFIE
617#define SDMMC_IT_RXFIFOF SDMMC_MASK_RXFIFOFIE
618#define SDMMC_IT_TXFIFOE SDMMC_MASK_TXFIFOEIE
619#define SDMMC_IT_BUSYD0END SDMMC_MASK_BUSYD0ENDIE
620#define SDMMC_IT_SDIOIT SDMMC_MASK_SDIOITIE
621#define SDMMC_IT_ACKFAIL SDMMC_MASK_ACKFAILIE
622#define SDMMC_IT_ACKTIMEOUT SDMMC_MASK_ACKTIMEOUTIE
623#define SDMMC_IT_VSWEND SDMMC_MASK_VSWENDIE
624#define SDMMC_IT_CKSTOP SDMMC_MASK_CKSTOPIE
625#define SDMMC_IT_IDMABTC SDMMC_MASK_IDMABTCIE
634#define SDMMC_FLAG_CCRCFAIL SDMMC_STA_CCRCFAIL
635#define SDMMC_FLAG_DCRCFAIL SDMMC_STA_DCRCFAIL
636#define SDMMC_FLAG_CTIMEOUT SDMMC_STA_CTIMEOUT
637#define SDMMC_FLAG_DTIMEOUT SDMMC_STA_DTIMEOUT
638#define SDMMC_FLAG_TXUNDERR SDMMC_STA_TXUNDERR
639#define SDMMC_FLAG_RXOVERR SDMMC_STA_RXOVERR
640#define SDMMC_FLAG_CMDREND SDMMC_STA_CMDREND
641#define SDMMC_FLAG_CMDSENT SDMMC_STA_CMDSENT
642#define SDMMC_FLAG_DATAEND SDMMC_STA_DATAEND
643#define SDMMC_FLAG_DHOLD SDMMC_STA_DHOLD
644#define SDMMC_FLAG_DBCKEND SDMMC_STA_DBCKEND
645#define SDMMC_FLAG_DABORT SDMMC_STA_DABORT
646#define SDMMC_FLAG_DPSMACT SDMMC_STA_DPSMACT
647#define SDMMC_FLAG_CMDACT SDMMC_STA_CPSMACT
648#define SDMMC_FLAG_TXFIFOHE SDMMC_STA_TXFIFOHE
649#define SDMMC_FLAG_RXFIFOHF SDMMC_STA_RXFIFOHF
650#define SDMMC_FLAG_TXFIFOF SDMMC_STA_TXFIFOF
651#define SDMMC_FLAG_RXFIFOF SDMMC_STA_RXFIFOF
652#define SDMMC_FLAG_TXFIFOE SDMMC_STA_TXFIFOE
653#define SDMMC_FLAG_RXFIFOE SDMMC_STA_RXFIFOE
654#define SDMMC_FLAG_BUSYD0 SDMMC_STA_BUSYD0
655#define SDMMC_FLAG_BUSYD0END SDMMC_STA_BUSYD0END
656#define SDMMC_FLAG_SDIOIT SDMMC_STA_SDIOIT
657#define SDMMC_FLAG_ACKFAIL SDMMC_STA_ACKFAIL
658#define SDMMC_FLAG_ACKTIMEOUT SDMMC_STA_ACKTIMEOUT
659#define SDMMC_FLAG_VSWEND SDMMC_STA_VSWEND
660#define SDMMC_FLAG_CKSTOP SDMMC_STA_CKSTOP
661#define SDMMC_FLAG_IDMATE SDMMC_STA_IDMATE
662#define SDMMC_FLAG_IDMABTC SDMMC_STA_IDMABTC
664#define SDMMC_STATIC_FLAGS ((uint32_t)(SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_CTIMEOUT |\
665 SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_TXUNDERR | SDMMC_FLAG_RXOVERR |\
666 SDMMC_FLAG_CMDREND | SDMMC_FLAG_CMDSENT | SDMMC_FLAG_DATAEND |\
667 SDMMC_FLAG_DHOLD | SDMMC_FLAG_DBCKEND | SDMMC_FLAG_DABORT |\
668 SDMMC_FLAG_BUSYD0END | SDMMC_FLAG_SDIOIT | SDMMC_FLAG_ACKFAIL |\
669 SDMMC_FLAG_ACKTIMEOUT | SDMMC_FLAG_VSWEND | SDMMC_FLAG_CKSTOP |\
670 SDMMC_FLAG_IDMATE | SDMMC_FLAG_IDMABTC))
672#define SDMMC_STATIC_CMD_FLAGS ((uint32_t)(SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_CTIMEOUT | SDMMC_FLAG_CMDREND |\
673 SDMMC_FLAG_CMDSENT | SDMMC_FLAG_BUSYD0END))
675#define SDMMC_STATIC_DATA_FLAGS ((uint32_t)(SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_TXUNDERR |\
676 SDMMC_FLAG_RXOVERR | SDMMC_FLAG_DATAEND | SDMMC_FLAG_DHOLD |\
677 SDMMC_FLAG_DBCKEND | SDMMC_FLAG_DABORT | SDMMC_FLAG_IDMATE |\
701#define CLKCR_CLEAR_MASK ((uint32_t)(SDMMC_CLKCR_CLKDIV | SDMMC_CLKCR_PWRSAV |\
702 SDMMC_CLKCR_WIDBUS |\
703 SDMMC_CLKCR_NEGEDGE | SDMMC_CLKCR_HWFC_EN |\
704 SDMMC_CLKCR_DDR | SDMMC_CLKCR_BUSSPEED |\
705 SDMMC_CLKCR_SELCLKRX))
709#define DCTRL_CLEAR_MASK ((uint32_t)(SDMMC_DCTRL_DTEN | SDMMC_DCTRL_DTDIR |\
710 SDMMC_DCTRL_DTMODE | SDMMC_DCTRL_DBLOCKSIZE))
714#define CMD_CLEAR_MASK ((uint32_t)(SDMMC_CMD_CMDINDEX | SDMMC_CMD_WAITRESP |\
715 SDMMC_CMD_WAITINT | SDMMC_CMD_WAITPEND |\
716 SDMMC_CMD_CPSMEN | SDMMC_CMD_CMDSUSPEND))
719#define SDMMC_INIT_CLK_DIV ((uint8_t)0xFA)
722#define SDMMC_NSPEED_CLK_DIV ((uint8_t)0x4)
725#define SDMMC_HSPEED_CLK_DIV ((uint8_t)0x2)
766#define __SDMMC_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
798#define __SDMMC_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
836#define __SDMMC_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != 0U)
866#define __SDMMC_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
898#define __SDMMC_GET_IT(__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
926#define __SDMMC_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
933#define __SDMMC_START_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTART)
940#define __SDMMC_START_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTART)
947#define __SDMMC_STOP_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTOP)
954#define __SDMMC_STOP_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTOP)
961#define __SDMMC_OPERATION_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_SDIOEN)
968#define __SDMMC_OPERATION_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_SDIOEN)
975#define __SDMMC_SUSPEND_CMD_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_CMDSUSPEND)
982#define __SDMMC_SUSPEND_CMD_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_CMDSUSPEND)
989#define __SDMMC_CMDTRANS_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_CMDTRANS)
996#define __SDMMC_CMDTRANS_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_CMDTRANS)
1003#define __SDMMC_CMDSTOP_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_CMDSTOP)
1010#define __SDMMC_CMDSTOP_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_CMDSTOP)
1056uint32_t SDMMC_GetResponse(
SDMMC_TypeDef *SDMMCx, uint32_t Response);
1073uint32_t SDMMC_CmdBlockLength(
SDMMC_TypeDef *SDMMCx, uint32_t BlockSize);
1074uint32_t SDMMC_CmdReadSingleBlock(
SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
1075uint32_t SDMMC_CmdReadMultiBlock(
SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
1076uint32_t SDMMC_CmdWriteSingleBlock(
SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
1077uint32_t SDMMC_CmdWriteMultiBlock(
SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
1078uint32_t SDMMC_CmdEraseStartAdd(
SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
1079uint32_t SDMMC_CmdSDEraseStartAdd(
SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
1080uint32_t SDMMC_CmdEraseEndAdd(
SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
1081uint32_t SDMMC_CmdSDEraseEndAdd(
SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
1082uint32_t SDMMC_CmdErase(
SDMMC_TypeDef *SDMMCx, uint32_t EraseType);
1084uint32_t SDMMC_CmdSelDesel(
SDMMC_TypeDef *SDMMCx, uint32_t Addr);
1087uint32_t SDMMC_CmdAppCommand(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1088uint32_t SDMMC_CmdAppOperCommand(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1089uint32_t SDMMC_CmdBusWidth(
SDMMC_TypeDef *SDMMCx, uint32_t BusWidth);
1092uint32_t SDMMC_CmdSendCSD(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1093uint32_t SDMMC_CmdSetRelAdd(
SDMMC_TypeDef *SDMMCx, uint16_t *pRCA);
1094uint32_t SDMMC_CmdSetRelAddMmc(
SDMMC_TypeDef *SDMMCx, uint16_t RCA);
1095uint32_t SDMMC_CmdSleepMmc(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1096uint32_t SDMMC_CmdSendStatus(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1099uint32_t SDMMC_CmdOpCondition(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1100uint32_t SDMMC_CmdSwitch(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1101uint32_t SDMMC_CmdSendEXTCSD(
SDMMC_TypeDef *SDMMCx, uint32_t Argument);
1110uint32_t SDMMC_GetCmdResp1(
SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint32_t Timeout);
1113uint32_t SDMMC_GetCmdResp6(
SDMMC_TypeDef *SDMMCx, uint8_t SD_CMD, uint16_t *pRCA);
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
SDMMC Command Control structure.
Definition: stm32h7xx_ll_sdmmc.h:76
uint32_t CPSM
Definition: stm32h7xx_ll_sdmmc.h:92
uint32_t CmdIndex
Definition: stm32h7xx_ll_sdmmc.h:82
uint32_t Argument
Definition: stm32h7xx_ll_sdmmc.h:77
uint32_t WaitForInterrupt
Definition: stm32h7xx_ll_sdmmc.h:88
uint32_t Response
Definition: stm32h7xx_ll_sdmmc.h:85
SDMMC Data Control structure.
Definition: stm32h7xx_ll_sdmmc.h:102
uint32_t DPSM
Definition: stm32h7xx_ll_sdmmc.h:117
uint32_t TransferDir
Definition: stm32h7xx_ll_sdmmc.h:110
uint32_t DataTimeOut
Definition: stm32h7xx_ll_sdmmc.h:103
uint32_t DataBlockSize
Definition: stm32h7xx_ll_sdmmc.h:107
uint32_t TransferMode
Definition: stm32h7xx_ll_sdmmc.h:114
uint32_t DataLength
Definition: stm32h7xx_ll_sdmmc.h:105
SDMMC Configuration Structure definition.
Definition: stm32h7xx_ll_sdmmc.h:48
uint32_t BusWide
Definition: stm32h7xx_ll_sdmmc.h:56
uint32_t ClockPowerSave
Definition: stm32h7xx_ll_sdmmc.h:52
uint32_t ClockDiv
Definition: stm32h7xx_ll_sdmmc.h:62
uint32_t ClockEdge
Definition: stm32h7xx_ll_sdmmc.h:49
uint32_t HardwareFlowControl
Definition: stm32h7xx_ll_sdmmc.h:59
Secure digital input/output Interface.
Definition: stm32h723xx.h:1408