stm32f1xx_ll_sdmmc.h 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_sdmmc.h
  4. * @author MCD Application Team
  5. * @brief Header file of SDMMC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32F1xx_LL_SDMMC_H
  20. #define STM32F1xx_LL_SDMMC_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if defined(SDIO)
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f1xx_hal_def.h"
  27. /** @addtogroup STM32F1xx_Driver
  28. * @{
  29. */
  30. /** @addtogroup SDMMC_LL
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief SDMMC Configuration Structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made.
  43. This parameter can be a value of @ref SDMMC_LL_Clock_Edge */
  44. uint32_t ClockBypass; /*!< Specifies whether the SDMMC Clock divider bypass is
  45. enabled or disabled.
  46. This parameter can be a value of @ref SDMMC_LL_Clock_Bypass */
  47. uint32_t ClockPowerSave; /*!< Specifies whether SDMMC Clock output is enabled or
  48. disabled when the bus is idle.
  49. This parameter can be a value of @ref SDMMC_LL_Clock_Power_Save */
  50. uint32_t BusWide; /*!< Specifies the SDMMC bus width.
  51. This parameter can be a value of @ref SDMMC_LL_Bus_Wide */
  52. uint32_t HardwareFlowControl; /*!< Specifies whether the SDMMC hardware flow control is enabled or disabled.
  53. This parameter can be a value of @ref SDMMC_LL_Hardware_Flow_Control */
  54. uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDMMC controller.
  55. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  56. }SDIO_InitTypeDef;
  57. /**
  58. * @brief SDMMC Command Control structure
  59. */
  60. typedef struct
  61. {
  62. uint32_t Argument; /*!< Specifies the SDMMC command argument which is sent
  63. to a card as part of a command message. If a command
  64. contains an argument, it must be loaded into this register
  65. before writing the command to the command register. */
  66. uint32_t CmdIndex; /*!< Specifies the SDMMC command index. It must be Min_Data = 0 and
  67. Max_Data = 64 */
  68. uint32_t Response; /*!< Specifies the SDMMC response type.
  69. This parameter can be a value of @ref SDMMC_LL_Response_Type */
  70. uint32_t WaitForInterrupt; /*!< Specifies whether SDMMC wait for interrupt request is
  71. enabled or disabled.
  72. This parameter can be a value of @ref SDMMC_LL_Wait_Interrupt_State */
  73. uint32_t CPSM; /*!< Specifies whether SDMMC Command path state machine (CPSM)
  74. is enabled or disabled.
  75. This parameter can be a value of @ref SDMMC_LL_CPSM_State */
  76. }SDIO_CmdInitTypeDef;
  77. /**
  78. * @brief SDMMC Data Control structure
  79. */
  80. typedef struct
  81. {
  82. uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
  83. uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */
  84. uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer.
  85. This parameter can be a value of @ref SDMMC_LL_Data_Block_Size */
  86. uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer
  87. is a read or write.
  88. This parameter can be a value of @ref SDMMC_LL_Transfer_Direction */
  89. uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
  90. This parameter can be a value of @ref SDMMC_LL_Transfer_Type */
  91. uint32_t DPSM; /*!< Specifies whether SDMMC Data path state machine (DPSM)
  92. is enabled or disabled.
  93. This parameter can be a value of @ref SDMMC_LL_DPSM_State */
  94. }SDIO_DataInitTypeDef;
  95. /**
  96. * @}
  97. */
  98. /* Exported constants --------------------------------------------------------*/
  99. /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants
  100. * @{
  101. */
  102. #define SDMMC_ERROR_NONE 0x00000000U /*!< No error */
  103. #define SDMMC_ERROR_CMD_CRC_FAIL 0x00000001U /*!< Command response received (but CRC check failed) */
  104. #define SDMMC_ERROR_DATA_CRC_FAIL 0x00000002U /*!< Data block sent/received (CRC check failed) */
  105. #define SDMMC_ERROR_CMD_RSP_TIMEOUT 0x00000004U /*!< Command response timeout */
  106. #define SDMMC_ERROR_DATA_TIMEOUT 0x00000008U /*!< Data timeout */
  107. #define SDMMC_ERROR_TX_UNDERRUN 0x00000010U /*!< Transmit FIFO underrun */
  108. #define SDMMC_ERROR_RX_OVERRUN 0x00000020U /*!< Receive FIFO overrun */
  109. #define SDMMC_ERROR_ADDR_MISALIGNED 0x00000040U /*!< Misaligned address */
  110. #define SDMMC_ERROR_BLOCK_LEN_ERR 0x00000080U /*!< Transferred block length is not allowed for the card or the
  111. number of transferred bytes does not match the block length */
  112. #define SDMMC_ERROR_ERASE_SEQ_ERR 0x00000100U /*!< An error in the sequence of erase command occurs */
  113. #define SDMMC_ERROR_BAD_ERASE_PARAM 0x00000200U /*!< An invalid selection for erase groups */
  114. #define SDMMC_ERROR_WRITE_PROT_VIOLATION 0x00000400U /*!< Attempt to program a write protect block */
  115. #define SDMMC_ERROR_LOCK_UNLOCK_FAILED 0x00000800U /*!< Sequence or password error has been detected in unlock
  116. command or if there was an attempt to access a locked card */
  117. #define SDMMC_ERROR_COM_CRC_FAILED 0x00001000U /*!< CRC check of the previous command failed */
  118. #define SDMMC_ERROR_ILLEGAL_CMD 0x00002000U /*!< Command is not legal for the card state */
  119. #define SDMMC_ERROR_CARD_ECC_FAILED 0x00004000U /*!< Card internal ECC was applied but failed to correct the data */
  120. #define SDMMC_ERROR_CC_ERR 0x00008000U /*!< Internal card controller error */
  121. #define SDMMC_ERROR_GENERAL_UNKNOWN_ERR 0x00010000U /*!< General or unknown error */
  122. #define SDMMC_ERROR_STREAM_READ_UNDERRUN 0x00020000U /*!< The card could not sustain data reading in stream rmode */
  123. #define SDMMC_ERROR_STREAM_WRITE_OVERRUN 0x00040000U /*!< The card could not sustain data programming in stream mode */
  124. #define SDMMC_ERROR_CID_CSD_OVERWRITE 0x00080000U /*!< CID/CSD overwrite error */
  125. #define SDMMC_ERROR_WP_ERASE_SKIP 0x00100000U /*!< Only partial address space was erased */
  126. #define SDMMC_ERROR_CARD_ECC_DISABLED 0x00200000U /*!< Command has been executed without using internal ECC */
  127. #define SDMMC_ERROR_ERASE_RESET 0x00400000U /*!< Erase sequence was cleared before executing because an out
  128. of erase sequence command was received */
  129. #define SDMMC_ERROR_AKE_SEQ_ERR 0x00800000U /*!< Error in sequence of authentication */
  130. #define SDMMC_ERROR_INVALID_VOLTRANGE 0x01000000U /*!< Error in case of invalid voltage range */
  131. #define SDMMC_ERROR_ADDR_OUT_OF_RANGE 0x02000000U /*!< Error when addressed block is out of range */
  132. #define SDMMC_ERROR_REQUEST_NOT_APPLICABLE 0x04000000U /*!< Error when command request is not applicable */
  133. #define SDMMC_ERROR_INVALID_PARAMETER 0x08000000U /*!< the used parameter is not valid */
  134. #define SDMMC_ERROR_UNSUPPORTED_FEATURE 0x10000000U /*!< Error when feature is not insupported */
  135. #define SDMMC_ERROR_BUSY 0x20000000U /*!< Error when transfer process is busy */
  136. #define SDMMC_ERROR_DMA 0x40000000U /*!< Error while DMA transfer */
  137. #define SDMMC_ERROR_TIMEOUT 0x80000000U /*!< Timeout error */
  138. /**
  139. * @brief SDMMC Commands Index
  140. */
  141. #define SDMMC_CMD_GO_IDLE_STATE 0U /*!< Resets the SD memory card. */
  142. #define SDMMC_CMD_SEND_OP_COND 1U /*!< Sends host capacity support information and activates the card's initialization process. */
  143. #define SDMMC_CMD_ALL_SEND_CID 2U /*!< Asks any card connected to the host to send the CID numbers on the CMD line. */
  144. #define SDMMC_CMD_SET_REL_ADDR 3U /*!< Asks the card to publish a new relative address (RCA). */
  145. #define SDMMC_CMD_SET_DSR 4U /*!< Programs the DSR of all cards. */
  146. #define SDMMC_CMD_SDMMC_SEN_OP_COND 5U /*!< Sends host capacity support information (HCS) and asks the accessed card to send its
  147. operating condition register (OCR) content in the response on the CMD line. */
  148. #define SDMMC_CMD_HS_SWITCH 6U /*!< Checks switchable function (mode 0) and switch card function (mode 1). */
  149. #define SDMMC_CMD_SEL_DESEL_CARD 7U /*!< Selects the card by its own relative address and gets deselected by any other address */
  150. #define SDMMC_CMD_HS_SEND_EXT_CSD 8U /*!< Sends SD Memory Card interface condition, which includes host supply voltage information
  151. and asks the card whether card supports voltage. */
  152. #define SDMMC_CMD_SEND_CSD 9U /*!< Addressed card sends its card specific data (CSD) on the CMD line. */
  153. #define SDMMC_CMD_SEND_CID 10U /*!< Addressed card sends its card identification (CID) on the CMD line. */
  154. #define SDMMC_CMD_READ_DAT_UNTIL_STOP 11U /*!< SD card doesn't support it. */
  155. #define SDMMC_CMD_STOP_TRANSMISSION 12U /*!< Forces the card to stop transmission. */
  156. #define SDMMC_CMD_SEND_STATUS 13U /*!< Addressed card sends its status register. */
  157. #define SDMMC_CMD_HS_BUSTEST_READ 14U /*!< Reserved */
  158. #define SDMMC_CMD_GO_INACTIVE_STATE 15U /*!< Sends an addressed card into the inactive state. */
  159. #define SDMMC_CMD_SET_BLOCKLEN 16U /*!< Sets the block length (in bytes for SDSC) for all following block commands
  160. (read, write, lock). Default block length is fixed to 512 Bytes. Not effective
  161. for SDHS and SDXC. */
  162. #define SDMMC_CMD_READ_SINGLE_BLOCK 17U /*!< Reads single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of
  163. fixed 512 bytes in case of SDHC and SDXC. */
  164. #define SDMMC_CMD_READ_MULT_BLOCK 18U /*!< Continuously transfers data blocks from card to host until interrupted by
  165. STOP_TRANSMISSION command. */
  166. #define SDMMC_CMD_HS_BUSTEST_WRITE 19U /*!< 64 bytes tuning pattern is sent for SDR50 and SDR104. */
  167. #define SDMMC_CMD_WRITE_DAT_UNTIL_STOP 20U /*!< Speed class control command. */
  168. #define SDMMC_CMD_SET_BLOCK_COUNT 23U /*!< Specify block count for CMD18 and CMD25. */
  169. #define SDMMC_CMD_WRITE_SINGLE_BLOCK 24U /*!< Writes single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of
  170. fixed 512 bytes in case of SDHC and SDXC. */
  171. #define SDMMC_CMD_WRITE_MULT_BLOCK 25U /*!< Continuously writes blocks of data until a STOP_TRANSMISSION follows. */
  172. #define SDMMC_CMD_PROG_CID 26U /*!< Reserved for manufacturers. */
  173. #define SDMMC_CMD_PROG_CSD 27U /*!< Programming of the programmable bits of the CSD. */
  174. #define SDMMC_CMD_SET_WRITE_PROT 28U /*!< Sets the write protection bit of the addressed group. */
  175. #define SDMMC_CMD_CLR_WRITE_PROT 29U /*!< Clears the write protection bit of the addressed group. */
  176. #define SDMMC_CMD_SEND_WRITE_PROT 30U /*!< Asks the card to send the status of the write protection bits. */
  177. #define SDMMC_CMD_SD_ERASE_GRP_START 32U /*!< Sets the address of the first write block to be erased. (For SD card only). */
  178. #define SDMMC_CMD_SD_ERASE_GRP_END 33U /*!< Sets the address of the last write block of the continuous range to be erased. */
  179. #define SDMMC_CMD_ERASE_GRP_START 35U /*!< Sets the address of the first write block to be erased. Reserved for each command
  180. system set by switch function command (CMD6). */
  181. #define SDMMC_CMD_ERASE_GRP_END 36U /*!< Sets the address of the last write block of the continuous range to be erased.
  182. Reserved for each command system set by switch function command (CMD6). */
  183. #define SDMMC_CMD_ERASE 38U /*!< Reserved for SD security applications. */
  184. #define SDMMC_CMD_FAST_IO 39U /*!< SD card doesn't support it (Reserved). */
  185. #define SDMMC_CMD_GO_IRQ_STATE 40U /*!< SD card doesn't support it (Reserved). */
  186. #define SDMMC_CMD_LOCK_UNLOCK 42U /*!< Sets/resets the password or lock/unlock the card. The size of the data block is set by
  187. the SET_BLOCK_LEN command. */
  188. #define SDMMC_CMD_APP_CMD 55U /*!< Indicates to the card that the next command is an application specific command rather
  189. than a standard command. */
  190. #define SDMMC_CMD_GEN_CMD 56U /*!< Used either to transfer a data block to the card or to get a data block from the card
  191. for general purpose/application specific commands. */
  192. #define SDMMC_CMD_NO_CMD 64U /*!< No command */
  193. /**
  194. * @brief Following commands are SD Card Specific commands.
  195. * SDMMC_APP_CMD should be sent before sending these commands.
  196. */
  197. #define SDMMC_CMD_APP_SD_SET_BUSWIDTH 6U /*!< (ACMD6) Defines the data bus width to be used for data transfer. The allowed data bus
  198. widths are given in SCR register. */
  199. #define SDMMC_CMD_SD_APP_STATUS 13U /*!< (ACMD13) Sends the SD status. */
  200. #define SDMMC_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS 22U /*!< (ACMD22) Sends the number of the written (without errors) write blocks. Responds with
  201. 32bit+CRC data block. */
  202. #define SDMMC_CMD_SD_APP_OP_COND 41U /*!< (ACMD41) Sends host capacity support information (HCS) and asks the accessed card to
  203. send its operating condition register (OCR) content in the response on the CMD line. */
  204. #define SDMMC_CMD_SD_APP_SET_CLR_CARD_DETECT 42U /*!< (ACMD42) Connect/Disconnect the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card */
  205. #define SDMMC_CMD_SD_APP_SEND_SCR 51U /*!< Reads the SD Configuration Register (SCR). */
  206. #define SDMMC_CMD_SDMMC_RW_DIRECT 52U /*!< For SD I/O card only, reserved for security specification. */
  207. #define SDMMC_CMD_SDMMC_RW_EXTENDED 53U /*!< For SD I/O card only, reserved for security specification. */
  208. /**
  209. * @brief Following commands are SD Card Specific security commands.
  210. * SDMMC_CMD_APP_CMD should be sent before sending these commands.
  211. */
  212. #define SDMMC_CMD_SD_APP_GET_MKB 43U
  213. #define SDMMC_CMD_SD_APP_GET_MID 44U
  214. #define SDMMC_CMD_SD_APP_SET_CER_RN1 45U
  215. #define SDMMC_CMD_SD_APP_GET_CER_RN2 46U
  216. #define SDMMC_CMD_SD_APP_SET_CER_RES2 47U
  217. #define SDMMC_CMD_SD_APP_GET_CER_RES1 48U
  218. #define SDMMC_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK 18U
  219. #define SDMMC_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK 25U
  220. #define SDMMC_CMD_SD_APP_SECURE_ERASE 38U
  221. #define SDMMC_CMD_SD_APP_CHANGE_SECURE_AREA 49U
  222. #define SDMMC_CMD_SD_APP_SECURE_WRITE_MKB 48U
  223. /**
  224. * @brief Masks for errors Card Status R1 (OCR Register)
  225. */
  226. #define SDMMC_OCR_ADDR_OUT_OF_RANGE 0x80000000U
  227. #define SDMMC_OCR_ADDR_MISALIGNED 0x40000000U
  228. #define SDMMC_OCR_BLOCK_LEN_ERR 0x20000000U
  229. #define SDMMC_OCR_ERASE_SEQ_ERR 0x10000000U
  230. #define SDMMC_OCR_BAD_ERASE_PARAM 0x08000000U
  231. #define SDMMC_OCR_WRITE_PROT_VIOLATION 0x04000000U
  232. #define SDMMC_OCR_LOCK_UNLOCK_FAILED 0x01000000U
  233. #define SDMMC_OCR_COM_CRC_FAILED 0x00800000U
  234. #define SDMMC_OCR_ILLEGAL_CMD 0x00400000U
  235. #define SDMMC_OCR_CARD_ECC_FAILED 0x00200000U
  236. #define SDMMC_OCR_CC_ERROR 0x00100000U
  237. #define SDMMC_OCR_GENERAL_UNKNOWN_ERROR 0x00080000U
  238. #define SDMMC_OCR_STREAM_READ_UNDERRUN 0x00040000U
  239. #define SDMMC_OCR_STREAM_WRITE_OVERRUN 0x00020000U
  240. #define SDMMC_OCR_CID_CSD_OVERWRITE 0x00010000U
  241. #define SDMMC_OCR_WP_ERASE_SKIP 0x00008000U
  242. #define SDMMC_OCR_CARD_ECC_DISABLED 0x00004000U
  243. #define SDMMC_OCR_ERASE_RESET 0x00002000U
  244. #define SDMMC_OCR_AKE_SEQ_ERROR 0x00000008U
  245. #define SDMMC_OCR_ERRORBITS 0xFDFFE008U
  246. /**
  247. * @brief Masks for R6 Response
  248. */
  249. #define SDMMC_R6_GENERAL_UNKNOWN_ERROR 0x00002000U
  250. #define SDMMC_R6_ILLEGAL_CMD 0x00004000U
  251. #define SDMMC_R6_COM_CRC_FAILED 0x00008000U
  252. #define SDMMC_VOLTAGE_WINDOW_SD 0x80100000U
  253. #define SDMMC_HIGH_CAPACITY 0x40000000U
  254. #define SDMMC_STD_CAPACITY 0x00000000U
  255. #define SDMMC_CHECK_PATTERN 0x000001AAU
  256. #define SD_SWITCH_1_8V_CAPACITY 0x01000000U
  257. #define SDMMC_MAX_VOLT_TRIAL 0x0000FFFFU
  258. #define SDMMC_MAX_TRIAL 0x0000FFFFU
  259. #define SDMMC_ALLZERO 0x00000000U
  260. #define SDMMC_WIDE_BUS_SUPPORT 0x00040000U
  261. #define SDMMC_SINGLE_BUS_SUPPORT 0x00010000U
  262. #define SDMMC_CARD_LOCKED 0x02000000U
  263. #ifndef SDMMC_DATATIMEOUT
  264. #define SDMMC_DATATIMEOUT 0xFFFFFFFFU
  265. #endif /* SDMMC_DATATIMEOUT */
  266. #define SDMMC_0TO7BITS 0x000000FFU
  267. #define SDMMC_8TO15BITS 0x0000FF00U
  268. #define SDMMC_16TO23BITS 0x00FF0000U
  269. #define SDMMC_24TO31BITS 0xFF000000U
  270. #define SDMMC_MAX_DATA_LENGTH 0x01FFFFFFU
  271. #define SDMMC_HALFFIFO 0x00000008U
  272. #define SDMMC_HALFFIFOBYTES 0x00000020U
  273. /**
  274. * @brief Command Class supported
  275. */
  276. #define SDIO_CCCC_ERASE 0x00000020U
  277. #define SDIO_CMDTIMEOUT 5000U /* Command send and response timeout */
  278. #define SDIO_MAXERASETIMEOUT 63000U /* Max erase Timeout 63 s */
  279. #define SDIO_STOPTRANSFERTIMEOUT 100000000U /* Timeout for STOP TRANSMISSION command */
  280. /** @defgroup SDIO_LL_Clock_Edge Clock Edge
  281. * @{
  282. */
  283. #define SDIO_CLOCK_EDGE_RISING 0x00000000U
  284. #define SDIO_CLOCK_EDGE_FALLING SDIO_CLKCR_NEGEDGE
  285. #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_CLOCK_EDGE_RISING) || \
  286. ((EDGE) == SDIO_CLOCK_EDGE_FALLING))
  287. /**
  288. * @}
  289. */
  290. /** @defgroup SDIO_LL_Clock_Bypass Clock Bypass
  291. * @{
  292. */
  293. #define SDIO_CLOCK_BYPASS_DISABLE 0x00000000U
  294. #define SDIO_CLOCK_BYPASS_ENABLE SDIO_CLKCR_BYPASS
  295. #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_CLOCK_BYPASS_DISABLE) || \
  296. ((BYPASS) == SDIO_CLOCK_BYPASS_ENABLE))
  297. /**
  298. * @}
  299. */
  300. /** @defgroup SDIO_LL_Clock_Power_Save Clock Power Saving
  301. * @{
  302. */
  303. #define SDIO_CLOCK_POWER_SAVE_DISABLE 0x00000000U
  304. #define SDIO_CLOCK_POWER_SAVE_ENABLE SDIO_CLKCR_PWRSAV
  305. #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_CLOCK_POWER_SAVE_DISABLE) || \
  306. ((SAVE) == SDIO_CLOCK_POWER_SAVE_ENABLE))
  307. /**
  308. * @}
  309. */
  310. /** @defgroup SDIO_LL_Bus_Wide Bus Width
  311. * @{
  312. */
  313. #define SDIO_BUS_WIDE_1B 0x00000000U
  314. #define SDIO_BUS_WIDE_4B SDIO_CLKCR_WIDBUS_0
  315. #define SDIO_BUS_WIDE_8B SDIO_CLKCR_WIDBUS_1
  316. #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BUS_WIDE_1B) || \
  317. ((WIDE) == SDIO_BUS_WIDE_4B) || \
  318. ((WIDE) == SDIO_BUS_WIDE_8B))
  319. /**
  320. * @}
  321. */
  322. /** @defgroup SDIO_LL_Hardware_Flow_Control Hardware Flow Control
  323. * @{
  324. */
  325. #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE 0x00000000U
  326. #define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDIO_CLKCR_HWFC_EN
  327. #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_DISABLE) || \
  328. ((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_ENABLE))
  329. /**
  330. * @}
  331. */
  332. /** @defgroup SDIO_LL_Clock_Division Clock Division
  333. * @{
  334. */
  335. #define IS_SDIO_CLKDIV(DIV) ((DIV) <= 0xFFU)
  336. /**
  337. * @}
  338. */
  339. /** @defgroup SDIO_LL_Command_Index Command Index
  340. * @{
  341. */
  342. #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40U)
  343. /**
  344. * @}
  345. */
  346. /** @defgroup SDIO_LL_Response_Type Response Type
  347. * @{
  348. */
  349. #define SDIO_RESPONSE_NO 0x00000000U
  350. #define SDIO_RESPONSE_SHORT SDIO_CMD_WAITRESP_0
  351. #define SDIO_RESPONSE_LONG SDIO_CMD_WAITRESP
  352. #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_RESPONSE_NO) || \
  353. ((RESPONSE) == SDIO_RESPONSE_SHORT) || \
  354. ((RESPONSE) == SDIO_RESPONSE_LONG))
  355. /**
  356. * @}
  357. */
  358. /** @defgroup SDIO_LL_Wait_Interrupt_State Wait Interrupt
  359. * @{
  360. */
  361. #define SDIO_WAIT_NO 0x00000000U
  362. #define SDIO_WAIT_IT SDIO_CMD_WAITINT
  363. #define SDIO_WAIT_PEND SDIO_CMD_WAITPEND
  364. #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_WAIT_NO) || \
  365. ((WAIT) == SDIO_WAIT_IT) || \
  366. ((WAIT) == SDIO_WAIT_PEND))
  367. /**
  368. * @}
  369. */
  370. /** @defgroup SDIO_LL_CPSM_State CPSM State
  371. * @{
  372. */
  373. #define SDIO_CPSM_DISABLE 0x00000000U
  374. #define SDIO_CPSM_ENABLE SDIO_CMD_CPSMEN
  375. #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_DISABLE) || \
  376. ((CPSM) == SDIO_CPSM_ENABLE))
  377. /**
  378. * @}
  379. */
  380. /** @defgroup SDIO_LL_Response_Registers Response Register
  381. * @{
  382. */
  383. #define SDIO_RESP1 0x00000000U
  384. #define SDIO_RESP2 0x00000004U
  385. #define SDIO_RESP3 0x00000008U
  386. #define SDIO_RESP4 0x0000000CU
  387. #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || \
  388. ((RESP) == SDIO_RESP2) || \
  389. ((RESP) == SDIO_RESP3) || \
  390. ((RESP) == SDIO_RESP4))
  391. /**
  392. * @}
  393. */
  394. /** @defgroup SDIO_LL_Data_Length Data Length
  395. * @{
  396. */
  397. #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFFU)
  398. /**
  399. * @}
  400. */
  401. /** @defgroup SDIO_LL_Data_Block_Size Data Block Size
  402. * @{
  403. */
  404. #define SDIO_DATABLOCK_SIZE_1B 0x00000000U
  405. #define SDIO_DATABLOCK_SIZE_2B SDIO_DCTRL_DBLOCKSIZE_0
  406. #define SDIO_DATABLOCK_SIZE_4B SDIO_DCTRL_DBLOCKSIZE_1
  407. #define SDIO_DATABLOCK_SIZE_8B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_1)
  408. #define SDIO_DATABLOCK_SIZE_16B SDIO_DCTRL_DBLOCKSIZE_2
  409. #define SDIO_DATABLOCK_SIZE_32B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_2)
  410. #define SDIO_DATABLOCK_SIZE_64B (SDIO_DCTRL_DBLOCKSIZE_1|SDIO_DCTRL_DBLOCKSIZE_2)
  411. #define SDIO_DATABLOCK_SIZE_128B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_1|SDIO_DCTRL_DBLOCKSIZE_2)
  412. #define SDIO_DATABLOCK_SIZE_256B SDIO_DCTRL_DBLOCKSIZE_3
  413. #define SDIO_DATABLOCK_SIZE_512B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_3)
  414. #define SDIO_DATABLOCK_SIZE_1024B (SDIO_DCTRL_DBLOCKSIZE_1|SDIO_DCTRL_DBLOCKSIZE_3)
  415. #define SDIO_DATABLOCK_SIZE_2048B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_1|SDIO_DCTRL_DBLOCKSIZE_3)
  416. #define SDIO_DATABLOCK_SIZE_4096B (SDIO_DCTRL_DBLOCKSIZE_2|SDIO_DCTRL_DBLOCKSIZE_3)
  417. #define SDIO_DATABLOCK_SIZE_8192B (SDIO_DCTRL_DBLOCKSIZE_0|SDIO_DCTRL_DBLOCKSIZE_2|SDIO_DCTRL_DBLOCKSIZE_3)
  418. #define SDIO_DATABLOCK_SIZE_16384B (SDIO_DCTRL_DBLOCKSIZE_1|SDIO_DCTRL_DBLOCKSIZE_2|SDIO_DCTRL_DBLOCKSIZE_3)
  419. #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DATABLOCK_SIZE_1B) || \
  420. ((SIZE) == SDIO_DATABLOCK_SIZE_2B) || \
  421. ((SIZE) == SDIO_DATABLOCK_SIZE_4B) || \
  422. ((SIZE) == SDIO_DATABLOCK_SIZE_8B) || \
  423. ((SIZE) == SDIO_DATABLOCK_SIZE_16B) || \
  424. ((SIZE) == SDIO_DATABLOCK_SIZE_32B) || \
  425. ((SIZE) == SDIO_DATABLOCK_SIZE_64B) || \
  426. ((SIZE) == SDIO_DATABLOCK_SIZE_128B) || \
  427. ((SIZE) == SDIO_DATABLOCK_SIZE_256B) || \
  428. ((SIZE) == SDIO_DATABLOCK_SIZE_512B) || \
  429. ((SIZE) == SDIO_DATABLOCK_SIZE_1024B) || \
  430. ((SIZE) == SDIO_DATABLOCK_SIZE_2048B) || \
  431. ((SIZE) == SDIO_DATABLOCK_SIZE_4096B) || \
  432. ((SIZE) == SDIO_DATABLOCK_SIZE_8192B) || \
  433. ((SIZE) == SDIO_DATABLOCK_SIZE_16384B))
  434. /**
  435. * @}
  436. */
  437. /** @defgroup SDIO_LL_Transfer_Direction Transfer Direction
  438. * @{
  439. */
  440. #define SDIO_TRANSFER_DIR_TO_CARD 0x00000000U
  441. #define SDIO_TRANSFER_DIR_TO_SDIO SDIO_DCTRL_DTDIR
  442. #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TRANSFER_DIR_TO_CARD) || \
  443. ((DIR) == SDIO_TRANSFER_DIR_TO_SDIO))
  444. /**
  445. * @}
  446. */
  447. /** @defgroup SDIO_LL_Transfer_Type Transfer Type
  448. * @{
  449. */
  450. #define SDIO_TRANSFER_MODE_BLOCK 0x00000000U
  451. #define SDIO_TRANSFER_MODE_STREAM SDIO_DCTRL_DTMODE
  452. #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TRANSFER_MODE_BLOCK) || \
  453. ((MODE) == SDIO_TRANSFER_MODE_STREAM))
  454. /**
  455. * @}
  456. */
  457. /** @defgroup SDIO_LL_DPSM_State DPSM State
  458. * @{
  459. */
  460. #define SDIO_DPSM_DISABLE 0x00000000U
  461. #define SDIO_DPSM_ENABLE SDIO_DCTRL_DTEN
  462. #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_DISABLE) ||\
  463. ((DPSM) == SDIO_DPSM_ENABLE))
  464. /**
  465. * @}
  466. */
  467. /** @defgroup SDIO_LL_Read_Wait_Mode Read Wait Mode
  468. * @{
  469. */
  470. #define SDIO_READ_WAIT_MODE_DATA2 0x00000000U
  471. #define SDIO_READ_WAIT_MODE_CLK (SDIO_DCTRL_RWMOD)
  472. #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_READ_WAIT_MODE_CLK) || \
  473. ((MODE) == SDIO_READ_WAIT_MODE_DATA2))
  474. /**
  475. * @}
  476. */
  477. /** @defgroup SDIO_LL_Interrupt_sources Interrupt Sources
  478. * @{
  479. */
  480. #define SDIO_IT_CCRCFAIL SDIO_MASK_CCRCFAILIE
  481. #define SDIO_IT_DCRCFAIL SDIO_MASK_DCRCFAILIE
  482. #define SDIO_IT_CTIMEOUT SDIO_MASK_CTIMEOUTIE
  483. #define SDIO_IT_DTIMEOUT SDIO_MASK_DTIMEOUTIE
  484. #define SDIO_IT_TXUNDERR SDIO_MASK_TXUNDERRIE
  485. #define SDIO_IT_RXOVERR SDIO_MASK_RXOVERRIE
  486. #define SDIO_IT_CMDREND SDIO_MASK_CMDRENDIE
  487. #define SDIO_IT_CMDSENT SDIO_MASK_CMDSENTIE
  488. #define SDIO_IT_DATAEND SDIO_MASK_DATAENDIE
  489. #define SDIO_IT_STBITERR SDIO_MASK_STBITERRIE
  490. #define SDIO_IT_DBCKEND SDIO_MASK_DBCKENDIE
  491. #define SDIO_IT_CMDACT SDIO_MASK_CMDACTIE
  492. #define SDIO_IT_TXACT SDIO_MASK_TXACTIE
  493. #define SDIO_IT_RXACT SDIO_MASK_RXACTIE
  494. #define SDIO_IT_TXFIFOHE SDIO_MASK_TXFIFOHEIE
  495. #define SDIO_IT_RXFIFOHF SDIO_MASK_RXFIFOHFIE
  496. #define SDIO_IT_TXFIFOF SDIO_MASK_TXFIFOFIE
  497. #define SDIO_IT_RXFIFOF SDIO_MASK_RXFIFOFIE
  498. #define SDIO_IT_TXFIFOE SDIO_MASK_TXFIFOEIE
  499. #define SDIO_IT_RXFIFOE SDIO_MASK_RXFIFOEIE
  500. #define SDIO_IT_TXDAVL SDIO_MASK_TXDAVLIE
  501. #define SDIO_IT_RXDAVL SDIO_MASK_RXDAVLIE
  502. #define SDIO_IT_SDIOIT SDIO_MASK_SDIOITIE
  503. #define SDIO_IT_CEATAEND SDIO_MASK_CEATAENDIE
  504. /**
  505. * @}
  506. */
  507. /** @defgroup SDIO_LL_Flags Flags
  508. * @{
  509. */
  510. #define SDIO_FLAG_CCRCFAIL SDIO_STA_CCRCFAIL
  511. #define SDIO_FLAG_DCRCFAIL SDIO_STA_DCRCFAIL
  512. #define SDIO_FLAG_CTIMEOUT SDIO_STA_CTIMEOUT
  513. #define SDIO_FLAG_DTIMEOUT SDIO_STA_DTIMEOUT
  514. #define SDIO_FLAG_TXUNDERR SDIO_STA_TXUNDERR
  515. #define SDIO_FLAG_RXOVERR SDIO_STA_RXOVERR
  516. #define SDIO_FLAG_CMDREND SDIO_STA_CMDREND
  517. #define SDIO_FLAG_CMDSENT SDIO_STA_CMDSENT
  518. #define SDIO_FLAG_DATAEND SDIO_STA_DATAEND
  519. #define SDIO_FLAG_STBITERR SDIO_STA_STBITERR
  520. #define SDIO_FLAG_DBCKEND SDIO_STA_DBCKEND
  521. #define SDIO_FLAG_CMDACT SDIO_STA_CMDACT
  522. #define SDIO_FLAG_TXACT SDIO_STA_TXACT
  523. #define SDIO_FLAG_RXACT SDIO_STA_RXACT
  524. #define SDIO_FLAG_TXFIFOHE SDIO_STA_TXFIFOHE
  525. #define SDIO_FLAG_RXFIFOHF SDIO_STA_RXFIFOHF
  526. #define SDIO_FLAG_TXFIFOF SDIO_STA_TXFIFOF
  527. #define SDIO_FLAG_RXFIFOF SDIO_STA_RXFIFOF
  528. #define SDIO_FLAG_TXFIFOE SDIO_STA_TXFIFOE
  529. #define SDIO_FLAG_RXFIFOE SDIO_STA_RXFIFOE
  530. #define SDIO_FLAG_TXDAVL SDIO_STA_TXDAVL
  531. #define SDIO_FLAG_RXDAVL SDIO_STA_RXDAVL
  532. #define SDIO_FLAG_SDIOIT SDIO_STA_SDIOIT
  533. #define SDIO_FLAG_CEATAEND SDIO_STA_CEATAEND
  534. #define SDIO_STATIC_FLAGS ((uint32_t)(SDIO_FLAG_CCRCFAIL | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_CTIMEOUT |\
  535. SDIO_FLAG_DTIMEOUT | SDIO_FLAG_TXUNDERR | SDIO_FLAG_RXOVERR |\
  536. SDIO_FLAG_CMDREND | SDIO_FLAG_CMDSENT | SDIO_FLAG_DATAEND |\
  537. SDIO_FLAG_DBCKEND | SDIO_FLAG_SDIOIT))
  538. #define SDIO_STATIC_CMD_FLAGS ((uint32_t)(SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND |\
  539. SDIO_FLAG_CMDSENT))
  540. #define SDIO_STATIC_DATA_FLAGS ((uint32_t)(SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_TXUNDERR |\
  541. SDIO_FLAG_RXOVERR | SDIO_FLAG_DATAEND | SDIO_FLAG_DBCKEND))
  542. /**
  543. * @}
  544. */
  545. /**
  546. * @}
  547. */
  548. /* Exported macro ------------------------------------------------------------*/
  549. /** @defgroup SDIO_LL_Exported_macros SDIO_LL Exported Macros
  550. * @{
  551. */
  552. /** @defgroup SDMMC_LL_Alias_Region Bit Address in the alias region
  553. * @{
  554. */
  555. /* ------------ SDIO registers bit address in the alias region -------------- */
  556. #define SDIO_OFFSET (SDIO_BASE - PERIPH_BASE)
  557. /* --- CLKCR Register ---*/
  558. /* Alias word address of CLKEN bit */
  559. #define CLKCR_OFFSET (SDIO_OFFSET + 0x04U)
  560. #define CLKEN_BITNUMBER 0x08U
  561. #define CLKCR_CLKEN_BB (PERIPH_BB_BASE + (CLKCR_OFFSET * 32U) + (CLKEN_BITNUMBER * 4U))
  562. /* --- CMD Register ---*/
  563. /* Alias word address of SDIOSUSPEND bit */
  564. #define CMD_OFFSET (SDIO_OFFSET + 0x0CU)
  565. #define SDIOSUSPEND_BITNUMBER 0x0BU
  566. #define CMD_SDIOSUSPEND_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (SDIOSUSPEND_BITNUMBER * 4U))
  567. /* Alias word address of ENCMDCOMPL bit */
  568. #define ENCMDCOMPL_BITNUMBER 0x0CU
  569. #define CMD_ENCMDCOMPL_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (ENCMDCOMPL_BITNUMBER * 4U))
  570. /* Alias word address of NIEN bit */
  571. #define NIEN_BITNUMBER 0x0DU
  572. #define CMD_NIEN_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (NIEN_BITNUMBER * 4U))
  573. /* Alias word address of ATACMD bit */
  574. #define ATACMD_BITNUMBER 0x0EU
  575. #define CMD_ATACMD_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (ATACMD_BITNUMBER * 4U))
  576. /* --- DCTRL Register ---*/
  577. /* Alias word address of DMAEN bit */
  578. #define DCTRL_OFFSET (SDIO_OFFSET + 0x2CU)
  579. #define DMAEN_BITNUMBER 0x03U
  580. #define DCTRL_DMAEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (DMAEN_BITNUMBER * 4U))
  581. /* Alias word address of RWSTART bit */
  582. #define RWSTART_BITNUMBER 0x08U
  583. #define DCTRL_RWSTART_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWSTART_BITNUMBER * 4U))
  584. /* Alias word address of RWSTOP bit */
  585. #define RWSTOP_BITNUMBER 0x09U
  586. #define DCTRL_RWSTOP_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWSTOP_BITNUMBER * 4U))
  587. /* Alias word address of RWMOD bit */
  588. #define RWMOD_BITNUMBER 0x0AU
  589. #define DCTRL_RWMOD_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWMOD_BITNUMBER * 4U))
  590. /* Alias word address of SDIOEN bit */
  591. #define SDIOEN_BITNUMBER 0x0BU
  592. #define DCTRL_SDIOEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (SDIOEN_BITNUMBER * 4U))
  593. /**
  594. * @}
  595. */
  596. /** @defgroup SDIO_LL_Register Bits And Addresses Definitions
  597. * @brief SDIO_LL registers bit address in the alias region
  598. * @{
  599. */
  600. /* ---------------------- SDIO registers bit mask --------------------------- */
  601. /* --- CLKCR Register ---*/
  602. /* CLKCR register clear mask */
  603. #define CLKCR_CLEAR_MASK ((uint32_t)(SDIO_CLKCR_CLKDIV | SDIO_CLKCR_PWRSAV |\
  604. SDIO_CLKCR_BYPASS | SDIO_CLKCR_WIDBUS |\
  605. SDIO_CLKCR_NEGEDGE | SDIO_CLKCR_HWFC_EN))
  606. /* --- DCTRL Register ---*/
  607. /* SDIO DCTRL Clear Mask */
  608. #define DCTRL_CLEAR_MASK ((uint32_t)(SDIO_DCTRL_DTEN | SDIO_DCTRL_DTDIR |\
  609. SDIO_DCTRL_DTMODE | SDIO_DCTRL_DBLOCKSIZE))
  610. /* --- CMD Register ---*/
  611. /* CMD Register clear mask */
  612. #define CMD_CLEAR_MASK ((uint32_t)(SDIO_CMD_CMDINDEX | SDIO_CMD_WAITRESP |\
  613. SDIO_CMD_WAITINT | SDIO_CMD_WAITPEND |\
  614. SDIO_CMD_CPSMEN | SDIO_CMD_SDIOSUSPEND))
  615. /* SDIO Initialization Frequency (400KHz max) */
  616. #define SDIO_INIT_CLK_DIV ((uint8_t)0x76) /* 48MHz / (SDMMC_INIT_CLK_DIV + 2) < 400KHz */
  617. /* SDIO Data Transfer Frequency (25MHz max) */
  618. #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x4)
  619. /**
  620. * @}
  621. */
  622. /** @defgroup SDIO_LL_Interrupt_Clock Interrupt And Clock Configuration
  623. * @brief macros to handle interrupts and specific clock configurations
  624. * @{
  625. */
  626. /**
  627. * @brief Enable the SDIO device.
  628. * @param __INSTANCE__: SDIO Instance
  629. * @retval None
  630. */
  631. #define __SDIO_ENABLE(__INSTANCE__) (*(__IO uint32_t *)CLKCR_CLKEN_BB = ENABLE)
  632. /**
  633. * @brief Disable the SDIO device.
  634. * @param __INSTANCE__: SDIO Instance
  635. * @retval None
  636. */
  637. #define __SDIO_DISABLE(__INSTANCE__) (*(__IO uint32_t *)CLKCR_CLKEN_BB = DISABLE)
  638. /**
  639. * @brief Enable the SDIO DMA transfer.
  640. * @param __INSTANCE__: SDIO Instance
  641. * @retval None
  642. */
  643. #define __SDIO_DMA_ENABLE(__INSTANCE__) (*(__IO uint32_t *)DCTRL_DMAEN_BB = ENABLE)
  644. /**
  645. * @brief Disable the SDIO DMA transfer.
  646. * @param __INSTANCE__: SDIO Instance
  647. * @retval None
  648. */
  649. #define __SDIO_DMA_DISABLE(__INSTANCE__) (*(__IO uint32_t *)DCTRL_DMAEN_BB = DISABLE)
  650. /**
  651. * @brief Enable the SDIO device interrupt.
  652. * @param __INSTANCE__ : Pointer to SDIO register base
  653. * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be enabled.
  654. * This parameter can be one or a combination of the following values:
  655. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  656. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  657. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  658. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  659. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  660. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  661. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  662. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  663. * @arg SDIO_IT_DATAEND: Data end (data counter, DATACOUNT, is zero) interrupt
  664. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  665. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  666. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  667. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  668. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  669. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  670. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  671. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  672. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  673. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  674. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  675. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  676. * @arg SDIO_IT_SDIOIT: SDIO interrupt received interrupt
  677. * @retval None
  678. */
  679. #define __SDIO_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
  680. /**
  681. * @brief Disable the SDIO device interrupt.
  682. * @param __INSTANCE__ : Pointer to SDIO register base
  683. * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be disabled.
  684. * This parameter can be one or a combination of the following values:
  685. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  686. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  687. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  688. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  689. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  690. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  691. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  692. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  693. * @arg SDIO_IT_DATAEND: Data end (data counter, DATACOUNT, is zero) interrupt
  694. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  695. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  696. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  697. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  698. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  699. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  700. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  701. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  702. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  703. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  704. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  705. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  706. * @arg SDIO_IT_SDIOIT: SDIO interrupt received interrupt
  707. * @retval None
  708. */
  709. #define __SDIO_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
  710. /**
  711. * @brief Checks whether the specified SDIO flag is set or not.
  712. * @param __INSTANCE__ : Pointer to SDIO register base
  713. * @param __FLAG__: specifies the flag to check.
  714. * This parameter can be one of the following values:
  715. * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
  716. * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  717. * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
  718. * @arg SDIO_FLAG_DTIMEOUT: Data timeout
  719. * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
  720. * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
  721. * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
  722. * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
  723. * @arg SDIO_FLAG_DATAEND: Data end (data counter, DATACOUNT, is zero)
  724. * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  725. * @arg SDIO_FLAG_CMDACT: Command transfer in progress
  726. * @arg SDIO_FLAG_TXACT: Data transmit in progress
  727. * @arg SDIO_FLAG_RXACT: Data receive in progress
  728. * @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty
  729. * @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full
  730. * @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full
  731. * @arg SDIO_FLAG_RXFIFOF: Receive FIFO full
  732. * @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty
  733. * @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty
  734. * @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO
  735. * @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO
  736. * @arg SDIO_FLAG_SDIOIT: SDIO interrupt received
  737. * @retval The new state of SDIO_FLAG (SET or RESET).
  738. */
  739. #define __SDIO_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != 0U)
  740. /**
  741. * @brief Clears the SDIO pending flags.
  742. * @param __INSTANCE__ : Pointer to SDIO register base
  743. * @param __FLAG__: specifies the flag to clear.
  744. * This parameter can be one or a combination of the following values:
  745. * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
  746. * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  747. * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
  748. * @arg SDIO_FLAG_DTIMEOUT: Data timeout
  749. * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
  750. * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
  751. * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
  752. * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
  753. * @arg SDIO_FLAG_DATAEND: Data end (data counter, DATACOUNT, is zero)
  754. * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  755. * @arg SDIO_FLAG_SDIOIT: SDIO interrupt received
  756. * @retval None
  757. */
  758. #define __SDIO_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
  759. /**
  760. * @brief Checks whether the specified SDIO interrupt has occurred or not.
  761. * @param __INSTANCE__ : Pointer to SDIO register base
  762. * @param __INTERRUPT__: specifies the SDIO interrupt source to check.
  763. * This parameter can be one of the following values:
  764. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  765. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  766. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  767. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  768. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  769. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  770. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  771. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  772. * @arg SDIO_IT_DATAEND: Data end (data counter, DATACOUNT, is zero) interrupt
  773. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  774. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  775. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  776. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  777. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  778. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  779. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  780. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  781. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  782. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  783. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  784. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  785. * @arg SDIO_IT_SDIOIT: SDIO interrupt received interrupt
  786. * @retval The new state of SDIO_IT (SET or RESET).
  787. */
  788. #define __SDIO_GET_IT (__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
  789. /**
  790. * @brief Clears the SDIO's interrupt pending bits.
  791. * @param __INSTANCE__ : Pointer to SDIO register base
  792. * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
  793. * This parameter can be one or a combination of the following values:
  794. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  795. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  796. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  797. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  798. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  799. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  800. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  801. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  802. * @arg SDIO_IT_DATAEND: Data end (data counter, DATACOUNT, is zero) interrupt
  803. * @arg SDIO_IT_SDIOIT: SDIO interrupt received interrupt
  804. * @retval None
  805. */
  806. #define __SDIO_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
  807. /**
  808. * @brief Enable Start the SD I/O Read Wait operation.
  809. * @param __INSTANCE__ : Pointer to SDIO register base
  810. * @retval None
  811. */
  812. #define __SDIO_START_READWAIT_ENABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_RWSTART_BB = ENABLE)
  813. /**
  814. * @brief Disable Start the SD I/O Read Wait operations.
  815. * @param __INSTANCE__ : Pointer to SDIO register base
  816. * @retval None
  817. */
  818. #define __SDIO_START_READWAIT_DISABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_RWSTART_BB = DISABLE)
  819. /**
  820. * @brief Enable Start the SD I/O Read Wait operation.
  821. * @param __INSTANCE__ : Pointer to SDIO register base
  822. * @retval None
  823. */
  824. #define __SDIO_STOP_READWAIT_ENABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_RWSTOP_BB = ENABLE)
  825. /**
  826. * @brief Disable Stop the SD I/O Read Wait operations.
  827. * @param __INSTANCE__ : Pointer to SDIO register base
  828. * @retval None
  829. */
  830. #define __SDIO_STOP_READWAIT_DISABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_RWSTOP_BB = DISABLE)
  831. /**
  832. * @brief Enable the SD I/O Mode Operation.
  833. * @param __INSTANCE__ : Pointer to SDIO register base
  834. * @retval None
  835. */
  836. #define __SDIO_OPERATION_ENABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_SDIOEN_BB = ENABLE)
  837. /**
  838. * @brief Disable the SD I/O Mode Operation.
  839. * @param __INSTANCE__ : Pointer to SDIO register base
  840. * @retval None
  841. */
  842. #define __SDIO_OPERATION_DISABLE(__INSTANCE__) (*(__IO uint32_t *) DCTRL_SDIOEN_BB = DISABLE)
  843. /**
  844. * @brief Enable the SD I/O Suspend command sending.
  845. * @param __INSTANCE__ : Pointer to SDIO register base
  846. * @retval None
  847. */
  848. #define __SDIO_SUSPEND_CMD_ENABLE(__INSTANCE__) (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = ENABLE)
  849. /**
  850. * @brief Disable the SD I/O Suspend command sending.
  851. * @param __INSTANCE__ : Pointer to SDIO register base
  852. * @retval None
  853. */
  854. #define __SDIO_SUSPEND_CMD_DISABLE(__INSTANCE__) (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = DISABLE)
  855. /**
  856. * @brief Enable the command completion signal.
  857. * @retval None
  858. */
  859. #define __SDIO_CEATA_CMD_COMPLETION_ENABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = ENABLE)
  860. /**
  861. * @brief Disable the command completion signal.
  862. * @retval None
  863. */
  864. #define __SDIO_CEATA_CMD_COMPLETION_DISABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = DISABLE)
  865. /**
  866. * @brief Enable the CE-ATA interrupt.
  867. * @retval None
  868. */
  869. #define __SDIO_CEATA_ENABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)0U)
  870. /**
  871. * @brief Disable the CE-ATA interrupt.
  872. * @retval None
  873. */
  874. #define __SDIO_CEATA_DISABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)1U)
  875. /**
  876. * @brief Enable send CE-ATA command (CMD61).
  877. * @retval None
  878. */
  879. #define __SDIO_CEATA_SENDCMD_ENABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = ENABLE)
  880. /**
  881. * @brief Disable send CE-ATA command (CMD61).
  882. * @retval None
  883. */
  884. #define __SDIO_CEATA_SENDCMD_DISABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = DISABLE)
  885. /**
  886. * @}
  887. */
  888. /**
  889. * @}
  890. */
  891. /* Exported functions --------------------------------------------------------*/
  892. /** @addtogroup SDMMC_LL_Exported_Functions
  893. * @{
  894. */
  895. /* Initialization/de-initialization functions **********************************/
  896. /** @addtogroup HAL_SDMMC_LL_Group1
  897. * @{
  898. */
  899. HAL_StatusTypeDef SDIO_Init(SDIO_TypeDef *SDIOx, SDIO_InitTypeDef Init);
  900. /**
  901. * @}
  902. */
  903. /* I/O operation functions *****************************************************/
  904. /** @addtogroup HAL_SDMMC_LL_Group2
  905. * @{
  906. */
  907. uint32_t SDIO_ReadFIFO(SDIO_TypeDef *SDIOx);
  908. HAL_StatusTypeDef SDIO_WriteFIFO(SDIO_TypeDef *SDIOx, uint32_t *pWriteData);
  909. /**
  910. * @}
  911. */
  912. /* Peripheral Control functions ************************************************/
  913. /** @addtogroup HAL_SDMMC_LL_Group3
  914. * @{
  915. */
  916. HAL_StatusTypeDef SDIO_PowerState_ON(SDIO_TypeDef *SDIOx);
  917. HAL_StatusTypeDef SDIO_PowerState_OFF(SDIO_TypeDef *SDIOx);
  918. uint32_t SDIO_GetPowerState(SDIO_TypeDef *SDIOx);
  919. /* Command path state machine (CPSM) management functions */
  920. HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *Command);
  921. uint8_t SDIO_GetCommandResponse(SDIO_TypeDef *SDIOx);
  922. uint32_t SDIO_GetResponse(SDIO_TypeDef *SDIOx, uint32_t Response);
  923. /* Data path state machine (DPSM) management functions */
  924. HAL_StatusTypeDef SDIO_ConfigData(SDIO_TypeDef *SDIOx, SDIO_DataInitTypeDef* Data);
  925. uint32_t SDIO_GetDataCounter(SDIO_TypeDef *SDIOx);
  926. uint32_t SDIO_GetFIFOCount(SDIO_TypeDef *SDIOx);
  927. /* SDMMC Cards mode management functions */
  928. HAL_StatusTypeDef SDIO_SetSDMMCReadWaitMode(SDIO_TypeDef *SDIOx, uint32_t SDIO_ReadWaitMode);
  929. /**
  930. * @}
  931. */
  932. /* SDMMC Commands management functions */
  933. /** @addtogroup HAL_SDMMC_LL_Group4
  934. * @{
  935. */
  936. uint32_t SDMMC_CmdBlockLength(SDIO_TypeDef *SDIOx, uint32_t BlockSize);
  937. uint32_t SDMMC_CmdReadSingleBlock(SDIO_TypeDef *SDIOx, uint32_t ReadAdd);
  938. uint32_t SDMMC_CmdReadMultiBlock(SDIO_TypeDef *SDIOx, uint32_t ReadAdd);
  939. uint32_t SDMMC_CmdWriteSingleBlock(SDIO_TypeDef *SDIOx, uint32_t WriteAdd);
  940. uint32_t SDMMC_CmdWriteMultiBlock(SDIO_TypeDef *SDIOx, uint32_t WriteAdd);
  941. uint32_t SDMMC_CmdEraseStartAdd(SDIO_TypeDef *SDIOx, uint32_t StartAdd);
  942. uint32_t SDMMC_CmdSDEraseStartAdd(SDIO_TypeDef *SDIOx, uint32_t StartAdd);
  943. uint32_t SDMMC_CmdEraseEndAdd(SDIO_TypeDef *SDIOx, uint32_t EndAdd);
  944. uint32_t SDMMC_CmdSDEraseEndAdd(SDIO_TypeDef *SDIOx, uint32_t EndAdd);
  945. uint32_t SDMMC_CmdErase(SDIO_TypeDef *SDIOx);
  946. uint32_t SDMMC_CmdStopTransfer(SDIO_TypeDef *SDIOx);
  947. uint32_t SDMMC_CmdSelDesel(SDIO_TypeDef *SDIOx, uint64_t Addr);
  948. uint32_t SDMMC_CmdGoIdleState(SDIO_TypeDef *SDIOx);
  949. uint32_t SDMMC_CmdOperCond(SDIO_TypeDef *SDIOx);
  950. uint32_t SDMMC_CmdAppCommand(SDIO_TypeDef *SDIOx, uint32_t Argument);
  951. uint32_t SDMMC_CmdAppOperCommand(SDIO_TypeDef *SDIOx, uint32_t Argument);
  952. uint32_t SDMMC_CmdBusWidth(SDIO_TypeDef *SDIOx, uint32_t BusWidth);
  953. uint32_t SDMMC_CmdSendSCR(SDIO_TypeDef *SDIOx);
  954. uint32_t SDMMC_CmdSendCID(SDIO_TypeDef *SDIOx);
  955. uint32_t SDMMC_CmdSendCSD(SDIO_TypeDef *SDIOx, uint32_t Argument);
  956. uint32_t SDMMC_CmdSetRelAdd(SDIO_TypeDef *SDIOx, uint16_t *pRCA);
  957. uint32_t SDMMC_CmdSetRelAddMmc(SDIO_TypeDef *SDIOx, uint16_t RCA);
  958. uint32_t SDMMC_CmdSendStatus(SDIO_TypeDef *SDIOx, uint32_t Argument);
  959. uint32_t SDMMC_CmdStatusRegister(SDIO_TypeDef *SDIOx);
  960. uint32_t SDMMC_CmdOpCondition(SDIO_TypeDef *SDIOx, uint32_t Argument);
  961. uint32_t SDMMC_CmdSwitch(SDIO_TypeDef *SDIOx, uint32_t Argument);
  962. uint32_t SDMMC_CmdSendEXTCSD(SDIO_TypeDef *SDIOx, uint32_t Argument);
  963. /**
  964. * @}
  965. */
  966. /* SDMMC Responses management functions *****************************************/
  967. /** @addtogroup HAL_SDMMC_LL_Group5
  968. * @{
  969. */
  970. uint32_t SDMMC_GetCmdResp1(SDIO_TypeDef *SDIOx, uint8_t SD_CMD, uint32_t Timeout);
  971. uint32_t SDMMC_GetCmdResp2(SDIO_TypeDef *SDIOx);
  972. uint32_t SDMMC_GetCmdResp3(SDIO_TypeDef *SDIOx);
  973. uint32_t SDMMC_GetCmdResp6(SDIO_TypeDef *SDIOx, uint8_t SD_CMD, uint16_t *pRCA);
  974. uint32_t SDMMC_GetCmdResp7(SDIO_TypeDef *SDIOx);
  975. /**
  976. * @}
  977. */
  978. /**
  979. * @}
  980. */
  981. /**
  982. * @}
  983. */
  984. /**
  985. * @}
  986. */
  987. #endif /* SDIO */
  988. #ifdef __cplusplus
  989. }
  990. #endif
  991. #endif /* STM32F1xx_LL_SDMMC_H */