diskio.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. /* Status of Disk Functions */
  12. typedef BYTE DSTATUS;
  13. /* Results of Disk Functions */
  14. typedef enum {
  15. RES_OK = 0, /* 0: Successful */
  16. RES_ERROR, /* 1: R/W Error */
  17. RES_WRPRT, /* 2: Write Protected */
  18. RES_NOTRDY, /* 3: Not Ready */
  19. RES_PARERR /* 4: Invalid Parameter */
  20. } DRESULT;
  21. /*---------------------------------------*/
  22. /* Prototypes for disk control functions */
  23. DSTATUS disk_initialize (BYTE);
  24. DSTATUS disk_status (BYTE);
  25. DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
  26. #if _READONLY == 0
  27. DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
  28. #endif
  29. DRESULT disk_ioctl (BYTE, BYTE, void*);
  30. void disk_timerproc (void);
  31. /* Disk Status Bits (DSTATUS) */
  32. #define STA_NOINIT 0x01 /* Drive not initialized */
  33. #define STA_NODISK 0x02 /* No medium in the drive */
  34. #define STA_PROTECT 0x04 /* Write protected */
  35. /* Command code for disk_ioctrl() */
  36. /* Generic command */
  37. #define CTRL_SYNC 0 /* Mandatory for write functions */
  38. #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
  39. #define GET_SECTOR_SIZE 2
  40. #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
  41. #define CTRL_POWER 4
  42. #define CTRL_LOCK 5
  43. #define CTRL_EJECT 6
  44. #define _DISKIO
  45. #endif
  46. #ifdef __cplusplus
  47. }
  48. #endif