diskio.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*-----------------------------------------------------------------------
  2. / Low level disk interface module include file
  3. /-----------------------------------------------------------------------*/
  4. #ifndef _DISKIO_DEFINED
  5. #define _DISKIO_DEFINED
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "integer.h"
  10. #include "../DataflashManager.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. /* Disk Status Bits (DSTATUS) */
  31. #define STA_NOINIT 0x01 /* Drive not initialized */
  32. #define STA_NODISK 0x02 /* No medium in the drive */
  33. #define STA_PROTECT 0x04 /* Write protected */
  34. /* Generic command */
  35. #define CTRL_SYNC 0 /* Mandatory for write functions */
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif