stm32f4xx_ll_sdmmc.h 39 KB

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