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