stm32l1xx_ll_sdmmc.h 38 KB

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