diskio.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*-----------------------------------------------------------------------
  2. / Low level disk interface modlue include file R0.07 (C)ChaN, 2009
  3. /-----------------------------------------------------------------------*/
  4. #ifndef _DISKIO
  5. #define _READONLY 0 /* 1: Read-only mode */
  6. #define _USE_IOCTL 1
  7. #include "integer.h"
  8. /* Status of Disk Functions */
  9. typedef BYTE DSTATUS;
  10. /* Results of Disk Functions */
  11. typedef enum {
  12. RES_OK = 0, /* 0: Successful */
  13. RES_ERROR, /* 1: R/W Error */
  14. RES_WRPRT, /* 2: Write Protected */
  15. RES_NOTRDY, /* 3: Not Ready */
  16. RES_PARERR /* 4: Invalid Parameter */
  17. } DRESULT;
  18. /*---------------------------------------*/
  19. /* Prototypes for disk control functions */
  20. BOOL assign_drives (int argc, char *argv[]);
  21. DSTATUS disk_initialize (BYTE);
  22. DSTATUS disk_status (BYTE);
  23. DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
  24. #if _READONLY == 0
  25. DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
  26. #endif
  27. DRESULT disk_ioctl (BYTE, BYTE, void*);
  28. /* Disk Status Bits (DSTATUS) */
  29. #define STA_NOINIT 0x01 /* Drive not initialized */
  30. #define STA_NODISK 0x02 /* No medium in the drive */
  31. #define STA_PROTECT 0x04 /* Write protected */
  32. /* Command code for disk_ioctrl() */
  33. /* Generic command */
  34. #define CTRL_SYNC 0 /* Mandatory for write functions */
  35. #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
  36. #define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */
  37. #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
  38. #define CTRL_POWER 4
  39. #define CTRL_LOCK 5
  40. #define CTRL_EJECT 6
  41. /* MMC/SDC command */
  42. #define MMC_GET_TYPE 10
  43. #define MMC_GET_CSD 11
  44. #define MMC_GET_CID 12
  45. #define MMC_GET_OCR 13
  46. #define MMC_GET_SDSTAT 14
  47. /* ATA/CF command */
  48. #define ATA_GET_REV 20
  49. #define ATA_GET_MODEL 21
  50. #define ATA_GET_SN 22
  51. #define _DISKIO
  52. #endif