obj_spi_sd_stm32.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef SD_STM32_HEADER
  2. #define SD_STM32_HEADER
  3. #include "main.h"
  4. #include "diskio.h"
  5. #include <stdint.h>
  6. #include <string.h>
  7. #include <stdbool.h>
  8. #include "obj_spi_sd_stm32.h"
  9. #include "ff_gen_drv.h"
  10. #define TRUE 1
  11. #define FALSE 0
  12. //#define bool char
  13. //#define BYTE char
  14. /* Definitions for MMC/SDC command */
  15. #define CMD0 (0x40+0) /* GO_IDLE_STATE */
  16. #define CMD1 (0x40+1) /* SEND_OP_COND */
  17. #define CMD8 (0x40+8) /* SEND_IF_COND */
  18. #define CMD9 (0x40+9) /* SEND_CSD */
  19. #define CMD10 (0x40+10) /* SEND_CID */
  20. #define CMD12 (0x40+12) /* STOP_TRANSMISSION */
  21. #define CMD16 (0x40+16) /* SET_BLOCKLEN */
  22. #define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */
  23. #define CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */
  24. #define CMD23 (0x40+23) /* SET_BLOCK_COUNT */
  25. #define CMD24 (0x40+24) /* WRITE_BLOCK */
  26. #define CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */
  27. #define CMD41 (0x40+41) /* SEND_OP_COND (ACMD) */
  28. #define CMD55 (0x40+55) /* APP_CMD */
  29. #define CMD58 (0x40+58) /* READ_OCR */
  30. /*-----------------------------------------------------------------------*/
  31. /* Device Timer Interrupt Procedure (Platform dependent) */
  32. /*-----------------------------------------------------------------------*/
  33. /* This function must be called in period of 10ms */
  34. void sdcard_systick_timerproc(void);
  35. DSTATUS SD_disk_initialize(BYTE drv);
  36. DSTATUS SD_disk_status(BYTE drv);
  37. DRESULT SD_disk_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
  38. DRESULT SD_disk_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
  39. DRESULT SD_disk_ioctl(BYTE drv, /* Physical drive nmuber (0) */
  40. BYTE ctrl, /* Control code */
  41. void *buff /* Buffer to send/receive control data */
  42. );
  43. #endif