You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fatfs_sd.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __FATFS_SD_H
  2. #define __FATFS_SD_H
  3. /* Definitions for MMC/SDC command */
  4. #define CMD0 (0x40+0) /* GO_IDLE_STATE */
  5. #define CMD1 (0x40+1) /* SEND_OP_COND */
  6. #define CMD8 (0x40+8) /* SEND_IF_COND */
  7. #define CMD9 (0x40+9) /* SEND_CSD */
  8. #define CMD10 (0x40+10) /* SEND_CID */
  9. #define CMD12 (0x40+12) /* STOP_TRANSMISSION */
  10. #define CMD16 (0x40+16) /* SET_BLOCKLEN */
  11. #define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */
  12. #define CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */
  13. #define CMD23 (0x40+23) /* SET_BLOCK_COUNT */
  14. #define CMD24 (0x40+24) /* WRITE_BLOCK */
  15. #define CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */
  16. #define CMD41 (0x40+41) /* SEND_OP_COND (ACMD) */
  17. #define CMD55 (0x40+55) /* APP_CMD */
  18. #define CMD58 (0x40+58) /* READ_OCR */
  19. /* MMC card type flags (MMC_GET_TYPE) */
  20. #define CT_MMC 0x01 /* MMC ver 3 */
  21. #define CT_SD1 0x02 /* SD ver 1 */
  22. #define CT_SD2 0x04 /* SD ver 2 */
  23. #define CT_SDC 0x06 /* SD */
  24. #define CT_BLOCK 0x08 /* Block addressing */
  25. /* Functions */
  26. DSTATUS SD_disk_initialize (BYTE pdrv);
  27. DSTATUS SD_disk_status (BYTE pdrv);
  28. DRESULT SD_disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
  29. DRESULT SD_disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
  30. DRESULT SD_disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
  31. #define SPI_TIMEOUT 100
  32. extern SPI_HandleTypeDef hspi1;
  33. #define HSPI_SDCARD &hspi1
  34. #define SD_CS_PORT GPIOB
  35. #define SD_CS_PIN GPIO_PIN_6
  36. #endif