stm32l1xx_ll_sdmmc.h 38 KB

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