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