sdcard.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __SDCARD_H
  2. #define __SDCARD_H
  3. #include <rtthread.h>
  4. #ifdef RT_USING_DFS
  5. #include <sep4020.h>
  6. #define INICLK 300000
  7. #define SDCLK 24000000 //PCLK=49.392MHz
  8. #define MMCCLK 15000000 //PCLK=49.392MHz
  9. /*struct of the SDC*/
  10. struct sd_c
  11. {
  12. __IO rt_uint32_t clk_ctl;
  13. __IO rt_uint32_t soft_rst;
  14. __IO rt_uint32_t arg;
  15. __IO rt_uint32_t cmd;
  16. __IO rt_uint32_t blk_sz;
  17. __IO rt_uint32_t blk_cnt;
  18. __IO rt_uint32_t trans_mode;
  19. __O rt_uint32_t response0;
  20. __O rt_uint32_t response1;
  21. __O rt_uint32_t response2;
  22. __O rt_uint32_t response3;
  23. __IO rt_uint32_t rd_to_ctl;
  24. __IO rt_uint32_t int_stat;
  25. __IO rt_uint32_t int_stat_mask;
  26. __O rt_uint32_t rx_fifo;
  27. __I rt_uint32_t tx_fifo;
  28. };
  29. /*sdcard driver structure*/
  30. struct sd_device
  31. {
  32. struct rt_device *device; /*rt_device*/
  33. struct sd_c *sdc; /*SDCARD register*/
  34. struct dfs_partition *part; /*dfs partitions*/
  35. rt_uint8_t *sec_buf; /*sdcard buffer*/
  36. rt_uint32_t part_num; /*partiont numbers*/
  37. rt_uint32_t buf_size; /*buffer size*/
  38. };
  39. #endif
  40. #endif