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