n32g45x_sdio.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /*****************************************************************************
  2. * Copyright (c) 2019, Nations Technologies Inc.
  3. *
  4. * All rights reserved.
  5. * ****************************************************************************
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * - Redistributions of source code must retain the above copyright notice,
  11. * this list of conditions and the disclaimer below.
  12. *
  13. * Nations' name may not be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. *
  16. * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  19. * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  22. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  25. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. * ****************************************************************************/
  27. /**
  28. * @file n32g45x_sdio.h
  29. * @author Nations
  30. * @version v1.0.1
  31. *
  32. * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
  33. */
  34. #ifndef __N32G45X_SDIO_H__
  35. #define __N32G45X_SDIO_H__
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #include "n32g45x.h"
  40. /** @addtogroup N32G45X_StdPeriph_Driver
  41. * @{
  42. */
  43. /** @addtogroup SDIO
  44. * @{
  45. */
  46. /** @addtogroup SDIO_Exported_Types
  47. * @{
  48. */
  49. typedef struct
  50. {
  51. uint32_t ClkEdge; /*!< Specifies the clock transition on which the bit capture is made.
  52. This parameter can be a value of @ref SDIO_Clock_Edge */
  53. uint32_t ClkBypass; /*!< Specifies whether the SDIO Clock divider bypass is
  54. enabled or disabled.
  55. This parameter can be a value of @ref SDIO_Clock_Bypass */
  56. uint32_t ClkPwrSave; /*!< Specifies whether SDIO Clock output is enabled or
  57. disabled when the bus is idle.
  58. This parameter can be a value of @ref SDIO_Clock_Power_Save */
  59. uint32_t BusWidth; /*!< Specifies the SDIO bus width.
  60. This parameter can be a value of @ref SDIO_Bus_Wide */
  61. uint32_t HardwareClkCtrl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled.
  62. This parameter can be a value of @ref SDIO_Hardware_Flow_Control */
  63. uint8_t ClkDiv; /*!< Specifies the clock frequency of the SDIO controller.
  64. This parameter can be a value between 0x00 and 0xFF. */
  65. } SDIO_InitType;
  66. typedef struct
  67. {
  68. uint32_t CmdArgument; /*!< Specifies the SDIO command argument which is sent
  69. to a card as part of a command message. If a command
  70. contains an argument, it must be loaded into this register
  71. before writing the command to the command register */
  72. uint32_t CmdIndex; /*!< Specifies the SDIO command index. It must be lower than 0x40. */
  73. uint32_t ResponseType; /*!< Specifies the SDIO response type.
  74. This parameter can be a value of @ref SDIO_Response_Type */
  75. uint32_t WaitType; /*!< Specifies whether SDIO wait-for-interrupt request is enabled or disabled.
  76. This parameter can be a value of @ref SDIO_Wait_Interrupt_State */
  77. uint32_t CPSMConfig; /*!< Specifies whether SDIO Command path state machine (CPSM)
  78. is enabled or disabled.
  79. This parameter can be a value of @ref SDIO_CPSM_State */
  80. } SDIO_CmdInitType;
  81. typedef struct
  82. {
  83. uint32_t DatTimeout; /*!< Specifies the data timeout period in card bus clock periods. */
  84. uint32_t DatLen; /*!< Specifies the number of data bytes to be transferred. */
  85. uint32_t DatBlkSize; /*!< Specifies the data block size for block transfer.
  86. This parameter can be a value of @ref SDIO_Data_Block_Size */
  87. uint32_t TransferDirection; /*!< Specifies the data transfer direction, whether the transfer
  88. is a read or write.
  89. This parameter can be a value of @ref SDIO_Transfer_Direction */
  90. uint32_t TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
  91. This parameter can be a value of @ref SDIO_Transfer_Type */
  92. uint32_t DPSMConfig; /*!< Specifies whether SDIO Data path state machine (DPSM)
  93. is enabled or disabled.
  94. This parameter can be a value of @ref SDIO_DPSM_State */
  95. } SDIO_DataInitType;
  96. /**
  97. * @}
  98. */
  99. /** @addtogroup SDIO_Exported_Constants
  100. * @{
  101. */
  102. /** @addtogroup SDIO_Clock_Edge
  103. * @{
  104. */
  105. #define SDIO_CLKEDGE_RISING ((uint32_t)0x00000000)
  106. #define SDIO_CLKEDGE_FALLING ((uint32_t)0x00002000)
  107. #define IS_SDIO_CLK_EDGE(EDGE) (((EDGE) == SDIO_CLKEDGE_RISING) || ((EDGE) == SDIO_CLKEDGE_FALLING))
  108. /**
  109. * @}
  110. */
  111. /** @addtogroup SDIO_Clock_Bypass
  112. * @{
  113. */
  114. #define SDIO_ClkBYPASS_DISABLE ((uint32_t)0x00000000)
  115. #define SDIO_ClkBYPASS_ENABLE ((uint32_t)0x00000400)
  116. #define IS_SDIO_CLK_BYPASS(BYPASS) (((BYPASS) == SDIO_ClkBYPASS_DISABLE) || ((BYPASS) == SDIO_ClkBYPASS_ENABLE))
  117. /**
  118. * @}
  119. */
  120. /** @addtogroup SDIO_Clock_Power_Save
  121. * @{
  122. */
  123. #define SDIO_CLKPOWERSAVE_DISABLE ((uint32_t)0x00000000)
  124. #define SDIO_CLKPOWERSAVE_ENABLE ((uint32_t)0x00000200)
  125. #define IS_SDIO_CLK_POWER_SAVE(SAVE) (((SAVE) == SDIO_CLKPOWERSAVE_DISABLE) || ((SAVE) == SDIO_CLKPOWERSAVE_ENABLE))
  126. /**
  127. * @}
  128. */
  129. /** @addtogroup SDIO_Bus_Wide
  130. * @{
  131. */
  132. #define SDIO_BUSWIDTH_1B ((uint32_t)0x00000000)
  133. #define SDIO_BUSWIDTH_4B ((uint32_t)0x00000800)
  134. #define SDIO_BUSWIDTH_8B ((uint32_t)0x00001000)
  135. #define IS_SDIO_BUS_WIDTH(WIDE) \
  136. (((WIDE) == SDIO_BUSWIDTH_1B) || ((WIDE) == SDIO_BUSWIDTH_4B) || ((WIDE) == SDIO_BUSWIDTH_8B))
  137. /**
  138. * @}
  139. */
  140. /** @addtogroup SDIO_Hardware_Flow_Control
  141. * @{
  142. */
  143. #define SDIO_HARDWARE_CLKCTRL_DISABLE ((uint32_t)0x00000000)
  144. #define SDIO_HARDWARE_CLKCTRL_ENABLE ((uint32_t)0x00004000)
  145. #define IS_SDIO_HARDWARE_CLKCTRL(CONTROL) \
  146. (((CONTROL) == SDIO_HARDWARE_CLKCTRL_DISABLE) || ((CONTROL) == SDIO_HARDWARE_CLKCTRL_ENABLE))
  147. /**
  148. * @}
  149. */
  150. /** @addtogroup SDIO_Power_State
  151. * @{
  152. */
  153. #define SDIO_POWER_CTRL_OFF ((uint32_t)0x00000000)
  154. #define SDIO_POWER_CTRL_ON ((uint32_t)0x00000003)
  155. #define IS_SDIO_POWER_CTRL(STATE) (((STATE) == SDIO_POWER_CTRL_OFF) || ((STATE) == SDIO_POWER_CTRL_ON))
  156. /**
  157. * @}
  158. */
  159. /** @addtogroup SDIO_Interrupt_sources
  160. * @{
  161. */
  162. #define SDIO_INT_CCRCERR ((uint32_t)0x00000001)
  163. #define SDIO_INT_DCRCERR ((uint32_t)0x00000002)
  164. #define SDIO_INT_CMDTIMEOUT ((uint32_t)0x00000004)
  165. #define SDIO_INT_DATTIMEOUT ((uint32_t)0x00000008)
  166. #define SDIO_INT_TXURERR ((uint32_t)0x00000010)
  167. #define SDIO_INT_RXORERR ((uint32_t)0x00000020)
  168. #define SDIO_INT_CMDRESPRECV ((uint32_t)0x00000040)
  169. #define SDIO_INT_CMDSEND ((uint32_t)0x00000080)
  170. #define SDIO_INT_DATEND ((uint32_t)0x00000100)
  171. #define SDIO_INT_SBERR ((uint32_t)0x00000200)
  172. #define SDIO_INT_DATBLKEND ((uint32_t)0x00000400)
  173. #define SDIO_INT_CMDRUN ((uint32_t)0x00000800)
  174. #define SDIO_INT_TXRUN ((uint32_t)0x00001000)
  175. #define SDIO_INT_RXRUN ((uint32_t)0x00002000)
  176. #define SDIO_INT_TFIFOHE ((uint32_t)0x00004000)
  177. #define SDIO_INT_RFIFOHF ((uint32_t)0x00008000)
  178. #define SDIO_INT_TFIFOF ((uint32_t)0x00010000)
  179. #define SDIO_INT_RFIFOF ((uint32_t)0x00020000)
  180. #define SDIO_INT_TFIFOE ((uint32_t)0x00040000)
  181. #define SDIO_INT_RFIFOE ((uint32_t)0x00080000)
  182. #define SDIO_INT_TDATVALID ((uint32_t)0x00100000)
  183. #define SDIO_INT_RDATVALID ((uint32_t)0x00200000)
  184. #define SDIO_INT_SDIOINT ((uint32_t)0x00400000)
  185. #define SDIO_INT_CEATAF ((uint32_t)0x00800000)
  186. #define IS_SDIO_INT(IT) ((((IT) & (uint32_t)0xFF000000) == 0x00) && ((IT) != (uint32_t)0x00))
  187. /**
  188. * @}
  189. */
  190. /** @addtogroup SDIO_Command_Index
  191. * @{
  192. */
  193. #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40)
  194. /**
  195. * @}
  196. */
  197. /** @addtogroup SDIO_Response_Type
  198. * @{
  199. */
  200. #define SDIO_RESP_NO ((uint32_t)0x00000000)
  201. #define SDIO_RESP_SHORT ((uint32_t)0x00000040)
  202. #define SDIO_RESP_LONG ((uint32_t)0x000000C0)
  203. #define IS_SDIO_RESP(RESPONSE) \
  204. (((RESPONSE) == SDIO_RESP_NO) || ((RESPONSE) == SDIO_RESP_SHORT) || ((RESPONSE) == SDIO_RESP_LONG))
  205. /**
  206. * @}
  207. */
  208. /** @addtogroup SDIO_Wait_Interrupt_State
  209. * @{
  210. */
  211. #define SDIO_WAIT_NO ((uint32_t)0x00000000) /*!< SDIO No Wait, TimeOut is enabled */
  212. #define SDIO_WAIT_INT ((uint32_t)0x00000100) /*!< SDIO Wait Interrupt Request */
  213. #define SDIO_WAIT_PEND ((uint32_t)0x00000200) /*!< SDIO Wait End of transfer */
  214. #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_WAIT_NO) || ((WAIT) == SDIO_WAIT_INT) || ((WAIT) == SDIO_WAIT_PEND))
  215. /**
  216. * @}
  217. */
  218. /** @addtogroup SDIO_CPSM_State
  219. * @{
  220. */
  221. #define SDIO_CPSM_DISABLE ((uint32_t)0x00000000)
  222. #define SDIO_CPSM_ENABLE ((uint32_t)0x00000400)
  223. #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_ENABLE) || ((CPSM) == SDIO_CPSM_DISABLE))
  224. /**
  225. * @}
  226. */
  227. /** @addtogroup SDIO_Response_Registers
  228. * @{
  229. */
  230. #define SDIO_RESPONSE_1 ((uint32_t)0x00000000)
  231. #define SDIO_RESPONSE_2 ((uint32_t)0x00000004)
  232. #define SDIO_RESPONSE_3 ((uint32_t)0x00000008)
  233. #define SDIO_RESPONSE_4 ((uint32_t)0x0000000C)
  234. #define IS_SDIO_RESPONSE(RESP) \
  235. (((RESP) == SDIO_RESPONSE_1) || ((RESP) == SDIO_RESPONSE_2) || ((RESP) == SDIO_RESPONSE_3) \
  236. || ((RESP) == SDIO_RESPONSE_4))
  237. /**
  238. * @}
  239. */
  240. /** @addtogroup SDIO_Data_Length
  241. * @{
  242. */
  243. #define IS_SDIO_DAT_LEN(LENGTH) ((LENGTH) <= 0x01FFFFFF)
  244. /**
  245. * @}
  246. */
  247. /** @addtogroup SDIO_Data_Block_Size
  248. * @{
  249. */
  250. #define SDIO_DATBLK_SIZE_1B ((uint32_t)0x00000000)
  251. #define SDIO_DATBLK_SIZE_2B ((uint32_t)0x00000010)
  252. #define SDIO_DATBLK_SIZE_4B ((uint32_t)0x00000020)
  253. #define SDIO_DATBLK_SIZE_8B ((uint32_t)0x00000030)
  254. #define SDIO_DATBLK_SIZE_16B ((uint32_t)0x00000040)
  255. #define SDIO_DATBLK_SIZE_32B ((uint32_t)0x00000050)
  256. #define SDIO_DATBLK_SIZE_64B ((uint32_t)0x00000060)
  257. #define SDIO_DATBLK_SIZE_128B ((uint32_t)0x00000070)
  258. #define SDIO_DATBLK_SIZE_256B ((uint32_t)0x00000080)
  259. #define SDIO_DATBLK_SIZE_512B ((uint32_t)0x00000090)
  260. #define SDIO_DATBLK_SIZE_1024B ((uint32_t)0x000000A0)
  261. #define SDIO_DATBLK_SIZE_2048B ((uint32_t)0x000000B0)
  262. #define SDIO_DATBLK_SIZE_4096B ((uint32_t)0x000000C0)
  263. #define SDIO_DATBLK_SIZE_8192B ((uint32_t)0x000000D0)
  264. #define SDIO_DATBLK_SIZE_16384B ((uint32_t)0x000000E0)
  265. #define IS_SDIO_BLK_SIZE(SIZE) \
  266. (((SIZE) == SDIO_DATBLK_SIZE_1B) || ((SIZE) == SDIO_DATBLK_SIZE_2B) || ((SIZE) == SDIO_DATBLK_SIZE_4B) \
  267. || ((SIZE) == SDIO_DATBLK_SIZE_8B) || ((SIZE) == SDIO_DATBLK_SIZE_16B) || ((SIZE) == SDIO_DATBLK_SIZE_32B) \
  268. || ((SIZE) == SDIO_DATBLK_SIZE_64B) || ((SIZE) == SDIO_DATBLK_SIZE_128B) || ((SIZE) == SDIO_DATBLK_SIZE_256B) \
  269. || ((SIZE) == SDIO_DATBLK_SIZE_512B) || ((SIZE) == SDIO_DATBLK_SIZE_1024B) || ((SIZE) == SDIO_DATBLK_SIZE_2048B) \
  270. || ((SIZE) == SDIO_DATBLK_SIZE_4096B) || ((SIZE) == SDIO_DATBLK_SIZE_8192B) \
  271. || ((SIZE) == SDIO_DATBLK_SIZE_16384B))
  272. /**
  273. * @}
  274. */
  275. /** @addtogroup SDIO_Transfer_Direction
  276. * @{
  277. */
  278. #define SDIO_TRANSDIR_TOCARD ((uint32_t)0x00000000)
  279. #define SDIO_TRANSDIR_TOSDIO ((uint32_t)0x00000002)
  280. #define IS_SDIO_TRANSFER_DIRECTION(DIR) (((DIR) == SDIO_TRANSDIR_TOCARD) || ((DIR) == SDIO_TRANSDIR_TOSDIO))
  281. /**
  282. * @}
  283. */
  284. /** @addtogroup SDIO_Transfer_Type
  285. * @{
  286. */
  287. #define SDIO_TRANSMODE_BLOCK ((uint32_t)0x00000000)
  288. #define SDIO_TRANSMODE_STREAM ((uint32_t)0x00000004)
  289. #define IS_SDIO_TRANS_MODE(MODE) (((MODE) == SDIO_TRANSMODE_STREAM) || ((MODE) == SDIO_TRANSMODE_BLOCK))
  290. /**
  291. * @}
  292. */
  293. /** @addtogroup SDIO_DPSM_State
  294. * @{
  295. */
  296. #define SDIO_DPSM_DISABLE ((uint32_t)0x00000000)
  297. #define SDIO_DPSM_ENABLE ((uint32_t)0x00000001)
  298. #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_ENABLE) || ((DPSM) == SDIO_DPSM_DISABLE))
  299. /**
  300. * @}
  301. */
  302. /** @addtogroup SDIO_Flags
  303. * @{
  304. */
  305. #define SDIO_FLAG_CCRCERR ((uint32_t)0x00000001)
  306. #define SDIO_FLAG_DCRCERR ((uint32_t)0x00000002)
  307. #define SDIO_FLAG_CMDTIMEOUT ((uint32_t)0x00000004)
  308. #define SDIO_FLAG_DATTIMEOUT ((uint32_t)0x00000008)
  309. #define SDIO_FLAG_TXURERR ((uint32_t)0x00000010)
  310. #define SDIO_FLAG_RXORERR ((uint32_t)0x00000020)
  311. #define SDIO_FLAG_CMDRESPRECV ((uint32_t)0x00000040)
  312. #define SDIO_FLAG_CMDSEND ((uint32_t)0x00000080)
  313. #define SDIO_FLAG_DATEND ((uint32_t)0x00000100)
  314. #define SDIO_FLAG_SBERR ((uint32_t)0x00000200)
  315. #define SDIO_FLAG_DATBLKEND ((uint32_t)0x00000400)
  316. #define SDIO_FLAG_CMDRUN ((uint32_t)0x00000800)
  317. #define SDIO_FLAG_TXRUN ((uint32_t)0x00001000)
  318. #define SDIO_FLAG_RXRUN ((uint32_t)0x00002000)
  319. #define SDIO_FLAG_TFIFOHE ((uint32_t)0x00004000)
  320. #define SDIO_FLAG_RFIFOHF ((uint32_t)0x00008000)
  321. #define SDIO_FLAG_TFIFOF ((uint32_t)0x00010000)
  322. #define SDIO_FLAG_RFIFOF ((uint32_t)0x00020000)
  323. #define SDIO_FLAG_TFIFOE ((uint32_t)0x00040000)
  324. #define SDIO_FLAG_RFIFOE ((uint32_t)0x00080000)
  325. #define SDIO_FLAG_TDATVALID ((uint32_t)0x00100000)
  326. #define SDIO_FLAG_RDATVALID ((uint32_t)0x00200000)
  327. #define SDIO_FLAG_SDIOINT ((uint32_t)0x00400000)
  328. #define SDIO_FLAG_CEATAF ((uint32_t)0x00800000)
  329. #define IS_SDIO_FLAG(FLAG) \
  330. (((FLAG) == SDIO_FLAG_CCRCERR) || ((FLAG) == SDIO_FLAG_DCRCERR) || ((FLAG) == SDIO_FLAG_CMDTIMEOUT) \
  331. || ((FLAG) == SDIO_FLAG_DATTIMEOUT) || ((FLAG) == SDIO_FLAG_TXURERR) || ((FLAG) == SDIO_FLAG_RXORERR) \
  332. || ((FLAG) == SDIO_FLAG_CMDRESPRECV) || ((FLAG) == SDIO_FLAG_CMDSEND) || ((FLAG) == SDIO_FLAG_DATEND) \
  333. || ((FLAG) == SDIO_FLAG_SBERR) || ((FLAG) == SDIO_FLAG_DATBLKEND) || ((FLAG) == SDIO_FLAG_CMDRUN) \
  334. || ((FLAG) == SDIO_FLAG_TXRUN) || ((FLAG) == SDIO_FLAG_RXRUN) || ((FLAG) == SDIO_FLAG_TFIFOHE) \
  335. || ((FLAG) == SDIO_FLAG_RFIFOHF) || ((FLAG) == SDIO_FLAG_TFIFOF) || ((FLAG) == SDIO_FLAG_RFIFOF) \
  336. || ((FLAG) == SDIO_FLAG_TFIFOE) || ((FLAG) == SDIO_FLAG_RFIFOE) || ((FLAG) == SDIO_FLAG_TDATVALID) \
  337. || ((FLAG) == SDIO_FLAG_RDATVALID) || ((FLAG) == SDIO_FLAG_SDIOINT) || ((FLAG) == SDIO_FLAG_CEATAF))
  338. #define IS_SDIO_CLR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFF3FF800) == 0x00) && ((FLAG) != (uint32_t)0x00))
  339. #define IS_SDIO_GET_INT(IT) \
  340. (((IT) == SDIO_INT_CCRCERR) || ((IT) == SDIO_INT_DCRCERR) || ((IT) == SDIO_INT_CMDTIMEOUT) \
  341. || ((IT) == SDIO_INT_DATTIMEOUT) || ((IT) == SDIO_INT_TXURERR) || ((IT) == SDIO_INT_RXORERR) \
  342. || ((IT) == SDIO_INT_CMDRESPRECV) || ((IT) == SDIO_INT_CMDSEND) || ((IT) == SDIO_INT_DATEND) \
  343. || ((IT) == SDIO_INT_SBERR) || ((IT) == SDIO_INT_DATBLKEND) || ((IT) == SDIO_INT_CMDRUN) \
  344. || ((IT) == SDIO_INT_TXRUN) || ((IT) == SDIO_INT_RXRUN) || ((IT) == SDIO_INT_TFIFOHE) \
  345. || ((IT) == SDIO_INT_RFIFOHF) || ((IT) == SDIO_INT_TFIFOF) || ((IT) == SDIO_INT_RFIFOF) \
  346. || ((IT) == SDIO_INT_TFIFOE) || ((IT) == SDIO_INT_RFIFOE) || ((IT) == SDIO_INT_TDATVALID) \
  347. || ((IT) == SDIO_INT_RDATVALID) || ((IT) == SDIO_INT_SDIOINT) || ((IT) == SDIO_INT_CEATAF))
  348. #define IS_SDIO_CLR_INT(IT) ((((IT) & (uint32_t)0xFF3FF800) == 0x00) && ((IT) != (uint32_t)0x00))
  349. /**
  350. * @}
  351. */
  352. /** @addtogroup SDIO_Read_Wait_Mode
  353. * @{
  354. */
  355. #define SDIO_RDWAIT_MODE_CLK ((uint32_t)0x00000001)
  356. #define SDIO_RDWAIT_MODE_DAT2 ((uint32_t)0x00000000)
  357. #define IS_SDIO_RDWAIT_MODE(MODE) (((MODE) == SDIO_RDWAIT_MODE_CLK) || ((MODE) == SDIO_RDWAIT_MODE_DAT2))
  358. /**
  359. * @}
  360. */
  361. /**
  362. * @}
  363. */
  364. /** @addtogroup SDIO_Exported_Macros
  365. * @{
  366. */
  367. /**
  368. * @}
  369. */
  370. /** @addtogroup SDIO_Exported_Functions
  371. * @{
  372. */
  373. void SDIO_DeInit(void);
  374. void SDIO_Init(SDIO_InitType* SDIO_InitStruct);
  375. void SDIO_InitStruct(SDIO_InitType* SDIO_InitStruct);
  376. void SDIO_EnableClock(FunctionalState Cmd);
  377. void SDIO_SetPower(uint32_t SDIO_PowerState);
  378. uint32_t SDIO_GetPower(void);
  379. void SDIO_ConfigInt(uint32_t SDIO_IT, FunctionalState Cmd);
  380. void SDIO_DMACmd(FunctionalState Cmd);
  381. void SDIO_SendCmd(SDIO_CmdInitType* SDIO_CmdInitStruct);
  382. void SDIO_InitCmdStruct(SDIO_CmdInitType* SDIO_CmdInitStruct);
  383. uint8_t SDIO_GetCmdResp(void);
  384. uint32_t SDIO_GetResp(uint32_t SDIO_RESP);
  385. void SDIO_ConfigData(SDIO_DataInitType* SDIO_DataInitStruct);
  386. void SDIO_InitDataStruct(SDIO_DataInitType* SDIO_DataInitStruct);
  387. uint32_t SDIO_GetDataCountValue(void);
  388. uint32_t SDIO_ReadData(void);
  389. void SDIO_WriteData(uint32_t Data);
  390. uint32_t SDIO_GetFifoCounter(void);
  391. void SDIO_EnableReadWait(FunctionalState Cmd);
  392. void SDIO_DisableReadWait(FunctionalState Cmd);
  393. void SDIO_EnableSdioReadWaitMode(uint32_t SDIO_ReadWaitMode);
  394. void SDIO_EnableSdioOperation(FunctionalState Cmd);
  395. void SDIO_EnableSendSdioSuspend(FunctionalState Cmd);
  396. void SDIO_EnableCommandCompletion(FunctionalState Cmd);
  397. void SDIO_EnableCEATAInt(FunctionalState Cmd);
  398. void SDIO_EnableSendCEATA(FunctionalState Cmd);
  399. FlagStatus SDIO_GetFlag(uint32_t SDIO_FLAG);
  400. void SDIO_ClrFlag(uint32_t SDIO_FLAG);
  401. INTStatus SDIO_GetIntStatus(uint32_t SDIO_IT);
  402. void SDIO_ClrIntPendingBit(uint32_t SDIO_IT);
  403. #ifdef __cplusplus
  404. }
  405. #endif
  406. #endif /* __N32G45X_SDIO_H__ */
  407. /**
  408. * @}
  409. */
  410. /**
  411. * @}
  412. */
  413. /**
  414. * @}
  415. */