![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ももいくん
Fork of 2016_Sp_momoi_taka by
FatFileSystem/diskio.h@0:736c76a75def, 2015-04-30 (annotated)
- Committer:
- hirokimineshita
- Date:
- Thu Apr 30 05:59:05 2015 +0000
- Revision:
- 0:736c76a75def
2015/04/30 PM 2 upload
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirokimineshita | 0:736c76a75def | 1 | /*----------------------------------------------------------------------- |
hirokimineshita | 0:736c76a75def | 2 | / Low level disk interface modlue include file R0.06 (C)ChaN, 2007 |
hirokimineshita | 0:736c76a75def | 3 | /-----------------------------------------------------------------------*/ |
hirokimineshita | 0:736c76a75def | 4 | |
hirokimineshita | 0:736c76a75def | 5 | #ifndef _DISKIO |
hirokimineshita | 0:736c76a75def | 6 | |
hirokimineshita | 0:736c76a75def | 7 | #define _READONLY 0 /* 1: Read-only mode */ |
hirokimineshita | 0:736c76a75def | 8 | #define _USE_IOCTL 1 |
hirokimineshita | 0:736c76a75def | 9 | |
hirokimineshita | 0:736c76a75def | 10 | #include "integer.h" |
hirokimineshita | 0:736c76a75def | 11 | |
hirokimineshita | 0:736c76a75def | 12 | #ifdef __cplusplus |
hirokimineshita | 0:736c76a75def | 13 | extern "C" { |
hirokimineshita | 0:736c76a75def | 14 | #endif |
hirokimineshita | 0:736c76a75def | 15 | |
hirokimineshita | 0:736c76a75def | 16 | /* Status of Disk Functions */ |
hirokimineshita | 0:736c76a75def | 17 | typedef BYTE DSTATUS; |
hirokimineshita | 0:736c76a75def | 18 | |
hirokimineshita | 0:736c76a75def | 19 | /* Results of Disk Functions */ |
hirokimineshita | 0:736c76a75def | 20 | typedef enum { |
hirokimineshita | 0:736c76a75def | 21 | RES_OK = 0, /* 0: Successful */ |
hirokimineshita | 0:736c76a75def | 22 | RES_ERROR, /* 1: R/W Error */ |
hirokimineshita | 0:736c76a75def | 23 | RES_WRPRT, /* 2: Write Protected */ |
hirokimineshita | 0:736c76a75def | 24 | RES_NOTRDY, /* 3: Not Ready */ |
hirokimineshita | 0:736c76a75def | 25 | RES_PARERR /* 4: Invalid Parameter */ |
hirokimineshita | 0:736c76a75def | 26 | } DRESULT; |
hirokimineshita | 0:736c76a75def | 27 | |
hirokimineshita | 0:736c76a75def | 28 | |
hirokimineshita | 0:736c76a75def | 29 | /*---------------------------------------*/ |
hirokimineshita | 0:736c76a75def | 30 | /* Prototypes for disk control functions */ |
hirokimineshita | 0:736c76a75def | 31 | |
hirokimineshita | 0:736c76a75def | 32 | DSTATUS disk_initialize (BYTE); |
hirokimineshita | 0:736c76a75def | 33 | DSTATUS disk_status (BYTE); |
hirokimineshita | 0:736c76a75def | 34 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); |
hirokimineshita | 0:736c76a75def | 35 | #if _READONLY == 0 |
hirokimineshita | 0:736c76a75def | 36 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); |
hirokimineshita | 0:736c76a75def | 37 | #endif |
hirokimineshita | 0:736c76a75def | 38 | DRESULT disk_ioctl (BYTE, BYTE, void*); |
hirokimineshita | 0:736c76a75def | 39 | void disk_timerproc (void); |
hirokimineshita | 0:736c76a75def | 40 | |
hirokimineshita | 0:736c76a75def | 41 | #ifdef __cplusplus |
hirokimineshita | 0:736c76a75def | 42 | }; |
hirokimineshita | 0:736c76a75def | 43 | #endif |
hirokimineshita | 0:736c76a75def | 44 | |
hirokimineshita | 0:736c76a75def | 45 | |
hirokimineshita | 0:736c76a75def | 46 | /* Disk Status Bits (DSTATUS) */ |
hirokimineshita | 0:736c76a75def | 47 | |
hirokimineshita | 0:736c76a75def | 48 | #define STA_NOINIT 0x01 /* Drive not initialized */ |
hirokimineshita | 0:736c76a75def | 49 | #define STA_NODISK 0x02 /* No medium in the drive */ |
hirokimineshita | 0:736c76a75def | 50 | #define STA_PROTECT 0x04 /* Write protected */ |
hirokimineshita | 0:736c76a75def | 51 | |
hirokimineshita | 0:736c76a75def | 52 | |
hirokimineshita | 0:736c76a75def | 53 | /* Command code for disk_ioctrl() */ |
hirokimineshita | 0:736c76a75def | 54 | |
hirokimineshita | 0:736c76a75def | 55 | /* Generic command */ |
hirokimineshita | 0:736c76a75def | 56 | #define CTRL_SYNC 0 /* Mandatory for read/write configuration */ |
hirokimineshita | 0:736c76a75def | 57 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ |
hirokimineshita | 0:736c76a75def | 58 | #define GET_SECTOR_SIZE 2 |
hirokimineshita | 0:736c76a75def | 59 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ |
hirokimineshita | 0:736c76a75def | 60 | #define CTRL_POWER 4 |
hirokimineshita | 0:736c76a75def | 61 | #define CTRL_LOCK 5 |
hirokimineshita | 0:736c76a75def | 62 | #define CTRL_EJECT 6 |
hirokimineshita | 0:736c76a75def | 63 | /* MMC/SDC command */ |
hirokimineshita | 0:736c76a75def | 64 | #define MMC_GET_TYPE 10 |
hirokimineshita | 0:736c76a75def | 65 | #define MMC_GET_CSD 11 |
hirokimineshita | 0:736c76a75def | 66 | #define MMC_GET_CID 12 |
hirokimineshita | 0:736c76a75def | 67 | #define MMC_GET_OCR 13 |
hirokimineshita | 0:736c76a75def | 68 | #define MMC_GET_SDSTAT 14 |
hirokimineshita | 0:736c76a75def | 69 | /* ATA/CF command */ |
hirokimineshita | 0:736c76a75def | 70 | #define ATA_GET_REV 20 |
hirokimineshita | 0:736c76a75def | 71 | #define ATA_GET_MODEL 21 |
hirokimineshita | 0:736c76a75def | 72 | #define ATA_GET_SN 22 |
hirokimineshita | 0:736c76a75def | 73 | |
hirokimineshita | 0:736c76a75def | 74 | |
hirokimineshita | 0:736c76a75def | 75 | #define _DISKIO |
hirokimineshita | 0:736c76a75def | 76 | #endif |