You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stm32l1xx_ll_sdmmc.h 59KB

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