1
0

diskio.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*-----------------------------------------------------------------------
  2. / Low level disk interface modlue include file R0.04a (C)ChaN, 2007
  3. /-----------------------------------------------------------------------*/
  4. #ifndef _DISKIO
  5. #define _READONLY 0 /* 1: Read-only mode */
  6. #include "integer.h"
  7. /* Status of Disk Functions */
  8. typedef BYTE DSTATUS;
  9. /* Results of Disk Functions */
  10. typedef enum {
  11. RES_OK = 0, /* 0: Successful */
  12. RES_ERROR, /* 1: R/W Error */
  13. RES_WRPRT, /* 2: Write Protected */
  14. RES_NOTRDY, /* 3: Not Ready */
  15. RES_PARERR /* 4: Invalid Parameter */
  16. } DRESULT;
  17. /*---------------------------------------*/
  18. /* Prototypes for disk control functions */
  19. DSTATUS disk_initialize (BYTE);
  20. DSTATUS disk_status (BYTE);
  21. DRESULT disk_read (BYTE, BYTE*, DWORD, UINT);
  22. #if _READONLY == 0
  23. DRESULT disk_write (BYTE, const BYTE*, DWORD, UINT);
  24. #endif
  25. DRESULT disk_ioctl (BYTE, BYTE, void*);
  26. void disk_timerproc (void);
  27. /* Disk Status Bits (DSTATUS) */
  28. #define STA_NOINIT 0x01 /* Drive not initialized */
  29. #define STA_NODISK 0x02 /* No medium in the drive */
  30. #define STA_PROTECT 0x04 /* Write protected */
  31. /* Command code for disk_ioctrl() */
  32. #define GET_SECTOR_COUNT 1
  33. #define GET_SECTOR_SIZE 2
  34. #define CTRL_SYNC 3
  35. #define CTRL_POWER_OFF 4
  36. #define CTRL_LOCK 5
  37. #define CTRL_EJECT 6
  38. #define MMC_GET_CSD 10
  39. #define MMC_GET_CID 11
  40. #define MMC_GET_OCR 12
  41. #define ATA_GET_REV 20
  42. #define ATA_GET_MODEL 21
  43. #define ATA_GET_SN 22
  44. #define _DISKIO
  45. #endif