Nicholas Herriot / VodafoneK3770Lib
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers diskio.h Source File

diskio.h

00001 /*-----------------------------------------------------------------------
00002 /  Low level disk interface modlue include file  R0.06   (C)ChaN, 2007
00003 /-----------------------------------------------------------------------*/
00004 
00005 #ifndef _DISKIO
00006 
00007 #define _READONLY   0   /* 1: Read-only mode */
00008 #define _USE_IOCTL  1
00009 
00010 #include "integer.h"
00011 
00012 
00013 /* Status of Disk Functions */
00014 typedef BYTE    DSTATUS;
00015 
00016 /* Results of Disk Functions */
00017 typedef enum {
00018     RES_OK = 0,     /* 0: Successful */
00019     RES_ERROR,      /* 1: R/W Error */
00020     RES_WRPRT,      /* 2: Write Protected */
00021     RES_NOTRDY,     /* 3: Not Ready */
00022     RES_PARERR      /* 4: Invalid Parameter */
00023 } DRESULT;
00024 
00025 
00026 /*---------------------------------------*/
00027 /* Prototypes for disk control functions */
00028 
00029 DSTATUS disk_initialize (BYTE);
00030 DSTATUS disk_status (BYTE);
00031 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
00032 #if _READONLY == 0
00033 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
00034 #endif
00035 DRESULT disk_ioctl (BYTE, BYTE, void*);
00036 void    disk_timerproc (void);
00037 
00038 
00039 
00040 
00041 /* Disk Status Bits (DSTATUS) */
00042 
00043 #define STA_NOINIT      0x01    /* Drive not initialized */
00044 #define STA_NODISK      0x02    /* No medium in the drive */
00045 #define STA_PROTECT     0x04    /* Write protected */
00046 
00047 
00048 /* Command code for disk_ioctrl() */
00049 
00050 /* Generic command */
00051 #define CTRL_SYNC           0   /* Mandatory for read/write configuration */
00052 #define GET_SECTOR_COUNT    1   /* Mandatory for only f_mkfs() */
00053 #define GET_SECTOR_SIZE     2
00054 #define GET_BLOCK_SIZE      3   /* Mandatory for only f_mkfs() */
00055 #define CTRL_POWER          4
00056 #define CTRL_LOCK           5
00057 #define CTRL_EJECT          6
00058 /* MMC/SDC command */
00059 #define MMC_GET_TYPE        10
00060 #define MMC_GET_CSD         11
00061 #define MMC_GET_CID         12
00062 #define MMC_GET_OCR         13
00063 #define MMC_GET_SDSTAT      14
00064 /* ATA/CF command */
00065 #define ATA_GET_REV         20
00066 #define ATA_GET_MODEL       21
00067 #define ATA_GET_SN          22
00068 
00069 
00070 #define _DISKIO
00071 #endif