sdcard.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #ifndef __SDCARD_H
  10. #define __SDCARD_H
  11. #include <rtthread.h>
  12. #ifdef RT_USING_DFS
  13. #include <sep4020.h>
  14. #define INICLK 300000
  15. #define SDCLK 24000000 //PCLK=49.392MHz
  16. #define MMCCLK 15000000 //PCLK=49.392MHz
  17. /*struct of the SDC*/
  18. struct sd_c
  19. {
  20. __IO rt_uint32_t clk_ctl;
  21. __IO rt_uint32_t soft_rst;
  22. __IO rt_uint32_t arg;
  23. __IO rt_uint32_t cmd;
  24. __IO rt_uint32_t blk_sz;
  25. __IO rt_uint32_t blk_cnt;
  26. __IO rt_uint32_t trans_mode;
  27. __O rt_uint32_t response0;
  28. __O rt_uint32_t response1;
  29. __O rt_uint32_t response2;
  30. __O rt_uint32_t response3;
  31. __IO rt_uint32_t rd_to_ctl;
  32. __IO rt_uint32_t int_stat;
  33. __IO rt_uint32_t int_stat_mask;
  34. __O rt_uint32_t rx_fifo;
  35. __I rt_uint32_t tx_fifo;
  36. };
  37. /*sdcard driver structure*/
  38. struct sd_device
  39. {
  40. struct rt_device *device; /*rt_device*/
  41. struct sd_c *sdc; /*SDCARD register*/
  42. struct dfs_partition *part; /*dfs partitions*/
  43. rt_uint8_t *sec_buf; /*sdcard buffer*/
  44. rt_uint32_t part_num; /*partiont numbers*/
  45. rt_uint32_t buf_size; /*buffer size*/
  46. };
  47. #endif
  48. #endif