stm32f4xx_ll_sdmmc.h 60 KB

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