sdcard.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. // 本文件来源于 stm324xg_eval_sdio_sd.h
  2. /**
  3. ******************************************************************************
  4. * @file bsp_sdio_sd.h
  5. * @author MCD Application Team
  6. * @version V1.0.2
  7. * @date 09-March-2012
  8. * @brief This file contains all the functions prototypes for the SD Card
  9. * stm324xg_eval_sdio_sd driver firmware library.
  10. ******************************************************************************
  11. * @attention
  12. *
  13. * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
  14. *
  15. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  16. * You may not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at:
  18. *
  19. * http://www.st.com/software_license_agreement_liberty_v2
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS,
  23. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. *
  27. ******************************************************************************
  28. */
  29. /* Define to prevent recursive inclusion -------------------------------------*/
  30. #ifndef __STM324xG_EVAL_SDIO_SD_H
  31. #define __STM324xG_EVAL_SDIO_SD_H
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32f4xx.h"
  38. /****************** 下面的内容来自 stm324xg_eval.h **********************************/
  39. /**
  40. * @brief SD FLASH SDIO Interface
  41. */
  42. /* 定义检测卡插入的GPIO. 安富莱STM32-V5开发板卡插入信号为 PE2 */
  43. #ifdef STM32_X3
  44. #define SD_DETECT_PIN GPIO_Pin_0
  45. #define SD_DETECT_GPIO_PORT GPIOE
  46. #define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOE
  47. #else /* STM32_F4 */
  48. #define SD_DETECT_PIN GPIO_Pin_2
  49. #define SD_DETECT_GPIO_PORT GPIOE
  50. #define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOE
  51. #endif
  52. #define SDIO_FIFO_ADDRESS ((uint32_t)0x40012C80)
  53. /**
  54. * @brief SDIO Intialization Frequency (400KHz max)
  55. */
  56. #define SDIO_INIT_CLK_DIV ((uint8_t)0x76)
  57. /**
  58. * @brief SDIO Data Transfer Frequency (25MHz max)
  59. */
  60. #define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x0) /* 缺省是0, */
  61. #define SD_SDIO_DMA DMA2
  62. #define SD_SDIO_DMA_CLK RCC_AHB1Periph_DMA2
  63. #define SD_SDIO_DMA_STREAM3 3
  64. //#define SD_SDIO_DMA_STREAM6 6
  65. #ifdef SD_SDIO_DMA_STREAM3
  66. #define SD_SDIO_DMA_STREAM DMA2_Stream3
  67. #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
  68. #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF3
  69. #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF3
  70. #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF3
  71. #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF3
  72. #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF3
  73. #define SD_SDIO_DMA_IRQn DMA2_Stream3_IRQn
  74. #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler
  75. #elif defined SD_SDIO_DMA_STREAM6
  76. #define SD_SDIO_DMA_STREAM DMA2_Stream6
  77. #define SD_SDIO_DMA_CHANNEL DMA_Channel_4
  78. #define SD_SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF6
  79. #define SD_SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6
  80. #define SD_SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF6
  81. #define SD_SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF6
  82. #define SD_SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF6
  83. #define SD_SDIO_DMA_IRQn DMA2_Stream6_IRQn
  84. #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream6_IRQHandler
  85. #endif /* SD_SDIO_DMA_STREAM3 */
  86. /****************** 下面的内容来自 stm324xg_eval_sdio_sd.h ***************************************/
  87. /** @addtogroup Utilities
  88. * @{
  89. */
  90. /** @addtogroup STM32_EVAL
  91. * @{
  92. */
  93. /** @addtogroup STM324xG_EVAL
  94. * @{
  95. */
  96. /** @addtogroup STM324xG_EVAL_SDIO_SD
  97. * @{
  98. */
  99. /** @defgroup STM324xG_EVAL_SDIO_SD_Exported_Types
  100. * @{
  101. */
  102. typedef enum
  103. {
  104. /**
  105. * @brief SDIO specific error defines
  106. */
  107. SD_CMD_CRC_FAIL = (1), /*!< Command response received (but CRC check failed) */
  108. SD_DATA_CRC_FAIL = (2), /*!< Data bock sent/received (CRC check Failed) */
  109. SD_CMD_RSP_TIMEOUT = (3), /*!< Command response timeout */
  110. SD_DATA_TIMEOUT = (4), /*!< Data time out */
  111. SD_TX_UNDERRUN = (5), /*!< Transmit FIFO under-run */
  112. SD_RX_OVERRUN = (6), /*!< Receive FIFO over-run */
  113. SD_START_BIT_ERR = (7), /*!< Start bit not detected on all data signals in widE bus mode */
  114. SD_CMD_OUT_OF_RANGE = (8), /*!< CMD's argument was out of range.*/
  115. SD_ADDR_MISALIGNED = (9), /*!< Misaligned address */
  116. SD_BLOCK_LEN_ERR = (10), /*!< Transferred block length is not allowed for the card or the number of transferred bytes does not match the block length */
  117. SD_ERASE_SEQ_ERR = (11), /*!< An error in the sequence of erase command occurs.*/
  118. SD_BAD_ERASE_PARAM = (12), /*!< An Invalid selection for erase groups */
  119. SD_WRITE_PROT_VIOLATION = (13), /*!< Attempt to program a write protect block */
  120. SD_LOCK_UNLOCK_FAILED = (14), /*!< Sequence or password error has been detected in unlock command or if there was an attempt to access a locked card */
  121. SD_COM_CRC_FAILED = (15), /*!< CRC check of the previous command failed */
  122. SD_ILLEGAL_CMD = (16), /*!< Command is not legal for the card state */
  123. SD_CARD_ECC_FAILED = (17), /*!< Card internal ECC was applied but failed to correct the data */
  124. SD_CC_ERROR = (18), /*!< Internal card controller error */
  125. SD_GENERAL_UNKNOWN_ERROR = (19), /*!< General or Unknown error */
  126. SD_STREAM_READ_UNDERRUN = (20), /*!< The card could not sustain data transfer in stream read operation. */
  127. SD_STREAM_WRITE_OVERRUN = (21), /*!< The card could not sustain data programming in stream mode */
  128. SD_CID_CSD_OVERWRITE = (22), /*!< CID/CSD overwrite error */
  129. SD_WP_ERASE_SKIP = (23), /*!< only partial address space was erased */
  130. SD_CARD_ECC_DISABLED = (24), /*!< Command has been executed without using internal ECC */
  131. SD_ERASE_RESET = (25), /*!< Erase sequence was cleared before executing because an out of erase sequence command was received */
  132. SD_AKE_SEQ_ERROR = (26), /*!< Error in sequence of authentication. */
  133. SD_INVALID_VOLTRANGE = (27),
  134. SD_ADDR_OUT_OF_RANGE = (28),
  135. SD_SWITCH_ERROR = (29),
  136. SD_SDIO_DISABLED = (30),
  137. SD_SDIO_FUNCTION_BUSY = (31),
  138. SD_SDIO_FUNCTION_FAILED = (32),
  139. SD_SDIO_UNKNOWN_FUNCTION = (33),
  140. /**
  141. * @brief Standard error defines
  142. */
  143. SD_INTERNAL_ERROR,
  144. SD_NOT_CONFIGURED,
  145. SD_REQUEST_PENDING,
  146. SD_REQUEST_NOT_APPLICABLE,
  147. SD_INVALID_PARAMETER,
  148. SD_UNSUPPORTED_FEATURE,
  149. SD_UNSUPPORTED_HW,
  150. SD_ERROR,
  151. SD_OK = 0
  152. } SD_Error;
  153. /**
  154. * @brief SDIO Transfer state
  155. */
  156. typedef enum
  157. {
  158. SD_TRANSFER_OK = 0,
  159. SD_TRANSFER_BUSY = 1,
  160. SD_TRANSFER_ERROR
  161. } SDTransferState;
  162. /**
  163. * @brief SD Card States
  164. */
  165. typedef enum
  166. {
  167. SD_CARD_READY = ((uint32_t)0x00000001),
  168. SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002),
  169. SD_CARD_STANDBY = ((uint32_t)0x00000003),
  170. SD_CARD_TRANSFER = ((uint32_t)0x00000004),
  171. SD_CARD_SENDING = ((uint32_t)0x00000005),
  172. SD_CARD_RECEIVING = ((uint32_t)0x00000006),
  173. SD_CARD_PROGRAMMING = ((uint32_t)0x00000007),
  174. SD_CARD_DISCONNECTED = ((uint32_t)0x00000008),
  175. SD_CARD_ERROR = ((uint32_t)0x000000FF)
  176. } SDCardState;
  177. /**
  178. * @brief Card Specific Data: CSD Register
  179. */
  180. typedef struct
  181. {
  182. __IO uint8_t CSDStruct; /*!< CSD structure */
  183. __IO uint8_t SysSpecVersion; /*!< System specification version */
  184. __IO uint8_t Reserved1; /*!< Reserved */
  185. __IO uint8_t TAAC; /*!< Data read access-time 1 */
  186. __IO uint8_t NSAC; /*!< Data read access-time 2 in CLK cycles */
  187. __IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */
  188. __IO uint16_t CardComdClasses; /*!< Card command classes */
  189. __IO uint8_t RdBlockLen; /*!< Max. read data block length */
  190. __IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */
  191. __IO uint8_t WrBlockMisalign; /*!< Write block misalignment */
  192. __IO uint8_t RdBlockMisalign; /*!< Read block misalignment */
  193. __IO uint8_t DSRImpl; /*!< DSR implemented */
  194. __IO uint8_t Reserved2; /*!< Reserved */
  195. __IO uint32_t DeviceSize; /*!< Device Size */
  196. __IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */
  197. __IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */
  198. __IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */
  199. __IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */
  200. __IO uint8_t DeviceSizeMul; /*!< Device size multiplier */
  201. __IO uint8_t EraseGrSize; /*!< Erase group size */
  202. __IO uint8_t EraseGrMul; /*!< Erase group size multiplier */
  203. __IO uint8_t WrProtectGrSize; /*!< Write protect group size */
  204. __IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */
  205. __IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */
  206. __IO uint8_t WrSpeedFact; /*!< Write speed factor */
  207. __IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */
  208. __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */
  209. __IO uint8_t Reserved3; /*!< Reserded */
  210. __IO uint8_t ContentProtectAppli; /*!< Content protection application */
  211. __IO uint8_t FileFormatGrouop; /*!< File format group */
  212. __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */
  213. __IO uint8_t PermWrProtect; /*!< Permanent write protection */
  214. __IO uint8_t TempWrProtect; /*!< Temporary write protection */
  215. __IO uint8_t FileFormat; /*!< File Format */
  216. __IO uint8_t ECC; /*!< ECC code */
  217. __IO uint8_t CSD_CRC; /*!< CSD CRC */
  218. __IO uint8_t Reserved4; /*!< always 1*/
  219. } SD_CSD;
  220. /**
  221. * @brief Card Identification Data: CID Register
  222. */
  223. typedef struct
  224. {
  225. __IO uint8_t ManufacturerID; /*!< ManufacturerID */
  226. __IO uint16_t OEM_AppliID; /*!< OEM/Application ID */
  227. __IO uint32_t ProdName1; /*!< Product Name part1 */
  228. __IO uint8_t ProdName2; /*!< Product Name part2*/
  229. __IO uint8_t ProdRev; /*!< Product Revision */
  230. __IO uint32_t ProdSN; /*!< Product Serial Number */
  231. __IO uint8_t Reserved1; /*!< Reserved1 */
  232. __IO uint16_t ManufactDate; /*!< Manufacturing Date */
  233. __IO uint8_t CID_CRC; /*!< CID CRC */
  234. __IO uint8_t Reserved2; /*!< always 1 */
  235. } SD_CID;
  236. /**
  237. * @brief SD Card Status
  238. */
  239. typedef struct
  240. {
  241. __IO uint8_t DAT_BUS_WIDTH;
  242. __IO uint8_t SECURED_MODE;
  243. __IO uint16_t SD_CARD_TYPE;
  244. __IO uint32_t SIZE_OF_PROTECTED_AREA;
  245. __IO uint8_t SPEED_CLASS;
  246. __IO uint8_t PERFORMANCE_MOVE;
  247. __IO uint8_t AU_SIZE;
  248. __IO uint16_t ERASE_SIZE;
  249. __IO uint8_t ERASE_TIMEOUT;
  250. __IO uint8_t ERASE_OFFSET;
  251. } SD_CardStatus;
  252. /**
  253. * @brief SD Card information
  254. */
  255. typedef struct
  256. {
  257. SD_CSD SD_csd;
  258. SD_CID SD_cid;
  259. uint64_t CardCapacity; /*!< Card Capacity */
  260. uint32_t CardBlockSize; /*!< Card Block Size */
  261. uint16_t RCA;
  262. uint8_t CardType;
  263. } SD_CardInfo;
  264. /**
  265. * @}
  266. */
  267. /** @defgroup STM324xG_EVAL_SDIO_SD_Exported_Constants
  268. * @{
  269. */
  270. /**
  271. * @brief SDIO Commands Index
  272. */
  273. #define SD_CMD_GO_IDLE_STATE ((uint8_t)0)
  274. #define SD_CMD_SEND_OP_COND ((uint8_t)1)
  275. #define SD_CMD_ALL_SEND_CID ((uint8_t)2)
  276. #define SD_CMD_SET_REL_ADDR ((uint8_t)3) /*!< SDIO_SEND_REL_ADDR for SD Card */
  277. #define SD_CMD_SET_DSR ((uint8_t)4)
  278. #define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
  279. #define SD_CMD_HS_SWITCH ((uint8_t)6)
  280. #define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
  281. #define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
  282. #define SD_CMD_SEND_CSD ((uint8_t)9)
  283. #define SD_CMD_SEND_CID ((uint8_t)10)
  284. #define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11) /*!< SD Card doesn't support it */
  285. #define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
  286. #define SD_CMD_SEND_STATUS ((uint8_t)13)
  287. #define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
  288. #define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
  289. #define SD_CMD_SET_BLOCKLEN ((uint8_t)16)
  290. #define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
  291. #define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
  292. #define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
  293. #define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20) /*!< SD Card doesn't support it */
  294. #define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23) /*!< SD Card doesn't support it */
  295. #define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
  296. #define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
  297. #define SD_CMD_PROG_CID ((uint8_t)26) /*!< reserved for manufacturers */
  298. #define SD_CMD_PROG_CSD ((uint8_t)27)
  299. #define SD_CMD_SET_WRITE_PROT ((uint8_t)28)
  300. #define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
  301. #define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
  302. #define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32) /*!< To set the address of the first write \
  303. block to be erased. (For SD card only) */
  304. #define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33) /*!< To set the address of the last write block of the \
  305. continuous range to be erased. (For SD card only) */
  306. #define SD_CMD_ERASE_GRP_START ((uint8_t)35) /*!< To set the address of the first write block to be erased. \
  307. (For MMC card only spec 3.31) */
  308. #define SD_CMD_ERASE_GRP_END ((uint8_t)36) /*!< To set the address of the last write block of the \
  309. continuous range to be erased. (For MMC card only spec 3.31) */
  310. #define SD_CMD_ERASE ((uint8_t)38)
  311. #define SD_CMD_FAST_IO ((uint8_t)39) /*!< SD Card doesn't support it */
  312. #define SD_CMD_GO_IRQ_STATE ((uint8_t)40) /*!< SD Card doesn't support it */
  313. #define SD_CMD_LOCK_UNLOCK ((uint8_t)42)
  314. #define SD_CMD_APP_CMD ((uint8_t)55)
  315. #define SD_CMD_GEN_CMD ((uint8_t)56)
  316. #define SD_CMD_NO_CMD ((uint8_t)64)
  317. /**
  318. * @brief Following commands are SD Card Specific commands.
  319. * SDIO_APP_CMD should be sent before sending these commands.
  320. */
  321. #define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6) /*!< For SD Card only */
  322. #define SD_CMD_SD_APP_STAUS ((uint8_t)13) /*!< For SD Card only */
  323. #define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22) /*!< For SD Card only */
  324. #define SD_CMD_SD_APP_OP_COND ((uint8_t)41) /*!< For SD Card only */
  325. #define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42) /*!< For SD Card only */
  326. #define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51) /*!< For SD Card only */
  327. #define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52) /*!< For SD I/O Card only */
  328. #define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53) /*!< For SD I/O Card only */
  329. /**
  330. * @brief Following commands are SD Card Specific security commands.
  331. * SDIO_APP_CMD should be sent before sending these commands.
  332. */
  333. #define SD_CMD_SD_APP_GET_MKB ((uint8_t)43) /*!< For SD Card only */
  334. #define SD_CMD_SD_APP_GET_MID ((uint8_t)44) /*!< For SD Card only */
  335. #define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45) /*!< For SD Card only */
  336. #define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46) /*!< For SD Card only */
  337. #define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47) /*!< For SD Card only */
  338. #define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48) /*!< For SD Card only */
  339. #define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18) /*!< For SD Card only */
  340. #define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25) /*!< For SD Card only */
  341. #define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38) /*!< For SD Card only */
  342. #define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49) /*!< For SD Card only */
  343. #define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48) /*!< For SD Card only */
  344. /* Uncomment the following line to select the SDIO Data transfer mode */
  345. #if !defined(SD_DMA_MODE) && !defined(SD_POLLING_MODE)
  346. #define SD_DMA_MODE ((uint32_t)0x00000000)
  347. //#define SD_POLLING_MODE ((uint32_t)0x00000002)
  348. #endif
  349. /**
  350. * @brief SD detection on its memory slot
  351. */
  352. #define SD_PRESENT ((uint8_t)0x01)
  353. #define SD_NOT_PRESENT ((uint8_t)0x00)
  354. /**
  355. * @brief Supported SD Memory Cards
  356. */
  357. #define SDIO_STD_CAPACITY_SD_CARD_V1_1 ((uint32_t)0x00000000)
  358. #define SDIO_STD_CAPACITY_SD_CARD_V2_0 ((uint32_t)0x00000001)
  359. #define SDIO_HIGH_CAPACITY_SD_CARD ((uint32_t)0x00000002)
  360. #define SDIO_MULTIMEDIA_CARD ((uint32_t)0x00000003)
  361. #define SDIO_SECURE_DIGITAL_IO_CARD ((uint32_t)0x00000004)
  362. #define SDIO_HIGH_SPEED_MULTIMEDIA_CARD ((uint32_t)0x00000005)
  363. #define SDIO_SECURE_DIGITAL_IO_COMBO_CARD ((uint32_t)0x00000006)
  364. #define SDIO_HIGH_CAPACITY_MMC_CARD ((uint32_t)0x00000007)
  365. /**
  366. * @}
  367. */
  368. /** @defgroup STM324xG_EVAL_SDIO_SD_Exported_Macros
  369. * @{
  370. */
  371. /**
  372. * @}
  373. */
  374. /** @defgroup STM324xG_EVAL_SDIO_SD_Exported_Functions
  375. * @{
  376. */
  377. void SD_DeInit(void);
  378. SD_Error SD_Init(void);
  379. SDTransferState SD_GetStatus(void);
  380. SDCardState SD_GetState(void);
  381. uint8_t SD_Detect(void);
  382. SD_Error SD_PowerON(void);
  383. SD_Error SD_PowerOFF(void);
  384. SD_Error SD_InitializeCards(void);
  385. SD_Error SD_GetCardInfo(SD_CardInfo *cardinfo);
  386. SD_Error SD_GetCardStatus(SD_CardStatus *cardstatus);
  387. SD_Error SD_EnableWideBusOperation(uint32_t WideMode);
  388. SD_Error SD_SelectDeselect(uint32_t addr);
  389. SD_Error SD_ReadBlock(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize);
  390. SD_Error SD_ReadMultiBlocks(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks);
  391. SD_Error SD_WriteBlock(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize);
  392. SD_Error SD_WriteMultiBlocks(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks);
  393. SDTransferState SD_GetTransferState(void);
  394. SD_Error SD_StopTransfer(void);
  395. SD_Error SD_Erase(uint32_t startaddr, uint32_t endaddr);
  396. SD_Error SD_SendStatus(uint32_t *pcardstatus);
  397. SD_Error SD_SendSDStatus(uint32_t *psdstatus);
  398. SD_Error SD_ProcessIRQSrc(void);
  399. void SD_ProcessDMAIRQ(void);
  400. SD_Error SD_WaitReadOperation(void);
  401. SD_Error SD_WaitWriteOperation(void);
  402. /*********************************/
  403. void SD_LowLevel_DeInit(void);
  404. void SD_LowLevel_Init(void);
  405. void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize);
  406. void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize);
  407. void SDIO_Interrupts_Config(void);
  408. extern SD_CardInfo SDCardInfo;
  409. #ifdef __cplusplus
  410. }
  411. #endif
  412. #endif /* __STM32_EVAL_SDIO_SD_H */
  413. /**
  414. * @}
  415. */
  416. /**
  417. * @}
  418. */
  419. /**
  420. * @}
  421. */
  422. /**
  423. * @}
  424. */
  425. /**
  426. * @}
  427. */
  428. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/