diskio.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*-----------------------------------------------------------------------
  2. / Low level disk interface modlue include file R0.05 (C)ChaN, 2007
  3. /-----------------------------------------------------------------------*/
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef _DISKIO
  8. #define _READONLY 0 /* 1: Read-only mode */
  9. #define _USE_IOCTL 1
  10. #include "integer.h"
  11. /*
  12. * Status of Disk Functions
  13. */
  14. typedef BYTE DSTATUS;
  15. /*
  16. * Results of Disk Functions
  17. */
  18. typedef enum {
  19. RES_OK = 0, /* 0: Successful */
  20. RES_ERROR, /* 1: R/W Error */
  21. RES_WRPRT, /* 2: Write Protected */
  22. RES_NOTRDY, /* 3: Not Ready */
  23. RES_PARERR /* 4: Invalid Parameter */
  24. } DRESULT;
  25. /*---------------------------------------*/
  26. /*
  27. * Prototypes for disk control functions
  28. */
  29. DSTATUS disk_initialize(BYTE);
  30. DSTATUS disk_status(BYTE);
  31. DRESULT disk_read(BYTE, BYTE *, DWORD, BYTE);
  32. #if _READONLY == 0
  33. DRESULT disk_write(BYTE, const BYTE *, DWORD, BYTE);
  34. #endif
  35. DRESULT disk_ioctl(BYTE, BYTE, void *);
  36. void disk_timerproc(void);
  37. /*
  38. * Disk Status Bits (DSTATUS)
  39. */
  40. #define STA_NOINIT 0x01 /* Drive not initialized */
  41. #define STA_NODISK 0x02 /* No medium in the drive */
  42. #define STA_PROTECT 0x04 /* Write protected */
  43. #define STA_VOID 0xff
  44. /*
  45. * Command code for disk_ioctrl()
  46. */
  47. /*
  48. * Generic command
  49. */
  50. #define CTRL_SYNC 0 /* Mandatory for write functions */
  51. #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
  52. #define GET_SECTOR_SIZE 2
  53. #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
  54. #define CTRL_POWER 4
  55. #define CTRL_LOCK 5
  56. #define CTRL_EJECT 6
  57. #define _DISKIO
  58. #endif
  59. #ifdef __cplusplus
  60. }
  61. #endif