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.
 
 
 

1096 lines
60 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_sdmmc.h
  4. * @author MCD Application Team
  5. * @version V1.7.2
  6. * @date 16-June-2017
  7. * @brief Header file of low layer SDMMC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32L4xx_LL_SDMMC_H
  39. #define __STM32L4xx_LL_SDMMC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined(SDMMC1)
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "stm32l4xx_hal_def.h"
  46. /** @addtogroup STM32L4xx_Driver
  47. * @{
  48. */
  49. /** @addtogroup SDMMC_LL
  50. * @{
  51. */
  52. /* Exported types ------------------------------------------------------------*/
  53. /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types
  54. * @{
  55. */
  56. /**
  57. * @brief SDMMC Configuration Structure definition
  58. */
  59. typedef struct
  60. {
  61. uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made.
  62. This parameter can be a value of @ref SDMMC_LL_Clock_Edge */
  63. uint32_t ClockBypass; /*!< Specifies whether the SDMMC Clock divider bypass is
  64. enabled or disabled.
  65. This parameter can be a value of @ref SDMMC_LL_Clock_Bypass */
  66. uint32_t ClockPowerSave; /*!< Specifies whether SDMMC Clock output is enabled or
  67. disabled when the bus is idle.
  68. This parameter can be a value of @ref SDMMC_LL_Clock_Power_Save */
  69. uint32_t BusWide; /*!< Specifies the SDMMC bus width.
  70. This parameter can be a value of @ref SDMMC_LL_Bus_Wide */
  71. uint32_t HardwareFlowControl; /*!< Specifies whether the SDMMC hardware flow control is enabled or disabled.
  72. This parameter can be a value of @ref SDMMC_LL_Hardware_Flow_Control */
  73. uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDMMC controller.
  74. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  75. }SDMMC_InitTypeDef;
  76. /**
  77. * @brief SDMMC Command Control structure
  78. */
  79. typedef struct
  80. {
  81. uint32_t Argument; /*!< Specifies the SDMMC command argument which is sent
  82. to a card as part of a command message. If a command
  83. contains an argument, it must be loaded into this register
  84. before writing the command to the command register. */
  85. uint32_t CmdIndex; /*!< Specifies the SDMMC command index. It must be Min_Data = 0 and
  86. Max_Data = 64 */
  87. uint32_t Response; /*!< Specifies the SDMMC response type.
  88. This parameter can be a value of @ref SDMMC_LL_Response_Type */
  89. uint32_t WaitForInterrupt; /*!< Specifies whether SDMMC wait for interrupt request is
  90. enabled or disabled.
  91. This parameter can be a value of @ref SDMMC_LL_Wait_Interrupt_State */
  92. uint32_t CPSM; /*!< Specifies whether SDMMC Command path state machine (CPSM)
  93. is enabled or disabled.
  94. This parameter can be a value of @ref SDMMC_LL_CPSM_State */
  95. }SDMMC_CmdInitTypeDef;
  96. /**
  97. * @brief SDMMC Data Control structure
  98. */
  99. typedef struct
  100. {
  101. uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
  102. uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */
  103. uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer.
  104. This parameter can be a value of @ref SDMMC_LL_Data_Block_Size */
  105. uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer
  106. is a read or write.
  107. This parameter can be a value of @ref SDMMC_LL_Transfer_Direction */
  108. uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
  109. This parameter can be a value of @ref SDMMC_LL_Transfer_Type */
  110. uint32_t DPSM; /*!< Specifies whether SDMMC Data path state machine (DPSM)
  111. is enabled or disabled.
  112. This parameter can be a value of @ref SDMMC_LL_DPSM_State */
  113. }SDMMC_DataInitTypeDef;
  114. /**
  115. * @}
  116. */
  117. /* Exported constants --------------------------------------------------------*/
  118. /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants
  119. * @{
  120. */
  121. #define SDMMC_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
  122. #define SDMMC_ERROR_CMD_CRC_FAIL ((uint32_t)0x00000001U) /*!< Command response received (but CRC check failed) */
  123. #define SDMMC_ERROR_DATA_CRC_FAIL ((uint32_t)0x00000002U) /*!< Data block sent/received (CRC check failed) */
  124. #define SDMMC_ERROR_CMD_RSP_TIMEOUT ((uint32_t)0x00000004U) /*!< Command response timeout */
  125. #define SDMMC_ERROR_DATA_TIMEOUT ((uint32_t)0x00000008U) /*!< Data timeout */
  126. #define SDMMC_ERROR_TX_UNDERRUN ((uint32_t)0x00000010U) /*!< Transmit FIFO underrun */
  127. #define SDMMC_ERROR_RX_OVERRUN ((uint32_t)0x00000020U) /*!< Receive FIFO overrun */
  128. #define SDMMC_ERROR_ADDR_MISALIGNED ((uint32_t)0x00000040U) /*!< Misaligned address */
  129. #define SDMMC_ERROR_BLOCK_LEN_ERR ((uint32_t)0x00000080U) /*!< Transferred block length is not allowed for the card or the
  130. number of transferred bytes does not match the block length */
  131. #define SDMMC_ERROR_ERASE_SEQ_ERR ((uint32_t)0x00000100U) /*!< An error in the sequence of erase command occurs */
  132. #define SDMMC_ERROR_BAD_ERASE_PARAM ((uint32_t)0x00000200U) /*!< An invalid selection for erase groups */
  133. #define SDMMC_ERROR_WRITE_PROT_VIOLATION ((uint32_t)0x00000400U) /*!< Attempt to program a write protect block */
  134. #define SDMMC_ERROR_LOCK_UNLOCK_FAILED ((uint32_t)0x00000800U) /*!< Sequence or password error has been detected in unlock
  135. command or if there was an attempt to access a locked card */
  136. #define SDMMC_ERROR_COM_CRC_FAILED ((uint32_t)0x00001000U) /*!< CRC check of the previous command failed */
  137. #define SDMMC_ERROR_ILLEGAL_CMD ((uint32_t)0x00002000U) /*!< Command is not legal for the card state */
  138. #define SDMMC_ERROR_CARD_ECC_FAILED ((uint32_t)0x00004000U) /*!< Card internal ECC was applied but failed to correct the data */
  139. #define SDMMC_ERROR_CC_ERR ((uint32_t)0x00008000U) /*!< Internal card controller error */
  140. #define SDMMC_ERROR_GENERAL_UNKNOWN_ERR ((uint32_t)0x00010000U) /*!< General or unknown error */
  141. #define SDMMC_ERROR_STREAM_READ_UNDERRUN ((uint32_t)0x00020000U) /*!< The card could not sustain data reading in stream rmode */
  142. #define SDMMC_ERROR_STREAM_WRITE_OVERRUN ((uint32_t)0x00040000U) /*!< The card could not sustain data programming in stream mode */
  143. #define SDMMC_ERROR_CID_CSD_OVERWRITE ((uint32_t)0x00080000U) /*!< CID/CSD overwrite error */
  144. #define SDMMC_ERROR_WP_ERASE_SKIP ((uint32_t)0x00100000U) /*!< Only partial address space was erased */
  145. #define SDMMC_ERROR_CARD_ECC_DISABLED ((uint32_t)0x00200000U) /*!< Command has been executed without using internal ECC */
  146. #define SDMMC_ERROR_ERASE_RESET ((uint32_t)0x00400000U) /*!< Erase sequence was cleared before executing because an out
  147. of erase sequence command was received */
  148. #define SDMMC_ERROR_AKE_SEQ_ERR ((uint32_t)0x00800000U) /*!< Error in sequence of authentication */
  149. #define SDMMC_ERROR_INVALID_VOLTRANGE ((uint32_t)0x01000000U) /*!< Error in case of invalid voltage range */
  150. #define SDMMC_ERROR_ADDR_OUT_OF_RANGE ((uint32_t)0x02000000U) /*!< Error when addressed block is out of range */
  151. #define SDMMC_ERROR_REQUEST_NOT_APPLICABLE ((uint32_t)0x04000000U) /*!< Error when command request is not applicable */
  152. #define SDMMC_ERROR_INVALID_PARAMETER ((uint32_t)0x08000000U) /*!< the used parameter is not valid */
  153. #define SDMMC_ERROR_UNSUPPORTED_FEATURE ((uint32_t)0x10000000U) /*!< Error when feature is not insupported */
  154. #define SDMMC_ERROR_BUSY ((uint32_t)0x20000000U) /*!< Error when transfer process is busy */
  155. #define SDMMC_ERROR_DMA ((uint32_t)0x40000000U) /*!< Error while DMA transfer */
  156. #define SDMMC_ERROR_TIMEOUT ((uint32_t)0x80000000U) /*!< Timeout error */
  157. /**
  158. * @brief SDMMC Commands Index
  159. */
  160. #define SDMMC_CMD_GO_IDLE_STATE ((uint8_t)0U) /*!< Resets the SD memory card. */
  161. #define SDMMC_CMD_SEND_OP_COND ((uint8_t)1U) /*!< Sends host capacity support information and activates the card's initialization process. */
  162. #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. */
  163. #define SDMMC_CMD_SET_REL_ADDR ((uint8_t)3U) /*!< Asks the card to publish a new relative address (RCA). */
  164. #define SDMMC_CMD_SET_DSR ((uint8_t)4U) /*!< Programs the DSR of all cards. */
  165. #define SDMMC_CMD_SDMMC_SEN_OP_COND ((uint8_t)5U) /*!< Sends host capacity support information (HCS) and asks the accessed card to send its
  166. operating condition register (OCR) content in the response on the CMD line. */
  167. #define SDMMC_CMD_HS_SWITCH ((uint8_t)6U) /*!< Checks switchable function (mode 0) and switch card function (mode 1). */
  168. #define SDMMC_CMD_SEL_DESEL_CARD ((uint8_t)7U) /*!< Selects the card by its own relative address and gets deselected by any other address */
  169. #define SDMMC_CMD_HS_SEND_EXT_CSD ((uint8_t)8U) /*!< Sends SD Memory Card interface condition, which includes host supply voltage information
  170. and asks the card whether card supports voltage. */
  171. #define SDMMC_CMD_SEND_CSD ((uint8_t)9U) /*!< Addressed card sends its card specific data (CSD) on the CMD line. */
  172. #define SDMMC_CMD_SEND_CID ((uint8_t)10U) /*!< Addressed card sends its card identification (CID) on the CMD line. */
  173. #define SDMMC_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11U) /*!< SD card doesn't support it. */
  174. #define SDMMC_CMD_STOP_TRANSMISSION ((uint8_t)12U) /*!< Forces the card to stop transmission. */
  175. #define SDMMC_CMD_SEND_STATUS ((uint8_t)13U) /*!< Addressed card sends its status register. */
  176. #define SDMMC_CMD_HS_BUSTEST_READ ((uint8_t)14U) /*!< Reserved */
  177. #define SDMMC_CMD_GO_INACTIVE_STATE ((uint8_t)15U) /*!< Sends an addressed card into the inactive state. */
  178. #define SDMMC_CMD_SET_BLOCKLEN ((uint8_t)16U) /*!< Sets the block length (in bytes for SDSC) for all following block commands
  179. (read, write, lock). Default block length is fixed to 512 Bytes. Not effective
  180. for SDHS and SDXC. */
  181. #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
  182. fixed 512 bytes in case of SDHC and SDXC. */
  183. #define SDMMC_CMD_READ_MULT_BLOCK ((uint8_t)18U) /*!< Continuously transfers data blocks from card to host until interrupted by
  184. STOP_TRANSMISSION command. */
  185. #define SDMMC_CMD_HS_BUSTEST_WRITE ((uint8_t)19U) /*!< 64 bytes tuning pattern is sent for SDR50 and SDR104. */
  186. #define SDMMC_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20U) /*!< Speed class control command. */
  187. #define SDMMC_CMD_SET_BLOCK_COUNT ((uint8_t)23U) /*!< Specify block count for CMD18 and CMD25. */
  188. #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
  189. fixed 512 bytes in case of SDHC and SDXC. */
  190. #define SDMMC_CMD_WRITE_MULT_BLOCK ((uint8_t)25U) /*!< Continuously writes blocks of data until a STOP_TRANSMISSION follows. */
  191. #define SDMMC_CMD_PROG_CID ((uint8_t)26U) /*!< Reserved for manufacturers. */
  192. #define SDMMC_CMD_PROG_CSD ((uint8_t)27U) /*!< Programming of the programmable bits of the CSD. */
  193. #define SDMMC_CMD_SET_WRITE_PROT ((uint8_t)28U) /*!< Sets the write protection bit of the addressed group. */
  194. #define SDMMC_CMD_CLR_WRITE_PROT ((uint8_t)29U) /*!< Clears the write protection bit of the addressed group. */
  195. #define SDMMC_CMD_SEND_WRITE_PROT ((uint8_t)30U) /*!< Asks the card to send the status of the write protection bits. */
  196. #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). */
  197. #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. */
  198. #define SDMMC_CMD_ERASE_GRP_START ((uint8_t)35U) /*!< Sets the address of the first write block to be erased. Reserved for each command
  199. system set by switch function command (CMD6). */
  200. #define SDMMC_CMD_ERASE_GRP_END ((uint8_t)36U) /*!< Sets the address of the last write block of the continuous range to be erased.
  201. Reserved for each command system set by switch function command (CMD6). */
  202. #define SDMMC_CMD_ERASE ((uint8_t)38U) /*!< Reserved for SD security applications. */
  203. #define SDMMC_CMD_FAST_IO ((uint8_t)39U) /*!< SD card doesn't support it (Reserved). */
  204. #define SDMMC_CMD_GO_IRQ_STATE ((uint8_t)40U) /*!< SD card doesn't support it (Reserved). */
  205. #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
  206. the SET_BLOCK_LEN command. */
  207. #define SDMMC_CMD_APP_CMD ((uint8_t)55U) /*!< Indicates to the card that the next command is an application specific command rather
  208. than a standard command. */
  209. #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
  210. for general purpose/application specific commands. */
  211. #define SDMMC_CMD_NO_CMD ((uint8_t)64U) /*!< No command */
  212. /**
  213. * @brief Following commands are SD Card Specific commands.
  214. * SDMMC_APP_CMD should be sent before sending these commands.
  215. */
  216. #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
  217. widths are given in SCR register. */
  218. #define SDMMC_CMD_SD_APP_STATUS ((uint8_t)13U) /*!< (ACMD13) Sends the SD status. */
  219. #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
  220. 32bit+CRC data block. */
  221. #define SDMMC_CMD_SD_APP_OP_COND ((uint8_t)41U) /*!< (ACMD41) Sends host capacity support information (HCS) and asks the accessed card to
  222. send its operating condition register (OCR) content in the response on the CMD line. */
  223. #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 */
  224. #define SDMMC_CMD_SD_APP_SEND_SCR ((uint8_t)51U) /*!< Reads the SD Configuration Register (SCR). */
  225. #define SDMMC_CMD_SDMMC_RW_DIRECT ((uint8_t)52U) /*!< For SD I/O card only, reserved for security specification. */
  226. #define SDMMC_CMD_SDMMC_RW_EXTENDED ((uint8_t)53U) /*!< For SD I/O card only, reserved for security specification. */
  227. /**
  228. * @brief Following commands are SD Card Specific security commands.
  229. * SDMMC_CMD_APP_CMD should be sent before sending these commands.
  230. */
  231. #define SDMMC_CMD_SD_APP_GET_MKB ((uint8_t)43U)
  232. #define SDMMC_CMD_SD_APP_GET_MID ((uint8_t)44U)
  233. #define SDMMC_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45U)
  234. #define SDMMC_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46U)
  235. #define SDMMC_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47U)
  236. #define SDMMC_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48U)
  237. #define SDMMC_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18U)
  238. #define SDMMC_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25U)
  239. #define SDMMC_CMD_SD_APP_SECURE_ERASE ((uint8_t)38U)
  240. #define SDMMC_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49U)
  241. #define SDMMC_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48U)
  242. /**
  243. * @brief Masks for errors Card Status R1 (OCR Register)
  244. */
  245. #define SDMMC_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000U)
  246. #define SDMMC_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000U)
  247. #define SDMMC_OCR_BLOCK_LEN_ERR ((uint32_t)0x20000000U)
  248. #define SDMMC_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000U)
  249. #define SDMMC_OCR_BAD_ERASE_PARAM ((uint32_t)0x08000000U)
  250. #define SDMMC_OCR_WRITE_PROT_VIOLATION ((uint32_t)0x04000000U)
  251. #define SDMMC_OCR_LOCK_UNLOCK_FAILED ((uint32_t)0x01000000U)
  252. #define SDMMC_OCR_COM_CRC_FAILED ((uint32_t)0x00800000U)
  253. #define SDMMC_OCR_ILLEGAL_CMD ((uint32_t)0x00400000U)
  254. #define SDMMC_OCR_CARD_ECC_FAILED ((uint32_t)0x00200000U)
  255. #define SDMMC_OCR_CC_ERROR ((uint32_t)0x00100000U)
  256. #define SDMMC_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000U)
  257. #define SDMMC_OCR_STREAM_READ_UNDERRUN ((uint32_t)0x00040000U)
  258. #define SDMMC_OCR_STREAM_WRITE_OVERRUN ((uint32_t)0x00020000U)
  259. #define SDMMC_OCR_CID_CSD_OVERWRITE ((uint32_t)0x00010000U)
  260. #define SDMMC_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000U)
  261. #define SDMMC_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000U)
  262. #define SDMMC_OCR_ERASE_RESET ((uint32_t)0x00002000U)
  263. #define SDMMC_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008U)
  264. #define SDMMC_OCR_ERRORBITS ((uint32_t)0xFDFFE008U)
  265. /**
  266. * @brief Masks for R6 Response
  267. */
  268. #define SDMMC_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000U)
  269. #define SDMMC_R6_ILLEGAL_CMD ((uint32_t)0x00004000U)
  270. #define SDMMC_R6_COM_CRC_FAILED ((uint32_t)0x00008000U)
  271. #define SDMMC_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000U)
  272. #define SDMMC_HIGH_CAPACITY ((uint32_t)0x40000000U)
  273. #define SDMMC_STD_CAPACITY ((uint32_t)0x00000000U)
  274. #define SDMMC_CHECK_PATTERN ((uint32_t)0x000001AAU)
  275. #define SDMMC_MAX_VOLT_TRIAL ((uint32_t)0x0000FFFFU)
  276. #define SDMMC_MAX_TRIAL ((uint32_t)0x0000FFFFU)
  277. #define SDMMC_ALLZERO ((uint32_t)0x00000000U)
  278. #define SDMMC_WIDE_BUS_SUPPORT ((uint32_t)0x00040000U)
  279. #define SDMMC_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000U)
  280. #define SDMMC_CARD_LOCKED ((uint32_t)0x02000000U)
  281. #define SDMMC_DATATIMEOUT ((uint32_t)0xFFFFFFFFU)
  282. #define SDMMC_0TO7BITS ((uint32_t)0x000000FFU)
  283. #define SDMMC_8TO15BITS ((uint32_t)0x0000FF00U)
  284. #define SDMMC_16TO23BITS ((uint32_t)0x00FF0000U)
  285. #define SDMMC_24TO31BITS ((uint32_t)0xFF000000U)
  286. #define SDMMC_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFFU)
  287. #define SDMMC_HALFFIFO ((uint32_t)0x00000008U)
  288. #define SDMMC_HALFFIFOBYTES ((uint32_t)0x00000020U)
  289. /**
  290. * @brief Command Class supported
  291. */
  292. #define SDMMC_CCCC_ERASE ((uint32_t)0x00000020U)
  293. #define SDMMC_CMDTIMEOUT ((uint32_t)5000U) /* Command send and response timeout */
  294. #define SDMMC_MAXERASETIMEOUT ((uint32_t)63000U) /* Max erase Timeout 63 s */
  295. #define SDMMC_STOPTRANSFERTIMEOUT ((uint32_t)100000000U) /* Timeout for STOP TRANSMISSION command */
  296. /** @defgroup SDMMC_LL_Clock_Edge Clock Edge
  297. * @{
  298. */
  299. #define SDMMC_CLOCK_EDGE_RISING ((uint32_t)0x00000000U)
  300. #define SDMMC_CLOCK_EDGE_FALLING SDMMC_CLKCR_NEGEDGE
  301. #define IS_SDMMC_CLOCK_EDGE(EDGE) (((EDGE) == SDMMC_CLOCK_EDGE_RISING) || \
  302. ((EDGE) == SDMMC_CLOCK_EDGE_FALLING))
  303. /**
  304. * @}
  305. */
  306. /** @defgroup SDMMC_LL_Clock_Bypass Clock Bypass
  307. * @{
  308. */
  309. #define SDMMC_CLOCK_BYPASS_DISABLE ((uint32_t)0x00000000U)
  310. #define SDMMC_CLOCK_BYPASS_ENABLE SDMMC_CLKCR_BYPASS
  311. #define IS_SDMMC_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDMMC_CLOCK_BYPASS_DISABLE) || \
  312. ((BYPASS) == SDMMC_CLOCK_BYPASS_ENABLE))
  313. /**
  314. * @}
  315. */
  316. /** @defgroup SDMMC_LL_Clock_Power_Save Clock Power Saving
  317. * @{
  318. */
  319. #define SDMMC_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000U)
  320. #define SDMMC_CLOCK_POWER_SAVE_ENABLE SDMMC_CLKCR_PWRSAV
  321. #define IS_SDMMC_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDMMC_CLOCK_POWER_SAVE_DISABLE) || \
  322. ((SAVE) == SDMMC_CLOCK_POWER_SAVE_ENABLE))
  323. /**
  324. * @}
  325. */
  326. /** @defgroup SDMMC_LL_Bus_Wide Bus Width
  327. * @{
  328. */
  329. #define SDMMC_BUS_WIDE_1B ((uint32_t)0x00000000U)
  330. #define SDMMC_BUS_WIDE_4B SDMMC_CLKCR_WIDBUS_0
  331. #define SDMMC_BUS_WIDE_8B SDMMC_CLKCR_WIDBUS_1
  332. #define IS_SDMMC_BUS_WIDE(WIDE) (((WIDE) == SDMMC_BUS_WIDE_1B) || \
  333. ((WIDE) == SDMMC_BUS_WIDE_4B) || \
  334. ((WIDE) == SDMMC_BUS_WIDE_8B))
  335. /**
  336. * @}
  337. */
  338. /** @defgroup SDMMC_LL_Hardware_Flow_Control Hardware Flow Control
  339. * @{
  340. */
  341. #define SDMMC_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000U)
  342. #define SDMMC_HARDWARE_FLOW_CONTROL_ENABLE SDMMC_CLKCR_HWFC_EN
  343. #define IS_SDMMC_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_DISABLE) || \
  344. ((CONTROL) == SDMMC_HARDWARE_FLOW_CONTROL_ENABLE))
  345. /**
  346. * @}
  347. */
  348. /** @defgroup SDMMC_LL_Clock_Division Clock Division
  349. * @{
  350. */
  351. #define IS_SDMMC_CLKDIV(DIV) ((DIV) <= 0xFF)
  352. /**
  353. * @}
  354. */
  355. /** @defgroup SDMMC_LL_Command_Index Command Index
  356. * @{
  357. */
  358. #define IS_SDMMC_CMD_INDEX(INDEX) ((INDEX) < 0x40)
  359. /**
  360. * @}
  361. */
  362. /** @defgroup SDMMC_LL_Response_Type Response Type
  363. * @{
  364. */
  365. #define SDMMC_RESPONSE_NO ((uint32_t)0x00000000U)
  366. #define SDMMC_RESPONSE_SHORT SDMMC_CMD_WAITRESP_0
  367. #define SDMMC_RESPONSE_LONG SDMMC_CMD_WAITRESP
  368. #define IS_SDMMC_RESPONSE(RESPONSE) (((RESPONSE) == SDMMC_RESPONSE_NO) || \
  369. ((RESPONSE) == SDMMC_RESPONSE_SHORT) || \
  370. ((RESPONSE) == SDMMC_RESPONSE_LONG))
  371. /**
  372. * @}
  373. */
  374. /** @defgroup SDMMC_LL_Wait_Interrupt_State Wait Interrupt
  375. * @{
  376. */
  377. #define SDMMC_WAIT_NO ((uint32_t)0x00000000U)
  378. #define SDMMC_WAIT_IT SDMMC_CMD_WAITINT
  379. #define SDMMC_WAIT_PEND SDMMC_CMD_WAITPEND
  380. #define IS_SDMMC_WAIT(WAIT) (((WAIT) == SDMMC_WAIT_NO) || \
  381. ((WAIT) == SDMMC_WAIT_IT) || \
  382. ((WAIT) == SDMMC_WAIT_PEND))
  383. /**
  384. * @}
  385. */
  386. /** @defgroup SDMMC_LL_CPSM_State CPSM State
  387. * @{
  388. */
  389. #define SDMMC_CPSM_DISABLE ((uint32_t)0x00000000U)
  390. #define SDMMC_CPSM_ENABLE SDMMC_CMD_CPSMEN
  391. #define IS_SDMMC_CPSM(CPSM) (((CPSM) == SDMMC_CPSM_DISABLE) || \
  392. ((CPSM) == SDMMC_CPSM_ENABLE))
  393. /**
  394. * @}
  395. */
  396. /** @defgroup SDMMC_LL_Response_Registers Response Register
  397. * @{
  398. */
  399. #define SDMMC_RESP1 ((uint32_t)0x00000000U)
  400. #define SDMMC_RESP2 ((uint32_t)0x00000004U)
  401. #define SDMMC_RESP3 ((uint32_t)0x00000008U)
  402. #define SDMMC_RESP4 ((uint32_t)0x0000000CU)
  403. #define IS_SDMMC_RESP(RESP) (((RESP) == SDMMC_RESP1) || \
  404. ((RESP) == SDMMC_RESP2) || \
  405. ((RESP) == SDMMC_RESP3) || \
  406. ((RESP) == SDMMC_RESP4))
  407. /**
  408. * @}
  409. */
  410. /** @defgroup SDMMC_LL_Data_Length Data Lenght
  411. * @{
  412. */
  413. #define IS_SDMMC_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF)
  414. /**
  415. * @}
  416. */
  417. /** @defgroup SDMMC_LL_Data_Block_Size Data Block Size
  418. * @{
  419. */
  420. #define SDMMC_DATABLOCK_SIZE_1B ((uint32_t)0x00000000U)
  421. #define SDMMC_DATABLOCK_SIZE_2B SDMMC_DCTRL_DBLOCKSIZE_0
  422. #define SDMMC_DATABLOCK_SIZE_4B SDMMC_DCTRL_DBLOCKSIZE_1
  423. #define SDMMC_DATABLOCK_SIZE_8B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1)
  424. #define SDMMC_DATABLOCK_SIZE_16B SDMMC_DCTRL_DBLOCKSIZE_2
  425. #define SDMMC_DATABLOCK_SIZE_32B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2)
  426. #define SDMMC_DATABLOCK_SIZE_64B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
  427. #define SDMMC_DATABLOCK_SIZE_128B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2)
  428. #define SDMMC_DATABLOCK_SIZE_256B SDMMC_DCTRL_DBLOCKSIZE_3
  429. #define SDMMC_DATABLOCK_SIZE_512B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_3)
  430. #define SDMMC_DATABLOCK_SIZE_1024B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
  431. #define SDMMC_DATABLOCK_SIZE_2048B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_3)
  432. #define SDMMC_DATABLOCK_SIZE_4096B (SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
  433. #define SDMMC_DATABLOCK_SIZE_8192B (SDMMC_DCTRL_DBLOCKSIZE_0|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
  434. #define SDMMC_DATABLOCK_SIZE_16384B (SDMMC_DCTRL_DBLOCKSIZE_1|SDMMC_DCTRL_DBLOCKSIZE_2|SDMMC_DCTRL_DBLOCKSIZE_3)
  435. #define IS_SDMMC_BLOCK_SIZE(SIZE) (((SIZE) == SDMMC_DATABLOCK_SIZE_1B) || \
  436. ((SIZE) == SDMMC_DATABLOCK_SIZE_2B) || \
  437. ((SIZE) == SDMMC_DATABLOCK_SIZE_4B) || \
  438. ((SIZE) == SDMMC_DATABLOCK_SIZE_8B) || \
  439. ((SIZE) == SDMMC_DATABLOCK_SIZE_16B) || \
  440. ((SIZE) == SDMMC_DATABLOCK_SIZE_32B) || \
  441. ((SIZE) == SDMMC_DATABLOCK_SIZE_64B) || \
  442. ((SIZE) == SDMMC_DATABLOCK_SIZE_128B) || \
  443. ((SIZE) == SDMMC_DATABLOCK_SIZE_256B) || \
  444. ((SIZE) == SDMMC_DATABLOCK_SIZE_512B) || \
  445. ((SIZE) == SDMMC_DATABLOCK_SIZE_1024B) || \
  446. ((SIZE) == SDMMC_DATABLOCK_SIZE_2048B) || \
  447. ((SIZE) == SDMMC_DATABLOCK_SIZE_4096B) || \
  448. ((SIZE) == SDMMC_DATABLOCK_SIZE_8192B) || \
  449. ((SIZE) == SDMMC_DATABLOCK_SIZE_16384B))
  450. /**
  451. * @}
  452. */
  453. /** @defgroup SDMMC_LL_Transfer_Direction Transfer Direction
  454. * @{
  455. */
  456. #define SDMMC_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000U)
  457. #define SDMMC_TRANSFER_DIR_TO_SDMMC SDMMC_DCTRL_DTDIR
  458. #define IS_SDMMC_TRANSFER_DIR(DIR) (((DIR) == SDMMC_TRANSFER_DIR_TO_CARD) || \
  459. ((DIR) == SDMMC_TRANSFER_DIR_TO_SDMMC))
  460. /**
  461. * @}
  462. */
  463. /** @defgroup SDMMC_LL_Transfer_Type Transfer Type
  464. * @{
  465. */
  466. #define SDMMC_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000U)
  467. #define SDMMC_TRANSFER_MODE_STREAM SDMMC_DCTRL_DTMODE
  468. #define IS_SDMMC_TRANSFER_MODE(MODE) (((MODE) == SDMMC_TRANSFER_MODE_BLOCK) || \
  469. ((MODE) == SDMMC_TRANSFER_MODE_STREAM))
  470. /**
  471. * @}
  472. */
  473. /** @defgroup SDMMC_LL_DPSM_State DPSM State
  474. * @{
  475. */
  476. #define SDMMC_DPSM_DISABLE ((uint32_t)0x00000000U)
  477. #define SDMMC_DPSM_ENABLE SDMMC_DCTRL_DTEN
  478. #define IS_SDMMC_DPSM(DPSM) (((DPSM) == SDMMC_DPSM_DISABLE) ||\
  479. ((DPSM) == SDMMC_DPSM_ENABLE))
  480. /**
  481. * @}
  482. */
  483. /** @defgroup SDMMC_LL_Read_Wait_Mode Read Wait Mode
  484. * @{
  485. */
  486. #define SDMMC_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000U)
  487. #define SDMMC_READ_WAIT_MODE_CLK (SDMMC_DCTRL_RWMOD)
  488. #define IS_SDMMC_READWAIT_MODE(MODE) (((MODE) == SDMMC_READ_WAIT_MODE_CLK) || \
  489. ((MODE) == SDMMC_READ_WAIT_MODE_DATA2))
  490. /**
  491. * @}
  492. */
  493. /** @defgroup SDMMC_LL_Interrupt_sources Interrupt Sources
  494. * @{
  495. */
  496. #define SDMMC_IT_CCRCFAIL SDMMC_STA_CCRCFAIL
  497. #define SDMMC_IT_DCRCFAIL SDMMC_STA_DCRCFAIL
  498. #define SDMMC_IT_CTIMEOUT SDMMC_STA_CTIMEOUT
  499. #define SDMMC_IT_DTIMEOUT SDMMC_STA_DTIMEOUT
  500. #define SDMMC_IT_TXUNDERR SDMMC_STA_TXUNDERR
  501. #define SDMMC_IT_RXOVERR SDMMC_STA_RXOVERR
  502. #define SDMMC_IT_CMDREND SDMMC_STA_CMDREND
  503. #define SDMMC_IT_CMDSENT SDMMC_STA_CMDSENT
  504. #define SDMMC_IT_DATAEND SDMMC_STA_DATAEND
  505. #define SDMMC_IT_DBCKEND SDMMC_STA_DBCKEND
  506. #define SDMMC_IT_TXFIFOHE SDMMC_STA_TXFIFOHE
  507. #define SDMMC_IT_RXFIFOHF SDMMC_STA_RXFIFOHF
  508. #define SDMMC_IT_TXFIFOF SDMMC_STA_TXFIFOF
  509. #define SDMMC_IT_RXFIFOF SDMMC_STA_RXFIFOF
  510. #define SDMMC_IT_TXFIFOE SDMMC_STA_TXFIFOE
  511. #define SDMMC_IT_RXFIFOE SDMMC_STA_RXFIFOE
  512. #define SDMMC_IT_SDIOIT SDMMC_STA_SDIOIT
  513. #define SDMMC_IT_CMDACT SDMMC_STA_CMDACT
  514. #define SDMMC_IT_TXACT SDMMC_STA_TXACT
  515. #define SDMMC_IT_RXACT SDMMC_STA_RXACT
  516. #define SDMMC_IT_TXDAVL SDMMC_STA_TXDAVL
  517. #define SDMMC_IT_RXDAVL SDMMC_STA_RXDAVL
  518. /**
  519. * @}
  520. */
  521. /** @defgroup SDMMC_LL_Flags Flags
  522. * @{
  523. */
  524. #define SDMMC_FLAG_CCRCFAIL SDMMC_STA_CCRCFAIL
  525. #define SDMMC_FLAG_DCRCFAIL SDMMC_STA_DCRCFAIL
  526. #define SDMMC_FLAG_CTIMEOUT SDMMC_STA_CTIMEOUT
  527. #define SDMMC_FLAG_DTIMEOUT SDMMC_STA_DTIMEOUT
  528. #define SDMMC_FLAG_TXUNDERR SDMMC_STA_TXUNDERR
  529. #define SDMMC_FLAG_RXOVERR SDMMC_STA_RXOVERR
  530. #define SDMMC_FLAG_CMDREND SDMMC_STA_CMDREND
  531. #define SDMMC_FLAG_CMDSENT SDMMC_STA_CMDSENT
  532. #define SDMMC_FLAG_DATAEND SDMMC_STA_DATAEND
  533. #define SDMMC_FLAG_DBCKEND SDMMC_STA_DBCKEND
  534. #define SDMMC_FLAG_TXFIFOHE SDMMC_STA_TXFIFOHE
  535. #define SDMMC_FLAG_RXFIFOHF SDMMC_STA_RXFIFOHF
  536. #define SDMMC_FLAG_TXFIFOF SDMMC_STA_TXFIFOF
  537. #define SDMMC_FLAG_RXFIFOF SDMMC_STA_RXFIFOF
  538. #define SDMMC_FLAG_TXFIFOE SDMMC_STA_TXFIFOE
  539. #define SDMMC_FLAG_RXFIFOE SDMMC_STA_RXFIFOE
  540. #define SDMMC_FLAG_SDIOIT SDMMC_STA_SDIOIT
  541. #define SDMMC_FLAG_CMDACT SDMMC_STA_CMDACT
  542. #define SDMMC_FLAG_TXACT SDMMC_STA_TXACT
  543. #define SDMMC_FLAG_RXACT SDMMC_STA_RXACT
  544. #define SDMMC_FLAG_TXDAVL SDMMC_STA_TXDAVL
  545. #define SDMMC_FLAG_RXDAVL SDMMC_STA_RXDAVL
  546. #define SDMMC_STATIC_FLAGS ((uint32_t)(SDMMC_FLAG_CCRCFAIL | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_CTIMEOUT |\
  547. SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_TXUNDERR | SDMMC_FLAG_RXOVERR |\
  548. SDMMC_FLAG_CMDREND | SDMMC_FLAG_CMDSENT | SDMMC_FLAG_DATAEND |\
  549. SDMMC_FLAG_DBCKEND))
  550. /**
  551. * @}
  552. */
  553. /**
  554. * @}
  555. */
  556. /* Exported macro ------------------------------------------------------------*/
  557. /** @defgroup SDMMC_LL_Exported_macros SDMMC_LL Exported Macros
  558. * @{
  559. */
  560. /** @defgroup SDMMC_LL_Register Bits And Addresses Definitions
  561. * @brief SDMMC_LL registers bit address in the alias region
  562. * @{
  563. */
  564. /* ---------------------- SDMMC registers bit mask --------------------------- */
  565. /* --- CLKCR Register ---*/
  566. /* CLKCR register clear mask */
  567. #define CLKCR_CLEAR_MASK ((uint32_t)(SDMMC_CLKCR_CLKDIV | SDMMC_CLKCR_PWRSAV |\
  568. SDMMC_CLKCR_BYPASS | SDMMC_CLKCR_WIDBUS |\
  569. SDMMC_CLKCR_NEGEDGE | SDMMC_CLKCR_HWFC_EN))
  570. /* --- DCTRL Register ---*/
  571. /* SDMMC DCTRL Clear Mask */
  572. #define DCTRL_CLEAR_MASK ((uint32_t)(SDMMC_DCTRL_DTEN | SDMMC_DCTRL_DTDIR |\
  573. SDMMC_DCTRL_DTMODE | SDMMC_DCTRL_DBLOCKSIZE))
  574. /* --- CMD Register ---*/
  575. /* CMD Register clear mask */
  576. #define CMD_CLEAR_MASK ((uint32_t)(SDMMC_CMD_CMDINDEX | SDMMC_CMD_WAITRESP |\
  577. SDMMC_CMD_WAITINT | SDMMC_CMD_WAITPEND |\
  578. SDMMC_CMD_CPSMEN | SDMMC_CMD_SDIOSUSPEND))
  579. /* SDMMC Initialization Frequency (400KHz max) */
  580. #define SDMMC_INIT_CLK_DIV ((uint8_t)0x76)
  581. /* SDMMC Data Transfer Frequency (25MHz max) */
  582. #define SDMMC_TRANSFER_CLK_DIV ((uint8_t)0x0)
  583. /**
  584. * @}
  585. */
  586. /** @defgroup SDMMC_LL_Interrupt_Clock Interrupt And Clock Configuration
  587. * @brief macros to handle interrupts and specific clock configurations
  588. * @{
  589. */
  590. /**
  591. * @brief Enable the SDMMC device.
  592. * @param __INSTANCE__: SDMMC Instance
  593. * @retval None
  594. */
  595. #define __SDMMC_ENABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR |= SDMMC_CLKCR_CLKEN)
  596. /**
  597. * @brief Disable the SDMMC device.
  598. * @param __INSTANCE__: SDMMC Instance
  599. * @retval None
  600. */
  601. #define __SDMMC_DISABLE(__INSTANCE__) ((__INSTANCE__)->CLKCR &= ~SDMMC_CLKCR_CLKEN)
  602. /**
  603. * @brief Enable the SDMMC DMA transfer.
  604. * @param __INSTANCE__: SDMMC Instance
  605. * @retval None
  606. */
  607. #define __SDMMC_DMA_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_DMAEN)
  608. /**
  609. * @brief Disable the SDMMC DMA transfer.
  610. * @param __INSTANCE__: SDMMC Instance
  611. * @retval None
  612. */
  613. #define __SDMMC_DMA_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_DMAEN)
  614. /**
  615. * @brief Enable the SDMMC device interrupt.
  616. * @param __INSTANCE__: Pointer to SDMMC register base
  617. * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be enabled.
  618. * This parameter can be one or a combination of the following values:
  619. * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  620. * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  621. * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt
  622. * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt
  623. * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  624. * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt
  625. * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt
  626. * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt
  627. * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  628. * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  629. * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt
  630. * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  631. * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  632. * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt
  633. * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt
  634. * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt
  635. * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt
  636. * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt
  637. * @arg SDMMC_IT_DHOLD: Data transfer Hold interrupt
  638. * @arg SDMMC_IT_DABORT: Data transfer aborted by CMD12 interrupt
  639. * @arg SDMMC_IT_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected interrupt
  640. * @arg SDMMC_IT_ACKFAIL: Boot Acknowledgment received interrupt
  641. * @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
  642. * @arg SDMMC_IT_VSWEND: Voltage switch critical timing section completion interrupt
  643. * @arg SDMMC_IT_CKSTOP: SDMMC_CK stopped in Voltage switch procedure interrupt
  644. * @arg SDMMC_IT_IDMABTC: IDMA buffer transfer complete interrupt
  645. * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt
  646. * @arg SDMMC_IT_RXACT: Data receive in progress interrupt
  647. * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt
  648. * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt
  649. * @retval None
  650. */
  651. #define __SDMMC_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
  652. /**
  653. * @brief Disable the SDMMC device interrupt.
  654. * @param __INSTANCE__: Pointer to SDMMC register base
  655. * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be disabled.
  656. * This parameter can be one or a combination of the following values:
  657. * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  658. * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  659. * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt
  660. * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt
  661. * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  662. * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt
  663. * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt
  664. * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt
  665. * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  666. * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  667. * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt
  668. * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  669. * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  670. * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt
  671. * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt
  672. * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt
  673. * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt
  674. * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt
  675. * @arg SDMMC_IT_DHOLD: Data transfer Hold interrupt
  676. * @arg SDMMC_IT_DABORT: Data transfer aborted by CMD12 interrupt
  677. * @arg SDMMC_IT_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected interrupt
  678. * @arg SDMMC_IT_ACKFAIL: Boot Acknowledgment received interrupt
  679. * @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
  680. * @arg SDMMC_IT_VSWEND: Voltage switch critical timing section completion interrupt
  681. * @arg SDMMC_IT_CKSTOP: SDMMC_CK stopped in Voltage switch procedure interrupt
  682. * @arg SDMMC_IT_IDMABTC: IDMA buffer transfer complete interrupt
  683. * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt
  684. * @arg SDMMC_IT_RXACT: Data receive in progress interrupt
  685. * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt
  686. * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt
  687. * @retval None
  688. */
  689. #define __SDMMC_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
  690. /**
  691. * @brief Checks whether the specified SDMMC flag is set or not.
  692. * @param __INSTANCE__: Pointer to SDMMC register base
  693. * @param __FLAG__: specifies the flag to check.
  694. * This parameter can be one of the following values:
  695. * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed)
  696. * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  697. * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout
  698. * @arg SDMMC_FLAG_DTIMEOUT: Data timeout
  699. * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error
  700. * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error
  701. * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed)
  702. * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required)
  703. * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
  704. * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  705. * @arg SDMMC_FLAG_CMDACT: Command transfer in progress
  706. * @arg SDMMC_FLAG_TXFIFOHE: Transmit FIFO Half Empty
  707. * @arg SDMMC_FLAG_RXFIFOHF: Receive FIFO Half Full
  708. * @arg SDMMC_FLAG_TXFIFOF: Transmit FIFO full
  709. * @arg SDMMC_FLAG_RXFIFOF: Receive FIFO full
  710. * @arg SDMMC_FLAG_TXFIFOE: Transmit FIFO empty
  711. * @arg SDMMC_FLAG_RXFIFOE: Receive FIFO empty
  712. * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received
  713. * @arg SDMMC_FLAG_DHOLD: Data transfer Hold
  714. * @arg SDMMC_FLAG_DABORT: Data transfer aborted by CMD12
  715. * @arg SDMMC_FLAG_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected
  716. * @arg SDMMC_FLAG_ACKFAIL: Boot Acknowledgment received
  717. * @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
  718. * @arg SDMMC_FLAG_VSWEND: Voltage switch critical timing section completion
  719. * @arg SDMMC_FLAG_CKSTOP: SDMMC_CK stopped in Voltage switch procedure
  720. * @arg SDMMC_FLAG_IDMATE: IDMA transfer error
  721. * @arg SDMMC_FLAG_IDMABTC: IDMA buffer transfer complete
  722. * @arg SDMMC_FLAG_TXACT: Data transmit in progress
  723. * @arg SDMMC_FLAG_RXACT: Data receive in progress
  724. * @arg SDMMC_FLAG_TXDAVL: Data available in transmit FIFO
  725. * @arg SDMMC_FLAG_RXDAVL: Data available in receive FIFO
  726. * @retval The new state of SDMMC_FLAG (SET or RESET).
  727. */
  728. #define __SDMMC_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != RESET)
  729. /**
  730. * @brief Clears the SDMMC pending flags.
  731. * @param __INSTANCE__: Pointer to SDMMC register base
  732. * @param __FLAG__: specifies the flag to clear.
  733. * This parameter can be one or a combination of the following values:
  734. * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed)
  735. * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  736. * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout
  737. * @arg SDMMC_FLAG_DTIMEOUT: Data timeout
  738. * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error
  739. * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error
  740. * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed)
  741. * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required)
  742. * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
  743. * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  744. * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received
  745. * @arg SDMMC_FLAG_DHOLD: Data transfer Hold
  746. * @arg SDMMC_FLAG_DABORT: Data transfer aborted by CMD12
  747. * @arg SDMMC_FLAG_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected
  748. * @arg SDMMC_FLAG_ACKFAIL: Boot Acknowledgment received
  749. * @arg SDMMC_FLAG_ACKTIMEOUT: Boot Acknowledgment timeout
  750. * @arg SDMMC_FLAG_VSWEND: Voltage switch critical timing section completion
  751. * @arg SDMMC_FLAG_CKSTOP: SDMMC_CK stopped in Voltage switch procedure
  752. * @arg SDMMC_FLAG_IDMATE: IDMA transfer error
  753. * @arg SDMMC_FLAG_IDMABTC: IDMA buffer transfer complete
  754. * @retval None
  755. */
  756. #define __SDMMC_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
  757. /**
  758. * @brief Checks whether the specified SDMMC interrupt has occurred or not.
  759. * @param __INSTANCE__: Pointer to SDMMC register base
  760. * @param __INTERRUPT__: specifies the SDMMC interrupt source to check.
  761. * This parameter can be one of the following values:
  762. * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  763. * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  764. * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt
  765. * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt
  766. * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  767. * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt
  768. * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt
  769. * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt
  770. * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  771. * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  772. * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt
  773. * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  774. * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  775. * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt
  776. * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt
  777. * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt
  778. * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt
  779. * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt
  780. * @arg SDMMC_IT_DHOLD: Data transfer Hold interrupt
  781. * @arg SDMMC_IT_DABORT: Data transfer aborted by CMD12 interrupt
  782. * @arg SDMMC_IT_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected interrupt
  783. * @arg SDMMC_IT_ACKFAIL: Boot Acknowledgment received interrupt
  784. * @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
  785. * @arg SDMMC_IT_VSWEND: Voltage switch critical timing section completion interrupt
  786. * @arg SDMMC_IT_CKSTOP: SDMMC_CK stopped in Voltage switch procedure interrupt
  787. * @arg SDMMC_IT_IDMABTC: IDMA buffer transfer complete interrupt
  788. * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt
  789. * @arg SDMMC_IT_RXACT: Data receive in progress interrupt
  790. * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt
  791. * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt
  792. * @retval The new state of SDMMC_IT (SET or RESET).
  793. */
  794. #define __SDMMC_GET_IT(__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
  795. /**
  796. * @brief Clears the SDMMC's interrupt pending bits.
  797. * @param __INSTANCE__: Pointer to SDMMC register base
  798. * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
  799. * This parameter can be one or a combination of the following values:
  800. * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  801. * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  802. * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt
  803. * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt
  804. * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  805. * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt
  806. * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt
  807. * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt
  808. * @arg SDMMC_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt
  809. * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt
  810. * @arg SDMMC_IT_DHOLD: Data transfer Hold interrupt
  811. * @arg SDMMC_IT_DABORT: Data transfer aborted by CMD12 interrupt
  812. * @arg SDMMC_IT_BUSYD0END: End of SDMMC_D0 Busy following a CMD response detected interrupt
  813. * @arg SDMMC_IT_ACKFAIL: Boot Acknowledgment received interrupt
  814. * @arg SDMMC_IT_ACKTIMEOUT: Boot Acknowledgment timeout interrupt
  815. * @arg SDMMC_IT_VSWEND: Voltage switch critical timing section completion interrupt
  816. * @arg SDMMC_IT_CKSTOP: SDMMC_CK stopped in Voltage switch procedure interrupt
  817. * @arg SDMMC_IT_IDMABTC: IDMA buffer transfer complete interrupt
  818. * @retval None
  819. */
  820. #define __SDMMC_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
  821. /**
  822. * @brief Enable Start the SD I/O Read Wait operation.
  823. * @param __INSTANCE__: Pointer to SDMMC register base
  824. * @retval None
  825. */
  826. #define __SDMMC_START_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTART)
  827. /**
  828. * @brief Disable Start the SD I/O Read Wait operations.
  829. * @param __INSTANCE__: Pointer to SDMMC register base
  830. * @retval None
  831. */
  832. #define __SDMMC_START_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTART)
  833. /**
  834. * @brief Enable Start the SD I/O Read Wait operation.
  835. * @param __INSTANCE__: Pointer to SDMMC register base
  836. * @retval None
  837. */
  838. #define __SDMMC_STOP_READWAIT_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_RWSTOP)
  839. /**
  840. * @brief Disable Stop the SD I/O Read Wait operations.
  841. * @param __INSTANCE__: Pointer to SDMMC register base
  842. * @retval None
  843. */
  844. #define __SDMMC_STOP_READWAIT_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_RWSTOP)
  845. /**
  846. * @brief Enable the SD I/O Mode Operation.
  847. * @param __INSTANCE__: Pointer to SDMMC register base
  848. * @retval None
  849. */
  850. #define __SDMMC_OPERATION_ENABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL |= SDMMC_DCTRL_SDIOEN)
  851. /**
  852. * @brief Disable the SD I/O Mode Operation.
  853. * @param __INSTANCE__: Pointer to SDMMC register base
  854. * @retval None
  855. */
  856. #define __SDMMC_OPERATION_DISABLE(__INSTANCE__) ((__INSTANCE__)->DCTRL &= ~SDMMC_DCTRL_SDIOEN)
  857. /**
  858. * @brief Enable the SD I/O Suspend command sending.
  859. * @param __INSTANCE__: Pointer to SDMMC register base
  860. * @retval None
  861. */
  862. #define __SDMMC_SUSPEND_CMD_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_SDIOSUSPEND)
  863. /**
  864. * @brief Disable the SD I/O Suspend command sending.
  865. * @param __INSTANCE__: Pointer to SDMMC register base
  866. * @retval None
  867. */
  868. #define __SDMMC_SUSPEND_CMD_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_SDIOSUSPEND)
  869. /**
  870. * @brief Enable the CMDTRANS mode.
  871. * @param __INSTANCE__ : Pointer to SDMMC register base
  872. * @retval None
  873. */
  874. #define __SDMMC_CMDTRANS_ENABLE(__INSTANCE__) ((__INSTANCE__)->CMD |= SDMMC_CMD_CMDTRANS)
  875. /**
  876. * @brief Disable the CMDTRANS mode.
  877. * @param __INSTANCE__ : Pointer to SDMMC register base
  878. * @retval None
  879. */
  880. #define __SDMMC_CMDTRANS_DISABLE(__INSTANCE__) ((__INSTANCE__)->CMD &= ~SDMMC_CMD_CMDTRANS)
  881. /**
  882. * @}
  883. */
  884. /**
  885. * @}
  886. */
  887. /* Exported functions --------------------------------------------------------*/
  888. /** @addtogroup SDMMC_LL_Exported_Functions
  889. * @{
  890. */
  891. /* Initialization/de-initialization functions **********************************/
  892. /** @addtogroup HAL_SDMMC_LL_Group1
  893. * @{
  894. */
  895. HAL_StatusTypeDef SDMMC_Init(SDMMC_TypeDef *SDMMCx, SDMMC_InitTypeDef Init);
  896. /**
  897. * @}
  898. */
  899. /* I/O operation functions *****************************************************/
  900. /** @addtogroup HAL_SDMMC_LL_Group2
  901. * @{
  902. */
  903. uint32_t SDMMC_ReadFIFO(SDMMC_TypeDef *SDMMCx);
  904. HAL_StatusTypeDef SDMMC_WriteFIFO(SDMMC_TypeDef *SDMMCx, uint32_t *pWriteData);
  905. /**
  906. * @}
  907. */
  908. /* Peripheral Control functions ************************************************/
  909. /** @addtogroup HAL_SDMMC_LL_Group3
  910. * @{
  911. */
  912. HAL_StatusTypeDef SDMMC_PowerState_ON(SDMMC_TypeDef *SDMMCx);
  913. HAL_StatusTypeDef SDMMC_PowerState_OFF(SDMMC_TypeDef *SDMMCx);
  914. uint32_t SDMMC_GetPowerState(SDMMC_TypeDef *SDMMCx);
  915. /* Command path state machine (CPSM) management functions */
  916. HAL_StatusTypeDef SDMMC_SendCommand(SDMMC_TypeDef *SDMMCx, SDMMC_CmdInitTypeDef *Command);
  917. uint8_t SDMMC_GetCommandResponse(SDMMC_TypeDef *SDMMCx);
  918. uint32_t SDMMC_GetResponse(SDMMC_TypeDef *SDMMCx, uint32_t Response);
  919. /* Data path state machine (DPSM) management functions */
  920. HAL_StatusTypeDef SDMMC_ConfigData(SDMMC_TypeDef *SDMMCx, SDMMC_DataInitTypeDef* Data);
  921. uint32_t SDMMC_GetDataCounter(SDMMC_TypeDef *SDMMCx);
  922. uint32_t SDMMC_GetFIFOCount(SDMMC_TypeDef *SDMMCx);
  923. /* SDMMC Cards mode management functions */
  924. HAL_StatusTypeDef SDMMC_SetSDMMCReadWaitMode(SDMMC_TypeDef *SDMMCx, uint32_t SDMMC_ReadWaitMode);
  925. /* SDMMC Commands management functions */
  926. uint32_t SDMMC_CmdBlockLength(SDMMC_TypeDef *SDMMCx, uint32_t BlockSize);
  927. uint32_t SDMMC_CmdReadSingleBlock(SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
  928. uint32_t SDMMC_CmdReadMultiBlock(SDMMC_TypeDef *SDMMCx, uint32_t ReadAdd);
  929. uint32_t SDMMC_CmdWriteSingleBlock(SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
  930. uint32_t SDMMC_CmdWriteMultiBlock(SDMMC_TypeDef *SDMMCx, uint32_t WriteAdd);
  931. uint32_t SDMMC_CmdEraseStartAdd(SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
  932. uint32_t SDMMC_CmdSDEraseStartAdd(SDMMC_TypeDef *SDMMCx, uint32_t StartAdd);
  933. uint32_t SDMMC_CmdEraseEndAdd(SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
  934. uint32_t SDMMC_CmdSDEraseEndAdd(SDMMC_TypeDef *SDMMCx, uint32_t EndAdd);
  935. uint32_t SDMMC_CmdErase(SDMMC_TypeDef *SDMMCx);
  936. uint32_t SDMMC_CmdStopTransfer(SDMMC_TypeDef *SDMMCx);
  937. uint32_t SDMMC_CmdSelDesel(SDMMC_TypeDef *SDMMCx, uint64_t Addr);
  938. uint32_t SDMMC_CmdGoIdleState(SDMMC_TypeDef *SDMMCx);
  939. uint32_t SDMMC_CmdOperCond(SDMMC_TypeDef *SDMMCx);
  940. uint32_t SDMMC_CmdAppCommand(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  941. uint32_t SDMMC_CmdAppOperCommand(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  942. uint32_t SDMMC_CmdBusWidth(SDMMC_TypeDef *SDMMCx, uint32_t BusWidth);
  943. uint32_t SDMMC_CmdSendSCR(SDMMC_TypeDef *SDMMCx);
  944. uint32_t SDMMC_CmdSendCID(SDMMC_TypeDef *SDMMCx);
  945. uint32_t SDMMC_CmdSendCSD(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  946. uint32_t SDMMC_CmdSetRelAdd(SDMMC_TypeDef *SDMMCx, uint16_t *pRCA);
  947. uint32_t SDMMC_CmdSendStatus(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  948. uint32_t SDMMC_CmdStatusRegister(SDMMC_TypeDef *SDMMCx);
  949. uint32_t SDMMC_CmdOpCondition(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  950. uint32_t SDMMC_CmdSwitch(SDMMC_TypeDef *SDMMCx, uint32_t Argument);
  951. /**
  952. * @}
  953. */
  954. /**
  955. * @}
  956. */
  957. /**
  958. * @}
  959. */
  960. /**
  961. * @}
  962. */
  963. #endif /* SDMMC1 */
  964. #ifdef __cplusplus
  965. }
  966. #endif
  967. #endif /* __STM32L4xx_LL_SDMMC_H */
  968. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/