stm32f4xx_ll_sdmmc.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_ll_sdmmc.h
  4. * @author MCD Application Team
  5. * @version V1.6.0
  6. * @date 04-November-2016
  7. * @brief Header file of SDMMC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM32F4xx_LL_SDMMC_H
  39. #define __STM32F4xx_LL_SDMMC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
  44. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
  45. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
  46. defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
  47. defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  48. /* Includes ------------------------------------------------------------------*/
  49. #include "stm32f4xx_hal_def.h"
  50. /** @addtogroup STM32F4xx_Driver
  51. * @{
  52. */
  53. /** @addtogroup SDMMC_LL
  54. * @{
  55. */
  56. /* Exported types ------------------------------------------------------------*/
  57. /** @defgroup SDMMC_LL_Exported_Types SDMMC_LL Exported Types
  58. * @{
  59. */
  60. /**
  61. * @brief SDMMC Configuration Structure definition
  62. */
  63. typedef struct
  64. {
  65. uint32_t ClockEdge; /*!< Specifies the clock transition on which the bit capture is made.
  66. This parameter can be a value of @ref SDIO_Clock_Edge */
  67. uint32_t ClockBypass; /*!< Specifies whether the SDIO Clock divider bypass is
  68. enabled or disabled.
  69. This parameter can be a value of @ref SDIO_Clock_Bypass */
  70. uint32_t ClockPowerSave; /*!< Specifies whether SDIO Clock output is enabled or
  71. disabled when the bus is idle.
  72. This parameter can be a value of @ref SDIO_Clock_Power_Save */
  73. uint32_t BusWide; /*!< Specifies the SDIO bus width.
  74. This parameter can be a value of @ref SDIO_Bus_Wide */
  75. uint32_t HardwareFlowControl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled.
  76. This parameter can be a value of @ref SDIO_Hardware_Flow_Control */
  77. uint32_t ClockDiv; /*!< Specifies the clock frequency of the SDIO controller.
  78. This parameter can be a value between Min_Data = 0 and Max_Data = 255 */
  79. }SDIO_InitTypeDef;
  80. /**
  81. * @brief SDIO Command Control structure
  82. */
  83. typedef struct
  84. {
  85. uint32_t Argument; /*!< Specifies the SDIO command argument which is sent
  86. to a card as part of a command message. If a command
  87. contains an argument, it must be loaded into this register
  88. before writing the command to the command register. */
  89. uint32_t CmdIndex; /*!< Specifies the SDIO command index. It must be Min_Data = 0 and
  90. Max_Data = 64 */
  91. uint32_t Response; /*!< Specifies the SDIO response type.
  92. This parameter can be a value of @ref SDIO_Response_Type */
  93. uint32_t WaitForInterrupt; /*!< Specifies whether SDIO wait for interrupt request is
  94. enabled or disabled.
  95. This parameter can be a value of @ref SDIO_Wait_Interrupt_State */
  96. uint32_t CPSM; /*!< Specifies whether SDIO Command path state machine (CPSM)
  97. is enabled or disabled.
  98. This parameter can be a value of @ref SDIO_CPSM_State */
  99. }SDIO_CmdInitTypeDef;
  100. /**
  101. * @brief SDIO Data Control structure
  102. */
  103. typedef struct
  104. {
  105. uint32_t DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
  106. uint32_t DataLength; /*!< Specifies the number of data bytes to be transferred. */
  107. uint32_t DataBlockSize; /*!< Specifies the data block size for block transfer.
  108. This parameter can be a value of @ref SDIO_Data_Block_Size */
  109. uint32_t TransferDir; /*!< Specifies the data transfer direction, whether the transfer
  110. is a read or write.
  111. This parameter can be a value of @ref SDIO_Transfer_Direction */
  112. uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
  113. This parameter can be a value of @ref SDIO_Transfer_Type */
  114. uint32_t DPSM; /*!< Specifies whether SDIO Data path state machine (DPSM)
  115. is enabled or disabled.
  116. This parameter can be a value of @ref SDIO_DPSM_State */
  117. }SDIO_DataInitTypeDef;
  118. /**
  119. * @}
  120. */
  121. /* Exported constants --------------------------------------------------------*/
  122. /** @defgroup SDMMC_LL_Exported_Constants SDMMC_LL Exported Constants
  123. * @{
  124. */
  125. /** @defgroup SDIO_Clock_Edge Clock Edge
  126. * @{
  127. */
  128. #define SDIO_CLOCK_EDGE_RISING ((uint32_t)0x00000000U)
  129. #define SDIO_CLOCK_EDGE_FALLING SDIO_CLKCR_NEGEDGE
  130. #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_CLOCK_EDGE_RISING) || \
  131. ((EDGE) == SDIO_CLOCK_EDGE_FALLING))
  132. /**
  133. * @}
  134. */
  135. /** @defgroup SDIO_Clock_Bypass Clock Bypass
  136. * @{
  137. */
  138. #define SDIO_CLOCK_BYPASS_DISABLE ((uint32_t)0x00000000U)
  139. #define SDIO_CLOCK_BYPASS_ENABLE SDIO_CLKCR_BYPASS
  140. #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_CLOCK_BYPASS_DISABLE) || \
  141. ((BYPASS) == SDIO_CLOCK_BYPASS_ENABLE))
  142. /**
  143. * @}
  144. */
  145. /** @defgroup SDIO_Clock_Power_Save Clock Power Saving
  146. * @{
  147. */
  148. #define SDIO_CLOCK_POWER_SAVE_DISABLE ((uint32_t)0x00000000U)
  149. #define SDIO_CLOCK_POWER_SAVE_ENABLE SDIO_CLKCR_PWRSAV
  150. #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_CLOCK_POWER_SAVE_DISABLE) || \
  151. ((SAVE) == SDIO_CLOCK_POWER_SAVE_ENABLE))
  152. /**
  153. * @}
  154. */
  155. /** @defgroup SDIO_Bus_Wide Bus Width
  156. * @{
  157. */
  158. #define SDIO_BUS_WIDE_1B ((uint32_t)0x00000000U)
  159. #define SDIO_BUS_WIDE_4B SDIO_CLKCR_WIDBUS_0
  160. #define SDIO_BUS_WIDE_8B SDIO_CLKCR_WIDBUS_1
  161. #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BUS_WIDE_1B) || \
  162. ((WIDE) == SDIO_BUS_WIDE_4B) || \
  163. ((WIDE) == SDIO_BUS_WIDE_8B))
  164. /**
  165. * @}
  166. */
  167. /** @defgroup SDIO_Hardware_Flow_Control Hardware Flow Control
  168. * @{
  169. */
  170. #define SDIO_HARDWARE_FLOW_CONTROL_DISABLE ((uint32_t)0x00000000U)
  171. #define SDIO_HARDWARE_FLOW_CONTROL_ENABLE SDIO_CLKCR_HWFC_EN
  172. #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_DISABLE) || \
  173. ((CONTROL) == SDIO_HARDWARE_FLOW_CONTROL_ENABLE))
  174. /**
  175. * @}
  176. */
  177. /** @defgroup SDIO_Clock_Division Clock Division
  178. * @{
  179. */
  180. #define IS_SDIO_CLKDIV(DIV) ((DIV) <= 0xFFU)
  181. /**
  182. * @}
  183. */
  184. /** @defgroup SDIO_Command_Index Command Index
  185. * @{
  186. */
  187. #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40U)
  188. /**
  189. * @}
  190. */
  191. /** @defgroup SDIO_Response_Type Response Type
  192. * @{
  193. */
  194. #define SDIO_RESPONSE_NO ((uint32_t)0x00000000U)
  195. #define SDIO_RESPONSE_SHORT SDIO_CMD_WAITRESP_0
  196. #define SDIO_RESPONSE_LONG SDIO_CMD_WAITRESP
  197. #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_RESPONSE_NO) || \
  198. ((RESPONSE) == SDIO_RESPONSE_SHORT) || \
  199. ((RESPONSE) == SDIO_RESPONSE_LONG))
  200. /**
  201. * @}
  202. */
  203. /** @defgroup SDIO_Wait_Interrupt_State Wait Interrupt
  204. * @{
  205. */
  206. #define SDIO_WAIT_NO ((uint32_t)0x00000000U)
  207. #define SDIO_WAIT_IT SDIO_CMD_WAITINT
  208. #define SDIO_WAIT_PEND SDIO_CMD_WAITPEND
  209. #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_WAIT_NO) || \
  210. ((WAIT) == SDIO_WAIT_IT) || \
  211. ((WAIT) == SDIO_WAIT_PEND))
  212. /**
  213. * @}
  214. */
  215. /** @defgroup SDIO_CPSM_State CPSM State
  216. * @{
  217. */
  218. #define SDIO_CPSM_DISABLE ((uint32_t)0x00000000U)
  219. #define SDIO_CPSM_ENABLE SDIO_CMD_CPSMEN
  220. #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_DISABLE) || \
  221. ((CPSM) == SDIO_CPSM_ENABLE))
  222. /**
  223. * @}
  224. */
  225. /** @defgroup SDIO_Response_Registers Response Register
  226. * @{
  227. */
  228. #define SDIO_RESP1 ((uint32_t)0x00000000U)
  229. #define SDIO_RESP2 ((uint32_t)0x00000004U)
  230. #define SDIO_RESP3 ((uint32_t)0x00000008U)
  231. #define SDIO_RESP4 ((uint32_t)0x0000000CU)
  232. #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || \
  233. ((RESP) == SDIO_RESP2) || \
  234. ((RESP) == SDIO_RESP3) || \
  235. ((RESP) == SDIO_RESP4))
  236. /**
  237. * @}
  238. */
  239. /** @defgroup SDIO_Data_Length Data Lenght
  240. * @{
  241. */
  242. #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFFU)
  243. /**
  244. * @}
  245. */
  246. /** @defgroup SDIO_Data_Block_Size Data Block Size
  247. * @{
  248. */
  249. #define SDIO_DATABLOCK_SIZE_1B ((uint32_t)0x00000000U)
  250. #define SDIO_DATABLOCK_SIZE_2B SDIO_DCTRL_DBLOCKSIZE_0
  251. #define SDIO_DATABLOCK_SIZE_4B SDIO_DCTRL_DBLOCKSIZE_1
  252. #define SDIO_DATABLOCK_SIZE_8B ((uint32_t)0x00000030U)
  253. #define SDIO_DATABLOCK_SIZE_16B SDIO_DCTRL_DBLOCKSIZE_2
  254. #define SDIO_DATABLOCK_SIZE_32B ((uint32_t)0x00000050U)
  255. #define SDIO_DATABLOCK_SIZE_64B ((uint32_t)0x00000060U)
  256. #define SDIO_DATABLOCK_SIZE_128B ((uint32_t)0x00000070U)
  257. #define SDIO_DATABLOCK_SIZE_256B SDIO_DCTRL_DBLOCKSIZE_3
  258. #define SDIO_DATABLOCK_SIZE_512B ((uint32_t)0x00000090U)
  259. #define SDIO_DATABLOCK_SIZE_1024B ((uint32_t)0x000000A0U)
  260. #define SDIO_DATABLOCK_SIZE_2048B ((uint32_t)0x000000B0U)
  261. #define SDIO_DATABLOCK_SIZE_4096B ((uint32_t)0x000000C0U)
  262. #define SDIO_DATABLOCK_SIZE_8192B ((uint32_t)0x000000D0U)
  263. #define SDIO_DATABLOCK_SIZE_16384B ((uint32_t)0x000000E0U)
  264. #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DATABLOCK_SIZE_1B) || \
  265. ((SIZE) == SDIO_DATABLOCK_SIZE_2B) || \
  266. ((SIZE) == SDIO_DATABLOCK_SIZE_4B) || \
  267. ((SIZE) == SDIO_DATABLOCK_SIZE_8B) || \
  268. ((SIZE) == SDIO_DATABLOCK_SIZE_16B) || \
  269. ((SIZE) == SDIO_DATABLOCK_SIZE_32B) || \
  270. ((SIZE) == SDIO_DATABLOCK_SIZE_64B) || \
  271. ((SIZE) == SDIO_DATABLOCK_SIZE_128B) || \
  272. ((SIZE) == SDIO_DATABLOCK_SIZE_256B) || \
  273. ((SIZE) == SDIO_DATABLOCK_SIZE_512B) || \
  274. ((SIZE) == SDIO_DATABLOCK_SIZE_1024B) || \
  275. ((SIZE) == SDIO_DATABLOCK_SIZE_2048B) || \
  276. ((SIZE) == SDIO_DATABLOCK_SIZE_4096B) || \
  277. ((SIZE) == SDIO_DATABLOCK_SIZE_8192B) || \
  278. ((SIZE) == SDIO_DATABLOCK_SIZE_16384B))
  279. /**
  280. * @}
  281. */
  282. /** @defgroup SDIO_Transfer_Direction Transfer Direction
  283. * @{
  284. */
  285. #define SDIO_TRANSFER_DIR_TO_CARD ((uint32_t)0x00000000U)
  286. #define SDIO_TRANSFER_DIR_TO_SDIO SDIO_DCTRL_DTDIR
  287. #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TRANSFER_DIR_TO_CARD) || \
  288. ((DIR) == SDIO_TRANSFER_DIR_TO_SDIO))
  289. /**
  290. * @}
  291. */
  292. /** @defgroup SDIO_Transfer_Type Transfer Type
  293. * @{
  294. */
  295. #define SDIO_TRANSFER_MODE_BLOCK ((uint32_t)0x00000000U)
  296. #define SDIO_TRANSFER_MODE_STREAM SDIO_DCTRL_DTMODE
  297. #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TRANSFER_MODE_BLOCK) || \
  298. ((MODE) == SDIO_TRANSFER_MODE_STREAM))
  299. /**
  300. * @}
  301. */
  302. /** @defgroup SDIO_DPSM_State DPSM State
  303. * @{
  304. */
  305. #define SDIO_DPSM_DISABLE ((uint32_t)0x00000000U)
  306. #define SDIO_DPSM_ENABLE SDIO_DCTRL_DTEN
  307. #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_DISABLE) ||\
  308. ((DPSM) == SDIO_DPSM_ENABLE))
  309. /**
  310. * @}
  311. */
  312. /** @defgroup SDIO_Read_Wait_Mode Read Wait Mode
  313. * @{
  314. */
  315. #define SDIO_READ_WAIT_MODE_DATA2 ((uint32_t)0x00000000U)
  316. #define SDIO_READ_WAIT_MODE_CLK ((uint32_t)0x00000001U)
  317. #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_READ_WAIT_MODE_CLK) || \
  318. ((MODE) == SDIO_READ_WAIT_MODE_DATA2))
  319. /**
  320. * @}
  321. */
  322. /** @defgroup SDIO_Interrupt_sources Interrupt Sources
  323. * @{
  324. */
  325. #define SDIO_IT_CCRCFAIL SDIO_STA_CCRCFAIL
  326. #define SDIO_IT_DCRCFAIL SDIO_STA_DCRCFAIL
  327. #define SDIO_IT_CTIMEOUT SDIO_STA_CTIMEOUT
  328. #define SDIO_IT_DTIMEOUT SDIO_STA_DTIMEOUT
  329. #define SDIO_IT_TXUNDERR SDIO_STA_TXUNDERR
  330. #define SDIO_IT_RXOVERR SDIO_STA_RXOVERR
  331. #define SDIO_IT_CMDREND SDIO_STA_CMDREND
  332. #define SDIO_IT_CMDSENT SDIO_STA_CMDSENT
  333. #define SDIO_IT_DATAEND SDIO_STA_DATAEND
  334. #define SDIO_IT_STBITERR SDIO_STA_STBITERR
  335. #define SDIO_IT_DBCKEND SDIO_STA_DBCKEND
  336. #define SDIO_IT_CMDACT SDIO_STA_CMDACT
  337. #define SDIO_IT_TXACT SDIO_STA_TXACT
  338. #define SDIO_IT_RXACT SDIO_STA_RXACT
  339. #define SDIO_IT_TXFIFOHE SDIO_STA_TXFIFOHE
  340. #define SDIO_IT_RXFIFOHF SDIO_STA_RXFIFOHF
  341. #define SDIO_IT_TXFIFOF SDIO_STA_TXFIFOF
  342. #define SDIO_IT_RXFIFOF SDIO_STA_RXFIFOF
  343. #define SDIO_IT_TXFIFOE SDIO_STA_TXFIFOE
  344. #define SDIO_IT_RXFIFOE SDIO_STA_RXFIFOE
  345. #define SDIO_IT_TXDAVL SDIO_STA_TXDAVL
  346. #define SDIO_IT_RXDAVL SDIO_STA_RXDAVL
  347. #define SDIO_IT_SDIOIT SDIO_STA_SDIOIT
  348. #define SDIO_IT_CEATAEND SDIO_STA_CEATAEND
  349. /**
  350. * @}
  351. */
  352. /** @defgroup SDIO_Flags Flags
  353. * @{
  354. */
  355. #define SDIO_FLAG_CCRCFAIL SDIO_STA_CCRCFAIL
  356. #define SDIO_FLAG_DCRCFAIL SDIO_STA_DCRCFAIL
  357. #define SDIO_FLAG_CTIMEOUT SDIO_STA_CTIMEOUT
  358. #define SDIO_FLAG_DTIMEOUT SDIO_STA_DTIMEOUT
  359. #define SDIO_FLAG_TXUNDERR SDIO_STA_TXUNDERR
  360. #define SDIO_FLAG_RXOVERR SDIO_STA_RXOVERR
  361. #define SDIO_FLAG_CMDREND SDIO_STA_CMDREND
  362. #define SDIO_FLAG_CMDSENT SDIO_STA_CMDSENT
  363. #define SDIO_FLAG_DATAEND SDIO_STA_DATAEND
  364. #define SDIO_FLAG_STBITERR SDIO_STA_STBITERR
  365. #define SDIO_FLAG_DBCKEND SDIO_STA_DBCKEND
  366. #define SDIO_FLAG_CMDACT SDIO_STA_CMDACT
  367. #define SDIO_FLAG_TXACT SDIO_STA_TXACT
  368. #define SDIO_FLAG_RXACT SDIO_STA_RXACT
  369. #define SDIO_FLAG_TXFIFOHE SDIO_STA_TXFIFOHE
  370. #define SDIO_FLAG_RXFIFOHF SDIO_STA_RXFIFOHF
  371. #define SDIO_FLAG_TXFIFOF SDIO_STA_TXFIFOF
  372. #define SDIO_FLAG_RXFIFOF SDIO_STA_RXFIFOF
  373. #define SDIO_FLAG_TXFIFOE SDIO_STA_TXFIFOE
  374. #define SDIO_FLAG_RXFIFOE SDIO_STA_RXFIFOE
  375. #define SDIO_FLAG_TXDAVL SDIO_STA_TXDAVL
  376. #define SDIO_FLAG_RXDAVL SDIO_STA_RXDAVL
  377. #define SDIO_FLAG_SDIOIT SDIO_STA_SDIOIT
  378. #define SDIO_FLAG_CEATAEND SDIO_STA_CEATAEND
  379. /**
  380. * @}
  381. */
  382. /**
  383. * @}
  384. */
  385. /* Exported macro ------------------------------------------------------------*/
  386. /** @defgroup SDMMC_LL_Exported_macros SDMMC_LL Exported Macros
  387. * @{
  388. */
  389. /** @defgroup SDMMC_LL_Alias_Region Bit Address in the alias region
  390. * @{
  391. */
  392. /* ------------ SDIO registers bit address in the alias region -------------- */
  393. #define SDIO_OFFSET (SDIO_BASE - PERIPH_BASE)
  394. /* --- CLKCR Register ---*/
  395. /* Alias word address of CLKEN bit */
  396. #define CLKCR_OFFSET (SDIO_OFFSET + 0x04U)
  397. #define CLKEN_BITNUMBER 0x08U
  398. #define CLKCR_CLKEN_BB (PERIPH_BB_BASE + (CLKCR_OFFSET * 32U) + (CLKEN_BITNUMBER * 4U))
  399. /* --- CMD Register ---*/
  400. /* Alias word address of SDIOSUSPEND bit */
  401. #define CMD_OFFSET (SDIO_OFFSET + 0x0CU)
  402. #define SDIOSUSPEND_BITNUMBER 0x0BU
  403. #define CMD_SDIOSUSPEND_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (SDIOSUSPEND_BITNUMBER * 4U))
  404. /* Alias word address of ENCMDCOMPL bit */
  405. #define ENCMDCOMPL_BITNUMBER 0x0CU
  406. #define CMD_ENCMDCOMPL_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (ENCMDCOMPL_BITNUMBER * 4U))
  407. /* Alias word address of NIEN bit */
  408. #define NIEN_BITNUMBER 0x0DU
  409. #define CMD_NIEN_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (NIEN_BITNUMBER * 4U))
  410. /* Alias word address of ATACMD bit */
  411. #define ATACMD_BITNUMBER 0x0EU
  412. #define CMD_ATACMD_BB (PERIPH_BB_BASE + (CMD_OFFSET * 32U) + (ATACMD_BITNUMBER * 4U))
  413. /* --- DCTRL Register ---*/
  414. /* Alias word address of DMAEN bit */
  415. #define DCTRL_OFFSET (SDIO_OFFSET + 0x2CU)
  416. #define DMAEN_BITNUMBER 0x03U
  417. #define DCTRL_DMAEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (DMAEN_BITNUMBER * 4U))
  418. /* Alias word address of RWSTART bit */
  419. #define RWSTART_BITNUMBER 0x08U
  420. #define DCTRL_RWSTART_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWSTART_BITNUMBER * 4U))
  421. /* Alias word address of RWSTOP bit */
  422. #define RWSTOP_BITNUMBER 0x09U
  423. #define DCTRL_RWSTOP_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWSTOP_BITNUMBER * 4U))
  424. /* Alias word address of RWMOD bit */
  425. #define RWMOD_BITNUMBER 0x0AU
  426. #define DCTRL_RWMOD_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (RWMOD_BITNUMBER * 4U))
  427. /* Alias word address of SDIOEN bit */
  428. #define SDIOEN_BITNUMBER 0x0BU
  429. #define DCTRL_SDIOEN_BB (PERIPH_BB_BASE + (DCTRL_OFFSET * 32U) + (SDIOEN_BITNUMBER * 4U))
  430. /**
  431. * @}
  432. */
  433. /** @defgroup SDMMC_LL_Register Bits And Addresses Definitions
  434. * @brief SDMMC_LL registers bit address in the alias region
  435. * @{
  436. */
  437. /* ---------------------- SDIO registers bit mask --------------------------- */
  438. /* --- CLKCR Register ---*/
  439. /* CLKCR register clear mask */
  440. #define CLKCR_CLEAR_MASK ((uint32_t)(SDIO_CLKCR_CLKDIV | SDIO_CLKCR_PWRSAV |\
  441. SDIO_CLKCR_BYPASS | SDIO_CLKCR_WIDBUS |\
  442. SDIO_CLKCR_NEGEDGE | SDIO_CLKCR_HWFC_EN))
  443. /* --- PWRCTRL Register ---*/
  444. /* --- DCTRL Register ---*/
  445. /* SDIO DCTRL Clear Mask */
  446. #define DCTRL_CLEAR_MASK ((uint32_t)(SDIO_DCTRL_DTEN | SDIO_DCTRL_DTDIR |\
  447. SDIO_DCTRL_DTMODE | SDIO_DCTRL_DBLOCKSIZE))
  448. /* --- CMD Register ---*/
  449. /* CMD Register clear mask */
  450. #define CMD_CLEAR_MASK ((uint32_t)(SDIO_CMD_CMDINDEX | SDIO_CMD_WAITRESP |\
  451. SDIO_CMD_WAITINT | SDIO_CMD_WAITPEND |\
  452. SDIO_CMD_CPSMEN | SDIO_CMD_SDIOSUSPEND))
  453. /* SDIO RESP Registers Address */
  454. #define SDIO_RESP_ADDR ((uint32_t)(SDIO_BASE + 0x14U))
  455. /* SDIO Initialization Frequency (400KHz max) */
  456. #define SDIO_INIT_CLK_DIV ((uint8_t)0x76U)
  457. /* SDIO Data Transfer Frequency (25MHz max) */
  458. #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x00U)
  459. /**
  460. * @}
  461. */
  462. /** @defgroup SDMMC_LL_Interrupt_Clock Interrupt And Clock Configuration
  463. * @brief macros to handle interrupts and specific clock configurations
  464. * @{
  465. */
  466. /**
  467. * @brief Enable the SDIO device.
  468. * @retval None
  469. */
  470. #define __SDIO_ENABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = ENABLE)
  471. /**
  472. * @brief Disable the SDIO device.
  473. * @retval None
  474. */
  475. #define __SDIO_DISABLE() (*(__IO uint32_t *)CLKCR_CLKEN_BB = DISABLE)
  476. /**
  477. * @brief Enable the SDIO DMA transfer.
  478. * @retval None
  479. */
  480. #define __SDIO_DMA_ENABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = ENABLE)
  481. /**
  482. * @brief Disable the SDIO DMA transfer.
  483. * @retval None
  484. */
  485. #define __SDIO_DMA_DISABLE() (*(__IO uint32_t *)DCTRL_DMAEN_BB = DISABLE)
  486. /**
  487. * @brief Enable the SDIO device interrupt.
  488. * @param __INSTANCE__ : Pointer to SDIO register base
  489. * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be enabled.
  490. * This parameter can be one or a combination of the following values:
  491. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  492. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  493. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  494. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  495. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  496. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  497. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  498. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  499. * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  500. * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
  501. * bus mode interrupt
  502. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  503. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  504. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  505. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  506. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  507. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  508. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  509. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  510. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  511. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  512. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  513. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  514. * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
  515. * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
  516. * @retval None
  517. */
  518. #define __SDIO_ENABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK |= (__INTERRUPT__))
  519. /**
  520. * @brief Disable the SDIO device interrupt.
  521. * @param __INSTANCE__ : Pointer to SDIO register base
  522. * @param __INTERRUPT__ : specifies the SDIO interrupt sources to be disabled.
  523. * This parameter can be one or a combination of the following values:
  524. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  525. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  526. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  527. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  528. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  529. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  530. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  531. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  532. * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  533. * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
  534. * bus mode interrupt
  535. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  536. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  537. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  538. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  539. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  540. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  541. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  542. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  543. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  544. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  545. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  546. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  547. * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
  548. * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
  549. * @retval None
  550. */
  551. #define __SDIO_DISABLE_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->MASK &= ~(__INTERRUPT__))
  552. /**
  553. * @brief Checks whether the specified SDIO flag is set or not.
  554. * @param __INSTANCE__ : Pointer to SDIO register base
  555. * @param __FLAG__: specifies the flag to check.
  556. * This parameter can be one of the following values:
  557. * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
  558. * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  559. * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
  560. * @arg SDIO_FLAG_DTIMEOUT: Data timeout
  561. * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
  562. * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
  563. * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
  564. * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
  565. * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
  566. * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode.
  567. * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  568. * @arg SDIO_FLAG_CMDACT: Command transfer in progress
  569. * @arg SDIO_FLAG_TXACT: Data transmit in progress
  570. * @arg SDIO_FLAG_RXACT: Data receive in progress
  571. * @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty
  572. * @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full
  573. * @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full
  574. * @arg SDIO_FLAG_RXFIFOF: Receive FIFO full
  575. * @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty
  576. * @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty
  577. * @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO
  578. * @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO
  579. * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
  580. * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61
  581. * @retval The new state of SDIO_FLAG (SET or RESET).
  582. */
  583. #define __SDIO_GET_FLAG(__INSTANCE__, __FLAG__) (((__INSTANCE__)->STA &(__FLAG__)) != RESET)
  584. /**
  585. * @brief Clears the SDIO pending flags.
  586. * @param __INSTANCE__ : Pointer to SDIO register base
  587. * @param __FLAG__: specifies the flag to clear.
  588. * This parameter can be one or a combination of the following values:
  589. * @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
  590. * @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
  591. * @arg SDIO_FLAG_CTIMEOUT: Command response timeout
  592. * @arg SDIO_FLAG_DTIMEOUT: Data timeout
  593. * @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
  594. * @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
  595. * @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
  596. * @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
  597. * @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
  598. * @arg SDIO_FLAG_STBITERR: Start bit not detected on all data signals in wide bus mode
  599. * @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
  600. * @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
  601. * @arg SDIO_FLAG_CEATAEND: CE-ATA command completion signal received for CMD61
  602. * @retval None
  603. */
  604. #define __SDIO_CLEAR_FLAG(__INSTANCE__, __FLAG__) ((__INSTANCE__)->ICR = (__FLAG__))
  605. /**
  606. * @brief Checks whether the specified SDIO interrupt has occurred or not.
  607. * @param __INSTANCE__ : Pointer to SDIO register base
  608. * @param __INTERRUPT__: specifies the SDIO interrupt source to check.
  609. * This parameter can be one of the following values:
  610. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  611. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  612. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  613. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  614. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  615. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  616. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  617. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  618. * @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
  619. * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
  620. * bus mode interrupt
  621. * @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
  622. * @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
  623. * @arg SDIO_IT_TXACT: Data transmit in progress interrupt
  624. * @arg SDIO_IT_RXACT: Data receive in progress interrupt
  625. * @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
  626. * @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
  627. * @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
  628. * @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
  629. * @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
  630. * @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
  631. * @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
  632. * @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
  633. * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
  634. * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61 interrupt
  635. * @retval The new state of SDIO_IT (SET or RESET).
  636. */
  637. #define __SDIO_GET_IT (__INSTANCE__, __INTERRUPT__) (((__INSTANCE__)->STA &(__INTERRUPT__)) == (__INTERRUPT__))
  638. /**
  639. * @brief Clears the SDIO's interrupt pending bits.
  640. * @param __INSTANCE__ : Pointer to SDIO register base
  641. * @param __INTERRUPT__: specifies the interrupt pending bit to clear.
  642. * This parameter can be one or a combination of the following values:
  643. * @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
  644. * @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
  645. * @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
  646. * @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
  647. * @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
  648. * @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
  649. * @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
  650. * @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
  651. * @arg SDIO_IT_DATAEND: Data end (data counter, SDIO_DCOUNT, is zero) interrupt
  652. * @arg SDIO_IT_STBITERR: Start bit not detected on all data signals in wide
  653. * bus mode interrupt
  654. * @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
  655. * @arg SDIO_IT_CEATAEND: CE-ATA command completion signal received for CMD61
  656. * @retval None
  657. */
  658. #define __SDIO_CLEAR_IT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->ICR = (__INTERRUPT__))
  659. /**
  660. * @brief Enable Start the SD I/O Read Wait operation.
  661. * @retval None
  662. */
  663. #define __SDIO_START_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = ENABLE)
  664. /**
  665. * @brief Disable Start the SD I/O Read Wait operations.
  666. * @retval None
  667. */
  668. #define __SDIO_START_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTART_BB = DISABLE)
  669. /**
  670. * @brief Enable Start the SD I/O Read Wait operation.
  671. * @retval None
  672. */
  673. #define __SDIO_STOP_READWAIT_ENABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = ENABLE)
  674. /**
  675. * @brief Disable Stop the SD I/O Read Wait operations.
  676. * @retval None
  677. */
  678. #define __SDIO_STOP_READWAIT_DISABLE() (*(__IO uint32_t *) DCTRL_RWSTOP_BB = DISABLE)
  679. /**
  680. * @brief Enable the SD I/O Mode Operation.
  681. * @retval None
  682. */
  683. #define __SDIO_OPERATION_ENABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = ENABLE)
  684. /**
  685. * @brief Disable the SD I/O Mode Operation.
  686. * @retval None
  687. */
  688. #define __SDIO_OPERATION_DISABLE() (*(__IO uint32_t *) DCTRL_SDIOEN_BB = DISABLE)
  689. /**
  690. * @brief Enable the SD I/O Suspend command sending.
  691. * @retval None
  692. */
  693. #define __SDIO_SUSPEND_CMD_ENABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = ENABLE)
  694. /**
  695. * @brief Disable the SD I/O Suspend command sending.
  696. * @retval None
  697. */
  698. #define __SDIO_SUSPEND_CMD_DISABLE() (*(__IO uint32_t *) CMD_SDIOSUSPEND_BB = DISABLE)
  699. #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
  700. defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
  701. defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) ||\
  702. defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
  703. /**
  704. * @brief Enable the command completion signal.
  705. * @retval None
  706. */
  707. #define __SDIO_CEATA_CMD_COMPLETION_ENABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = ENABLE)
  708. /**
  709. * @brief Disable the command completion signal.
  710. * @retval None
  711. */
  712. #define __SDIO_CEATA_CMD_COMPLETION_DISABLE() (*(__IO uint32_t *) CMD_ENCMDCOMPL_BB = DISABLE)
  713. /**
  714. * @brief Enable the CE-ATA interrupt.
  715. * @retval None
  716. */
  717. #define __SDIO_CEATA_ENABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)0U)
  718. /**
  719. * @brief Disable the CE-ATA interrupt.
  720. * @retval None
  721. */
  722. #define __SDIO_CEATA_DISABLE_IT() (*(__IO uint32_t *) CMD_NIEN_BB = (uint32_t)1U)
  723. /**
  724. * @brief Enable send CE-ATA command (CMD61).
  725. * @retval None
  726. */
  727. #define __SDIO_CEATA_SENDCMD_ENABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = ENABLE)
  728. /**
  729. * @brief Disable send CE-ATA command (CMD61).
  730. * @retval None
  731. */
  732. #define __SDIO_CEATA_SENDCMD_DISABLE() (*(__IO uint32_t *) CMD_ATACMD_BB = DISABLE)
  733. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F411xE ||\
  734. STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F412Zx || STM32F412Vx || STM32F412Rx ||\
  735. STM32F412Cx */
  736. /**
  737. * @}
  738. */
  739. /**
  740. * @}
  741. */
  742. /* Exported functions --------------------------------------------------------*/
  743. /** @addtogroup SDMMC_LL_Exported_Functions
  744. * @{
  745. */
  746. /* Initialization/de-initialization functions **********************************/
  747. /** @addtogroup HAL_SDMMC_LL_Group1
  748. * @{
  749. */
  750. HAL_StatusTypeDef SDIO_Init(SDIO_TypeDef *SDIOx, SDIO_InitTypeDef Init);
  751. /**
  752. * @}
  753. */
  754. /* I/O operation functions *****************************************************/
  755. /** @addtogroup HAL_SDMMC_LL_Group2
  756. * @{
  757. */
  758. /* Blocking mode: Polling */
  759. uint32_t SDIO_ReadFIFO(SDIO_TypeDef *SDIOx);
  760. HAL_StatusTypeDef SDIO_WriteFIFO(SDIO_TypeDef *SDIOx, uint32_t *pWriteData);
  761. /**
  762. * @}
  763. */
  764. /* Peripheral Control functions ************************************************/
  765. /** @addtogroup HAL_SDMMC_LL_Group3
  766. * @{
  767. */
  768. HAL_StatusTypeDef SDIO_PowerState_ON(SDIO_TypeDef *SDIOx);
  769. HAL_StatusTypeDef SDIO_PowerState_OFF(SDIO_TypeDef *SDIOx);
  770. uint32_t SDIO_GetPowerState(SDIO_TypeDef *SDIOx);
  771. /* Command path state machine (CPSM) management functions */
  772. HAL_StatusTypeDef SDIO_SendCommand(SDIO_TypeDef *SDIOx, SDIO_CmdInitTypeDef *SDIO_CmdInitStruct);
  773. uint8_t SDIO_GetCommandResponse(SDIO_TypeDef *SDIOx);
  774. uint32_t SDIO_GetResponse(uint32_t SDIO_RESP);
  775. /* Data path state machine (DPSM) management functions */
  776. HAL_StatusTypeDef SDIO_DataConfig(SDIO_TypeDef *SDIOx, SDIO_DataInitTypeDef* SDIO_DataInitStruct);
  777. uint32_t SDIO_GetDataCounter(SDIO_TypeDef *SDIOx);
  778. uint32_t SDIO_GetFIFOCount(SDIO_TypeDef *SDIOx);
  779. /* SDIO IO Cards mode management functions */
  780. HAL_StatusTypeDef SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode);
  781. /**
  782. * @}
  783. */
  784. /**
  785. * @}
  786. */
  787. /**
  788. * @}
  789. */
  790. /**
  791. * @}
  792. */
  793. #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
  794. STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
  795. STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  796. #ifdef __cplusplus
  797. }
  798. #endif
  799. #endif /* __STM32F4xx_LL_SDMMC_H */
  800. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/