Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

diskio.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //-----------------------------------------------------------------------
  2. // Low level disk interface modlue include file
  3. //-----------------------------------------------------------------------
  4. #ifndef _DISKIO
  5. #define _READONLY 0 // 1: Remove write functions
  6. #define _USE_IOCTL 1 // 1: Use disk_ioctl fucntion
  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. // Prototypes for disk control functions
  19. int assign_drives (int, int);
  20. DSTATUS disk_initialize (BYTE);
  21. DSTATUS disk_status (BYTE);
  22. DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
  23. #if _READONLY == 0
  24. DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
  25. #endif
  26. DRESULT disk_ioctl (BYTE, BYTE, 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 fucntion
  32. // Generic command (defined for FatFs)
  33. #define CTRL_SYNC 0 // Flush disk cache (for write functions)
  34. #define GET_SECTOR_COUNT 1 // Get media size (for only f_mkfs())
  35. #define GET_SECTOR_SIZE 2 // Get sector size (for multiple sector size (_MAX_SS >= 1024))
  36. #define GET_BLOCK_SIZE 3 // Get erase block size (for only f_mkfs())
  37. #define CTRL_ERASE_SECTOR 4 // Force erased a block of sectors (for only _USE_ERASE)
  38. // Generic command
  39. #define CTRL_POWER 5 // Get/Set power status
  40. #define CTRL_LOCK 6 // Lock/Unlock media removal
  41. #define CTRL_EJECT 7 // Eject media
  42. // MMC/SDC specific ioctl command
  43. #define MMC_GET_TYPE 10 // Get card type
  44. #define MMC_GET_CSD 11 // Get CSD
  45. #define MMC_GET_CID 12 // Get CID
  46. #define MMC_GET_OCR 13 // Get OCR
  47. #define MMC_GET_SDSTAT 14 // Get SD status
  48. // ATA/CF specific ioctl command
  49. #define ATA_GET_REV 20 // Get F/W revision
  50. #define ATA_GET_MODEL 21 // Get model name
  51. #define ATA_GET_SN 22 // Get serial number
  52. // NAND specific ioctl command
  53. #define NAND_FORMAT 30 // Create physical format
  54. #define _DISKIO
  55. #endif