test
chan_fs/diskio.h@0:c1253c12d4bc, 2010-02-21 (annotated)
- Committer:
- emh203
- Date:
- Sun Feb 21 02:45:09 2010 +0000
- Revision:
- 0:c1253c12d4bc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emh203 | 0:c1253c12d4bc | 1 | /*----------------------------------------------------------------------- |
emh203 | 0:c1253c12d4bc | 2 | / Low level disk interface modlue include file R0.07 (C)ChaN, 2009 |
emh203 | 0:c1253c12d4bc | 3 | /-----------------------------------------------------------------------*/ |
emh203 | 0:c1253c12d4bc | 4 | |
emh203 | 0:c1253c12d4bc | 5 | #ifndef _DISKIO |
emh203 | 0:c1253c12d4bc | 6 | |
emh203 | 0:c1253c12d4bc | 7 | #define _READONLY 0 /* 1: Read-only mode */ |
emh203 | 0:c1253c12d4bc | 8 | #define _USE_IOCTL 1 |
emh203 | 0:c1253c12d4bc | 9 | |
emh203 | 0:c1253c12d4bc | 10 | #include "integer.h" |
emh203 | 0:c1253c12d4bc | 11 | |
emh203 | 0:c1253c12d4bc | 12 | /* Status of Disk Functions */ |
emh203 | 0:c1253c12d4bc | 13 | typedef BYTE DSTATUS; |
emh203 | 0:c1253c12d4bc | 14 | |
emh203 | 0:c1253c12d4bc | 15 | /* Results of Disk Functions */ |
emh203 | 0:c1253c12d4bc | 16 | typedef enum { |
emh203 | 0:c1253c12d4bc | 17 | RES_OK = 0, /* 0: Successful */ |
emh203 | 0:c1253c12d4bc | 18 | RES_ERROR, /* 1: R/W Error */ |
emh203 | 0:c1253c12d4bc | 19 | RES_WRPRT, /* 2: Write Protected */ |
emh203 | 0:c1253c12d4bc | 20 | RES_NOTRDY, /* 3: Not Ready */ |
emh203 | 0:c1253c12d4bc | 21 | RES_PARERR /* 4: Invalid Parameter */ |
emh203 | 0:c1253c12d4bc | 22 | } DRESULT; |
emh203 | 0:c1253c12d4bc | 23 | |
emh203 | 0:c1253c12d4bc | 24 | |
emh203 | 0:c1253c12d4bc | 25 | /*---------------------------------------*/ |
emh203 | 0:c1253c12d4bc | 26 | /* Prototypes for disk control functions */ |
emh203 | 0:c1253c12d4bc | 27 | |
emh203 | 0:c1253c12d4bc | 28 | extern BOOL assign_drives (int argc, char *argv[]); |
emh203 | 0:c1253c12d4bc | 29 | extern DSTATUS disk_initialize (BYTE); |
emh203 | 0:c1253c12d4bc | 30 | extern DSTATUS disk_status (BYTE); |
emh203 | 0:c1253c12d4bc | 31 | extern DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); |
emh203 | 0:c1253c12d4bc | 32 | extern DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); |
emh203 | 0:c1253c12d4bc | 33 | extern DRESULT disk_ioctl (BYTE, BYTE, void*); |
emh203 | 0:c1253c12d4bc | 34 | |
emh203 | 0:c1253c12d4bc | 35 | extern int _sd_sectors(); |
emh203 | 0:c1253c12d4bc | 36 | |
emh203 | 0:c1253c12d4bc | 37 | |
emh203 | 0:c1253c12d4bc | 38 | /* Disk Status Bits (DSTATUS) */ |
emh203 | 0:c1253c12d4bc | 39 | |
emh203 | 0:c1253c12d4bc | 40 | #define STA_NOINIT 0x01 /* Drive not initialized */ |
emh203 | 0:c1253c12d4bc | 41 | #define STA_NODISK 0x02 /* No medium in the drive */ |
emh203 | 0:c1253c12d4bc | 42 | #define STA_PROTECT 0x04 /* Write protected */ |
emh203 | 0:c1253c12d4bc | 43 | |
emh203 | 0:c1253c12d4bc | 44 | |
emh203 | 0:c1253c12d4bc | 45 | /* Command code for disk_ioctrl() */ |
emh203 | 0:c1253c12d4bc | 46 | |
emh203 | 0:c1253c12d4bc | 47 | /* Generic command */ |
emh203 | 0:c1253c12d4bc | 48 | #define CTRL_SYNC 0 /* Mandatory for write functions */ |
emh203 | 0:c1253c12d4bc | 49 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ |
emh203 | 0:c1253c12d4bc | 50 | #define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */ |
emh203 | 0:c1253c12d4bc | 51 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ |
emh203 | 0:c1253c12d4bc | 52 | #define CTRL_POWER 4 |
emh203 | 0:c1253c12d4bc | 53 | #define CTRL_LOCK 5 |
emh203 | 0:c1253c12d4bc | 54 | #define CTRL_EJECT 6 |
emh203 | 0:c1253c12d4bc | 55 | /* MMC/SDC command */ |
emh203 | 0:c1253c12d4bc | 56 | #define MMC_GET_TYPE 10 |
emh203 | 0:c1253c12d4bc | 57 | #define MMC_GET_CSD 11 |
emh203 | 0:c1253c12d4bc | 58 | #define MMC_GET_CID 12 |
emh203 | 0:c1253c12d4bc | 59 | #define MMC_GET_OCR 13 |
emh203 | 0:c1253c12d4bc | 60 | #define MMC_GET_SDSTAT 14 |
emh203 | 0:c1253c12d4bc | 61 | /* ATA/CF command */ |
emh203 | 0:c1253c12d4bc | 62 | #define ATA_GET_REV 20 |
emh203 | 0:c1253c12d4bc | 63 | #define ATA_GET_MODEL 21 |
emh203 | 0:c1253c12d4bc | 64 | #define ATA_GET_SN 22 |
emh203 | 0:c1253c12d4bc | 65 | |
emh203 | 0:c1253c12d4bc | 66 | |
emh203 | 0:c1253c12d4bc | 67 | #define _DISKIO |
emh203 | 0:c1253c12d4bc | 68 | #endif |