Lab Checkoff
Dependencies: SDFileSystem TextLCD mbed-rtos mbed wave_player FATFileSystem
SDFileSystem/FATFileSystem/ChaN/diskio.h@0:67dbd54e60d4, 2013-11-13 (annotated)
- Committer:
- doubster
- Date:
- Wed Nov 13 20:00:28 2013 +0000
- Revision:
- 0:67dbd54e60d4
Lab Checkoff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
doubster | 0:67dbd54e60d4 | 1 | //----------------------------------------------------------------------- |
doubster | 0:67dbd54e60d4 | 2 | // Low level disk interface modlue include file |
doubster | 0:67dbd54e60d4 | 3 | //----------------------------------------------------------------------- |
doubster | 0:67dbd54e60d4 | 4 | |
doubster | 0:67dbd54e60d4 | 5 | #ifndef _DISKIO |
doubster | 0:67dbd54e60d4 | 6 | |
doubster | 0:67dbd54e60d4 | 7 | #define _READONLY 0 // 1: Remove write functions |
doubster | 0:67dbd54e60d4 | 8 | #define _USE_IOCTL 1 // 1: Use disk_ioctl fucntion |
doubster | 0:67dbd54e60d4 | 9 | |
doubster | 0:67dbd54e60d4 | 10 | #include "integer.h" |
doubster | 0:67dbd54e60d4 | 11 | |
doubster | 0:67dbd54e60d4 | 12 | |
doubster | 0:67dbd54e60d4 | 13 | // Status of Disk Functions |
doubster | 0:67dbd54e60d4 | 14 | typedef BYTE DSTATUS; |
doubster | 0:67dbd54e60d4 | 15 | |
doubster | 0:67dbd54e60d4 | 16 | // Results of Disk Functions |
doubster | 0:67dbd54e60d4 | 17 | typedef enum { |
doubster | 0:67dbd54e60d4 | 18 | RES_OK = 0, // 0: Successful |
doubster | 0:67dbd54e60d4 | 19 | RES_ERROR, // 1: R/W Error |
doubster | 0:67dbd54e60d4 | 20 | RES_WRPRT, // 2: Write Protected |
doubster | 0:67dbd54e60d4 | 21 | RES_NOTRDY, // 3: Not Ready |
doubster | 0:67dbd54e60d4 | 22 | RES_PARERR // 4: Invalid Parameter |
doubster | 0:67dbd54e60d4 | 23 | } DRESULT; |
doubster | 0:67dbd54e60d4 | 24 | |
doubster | 0:67dbd54e60d4 | 25 | |
doubster | 0:67dbd54e60d4 | 26 | // Prototypes for disk control functions |
doubster | 0:67dbd54e60d4 | 27 | |
doubster | 0:67dbd54e60d4 | 28 | int assign_drives (int, int); |
doubster | 0:67dbd54e60d4 | 29 | DSTATUS disk_initialize (BYTE); |
doubster | 0:67dbd54e60d4 | 30 | DSTATUS disk_status (BYTE); |
doubster | 0:67dbd54e60d4 | 31 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); |
doubster | 0:67dbd54e60d4 | 32 | #if _READONLY == 0 |
doubster | 0:67dbd54e60d4 | 33 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); |
doubster | 0:67dbd54e60d4 | 34 | #endif |
doubster | 0:67dbd54e60d4 | 35 | DRESULT disk_ioctl (BYTE, BYTE, void*); |
doubster | 0:67dbd54e60d4 | 36 | |
doubster | 0:67dbd54e60d4 | 37 | |
doubster | 0:67dbd54e60d4 | 38 | |
doubster | 0:67dbd54e60d4 | 39 | // Disk Status Bits (DSTATUS) |
doubster | 0:67dbd54e60d4 | 40 | #define STA_NOINIT 0x01 // Drive not initialized |
doubster | 0:67dbd54e60d4 | 41 | #define STA_NODISK 0x02 // No medium in the drive |
doubster | 0:67dbd54e60d4 | 42 | #define STA_PROTECT 0x04 // Write protected |
doubster | 0:67dbd54e60d4 | 43 | |
doubster | 0:67dbd54e60d4 | 44 | |
doubster | 0:67dbd54e60d4 | 45 | // Command code for disk_ioctrl fucntion |
doubster | 0:67dbd54e60d4 | 46 | |
doubster | 0:67dbd54e60d4 | 47 | // Generic command (defined for FatFs) |
doubster | 0:67dbd54e60d4 | 48 | #define CTRL_SYNC 0 // Flush disk cache (for write functions) |
doubster | 0:67dbd54e60d4 | 49 | #define GET_SECTOR_COUNT 1 // Get media size (for only f_mkfs()) |
doubster | 0:67dbd54e60d4 | 50 | #define GET_SECTOR_SIZE 2 // Get sector size (for multiple sector size (_MAX_SS >= 1024)) |
doubster | 0:67dbd54e60d4 | 51 | #define GET_BLOCK_SIZE 3 // Get erase block size (for only f_mkfs()) |
doubster | 0:67dbd54e60d4 | 52 | #define CTRL_ERASE_SECTOR 4 // Force erased a block of sectors (for only _USE_ERASE) |
doubster | 0:67dbd54e60d4 | 53 | |
doubster | 0:67dbd54e60d4 | 54 | // Generic command |
doubster | 0:67dbd54e60d4 | 55 | #define CTRL_POWER 5 // Get/Set power status |
doubster | 0:67dbd54e60d4 | 56 | #define CTRL_LOCK 6 // Lock/Unlock media removal |
doubster | 0:67dbd54e60d4 | 57 | #define CTRL_EJECT 7 // Eject media |
doubster | 0:67dbd54e60d4 | 58 | |
doubster | 0:67dbd54e60d4 | 59 | // MMC/SDC specific ioctl command |
doubster | 0:67dbd54e60d4 | 60 | #define MMC_GET_TYPE 10 // Get card type |
doubster | 0:67dbd54e60d4 | 61 | #define MMC_GET_CSD 11 // Get CSD |
doubster | 0:67dbd54e60d4 | 62 | #define MMC_GET_CID 12 // Get CID |
doubster | 0:67dbd54e60d4 | 63 | #define MMC_GET_OCR 13 // Get OCR |
doubster | 0:67dbd54e60d4 | 64 | #define MMC_GET_SDSTAT 14 // Get SD status |
doubster | 0:67dbd54e60d4 | 65 | |
doubster | 0:67dbd54e60d4 | 66 | // ATA/CF specific ioctl command |
doubster | 0:67dbd54e60d4 | 67 | #define ATA_GET_REV 20 // Get F/W revision |
doubster | 0:67dbd54e60d4 | 68 | #define ATA_GET_MODEL 21 // Get model name |
doubster | 0:67dbd54e60d4 | 69 | #define ATA_GET_SN 22 // Get serial number |
doubster | 0:67dbd54e60d4 | 70 | |
doubster | 0:67dbd54e60d4 | 71 | // NAND specific ioctl command |
doubster | 0:67dbd54e60d4 | 72 | #define NAND_FORMAT 30 // Create physical format |
doubster | 0:67dbd54e60d4 | 73 | |
doubster | 0:67dbd54e60d4 | 74 | |
doubster | 0:67dbd54e60d4 | 75 | #define _DISKIO |
doubster | 0:67dbd54e60d4 | 76 | #endif |
doubster | 0:67dbd54e60d4 | 77 |