sdcard.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * File : sdcard.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. */
  13. #ifndef __SDCARD_H
  14. #define __SDCARD_H
  15. #include <rtthread.h>
  16. #ifdef RT_USING_DFS
  17. #include <sep4020.h>
  18. #define INICLK 300000
  19. #define SDCLK 24000000 //PCLK=49.392MHz
  20. #define MMCCLK 15000000 //PCLK=49.392MHz
  21. /*struct of the SDC*/
  22. struct sd_c
  23. {
  24. __IO rt_uint32_t clk_ctl;
  25. __IO rt_uint32_t soft_rst;
  26. __IO rt_uint32_t arg;
  27. __IO rt_uint32_t cmd;
  28. __IO rt_uint32_t blk_sz;
  29. __IO rt_uint32_t blk_cnt;
  30. __IO rt_uint32_t trans_mode;
  31. __O rt_uint32_t response0;
  32. __O rt_uint32_t response1;
  33. __O rt_uint32_t response2;
  34. __O rt_uint32_t response3;
  35. __IO rt_uint32_t rd_to_ctl;
  36. __IO rt_uint32_t int_stat;
  37. __IO rt_uint32_t int_stat_mask;
  38. __O rt_uint32_t rx_fifo;
  39. __I rt_uint32_t tx_fifo;
  40. };
  41. /*sdcard driver structure*/
  42. struct sd_device
  43. {
  44. struct rt_device *device; /*rt_device*/
  45. struct sd_c *sdc; /*SDCARD register*/
  46. struct dfs_partition *part; /*dfs partitions*/
  47. rt_uint8_t *sec_buf; /*sdcard buffer*/
  48. rt_uint32_t part_num; /*partiont numbers*/
  49. rt_uint32_t buf_size; /*buffer size*/
  50. };
  51. #endif
  52. #endif