• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

diskio.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------
00002 /  Low level disk interface modlue include file
00003 /-----------------------------------------------------------------------*/
00004 
00005 #ifndef _DISKIO
00006 
00007 #define _READONLY       0       /* 1: Remove write functions */
00008 #define _USE_IOCTL      1       /* 1: Use disk_ioctl fucntion */
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 int assign_drives (int, int);
00030 DSTATUS disk_initialize (BYTE);
00031 DSTATUS disk_status (BYTE);
00032 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
00033 #if     _READONLY == 0
00034 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
00035 #endif
00036 DRESULT disk_ioctl (BYTE, BYTE, void*);
00037 
00038 
00039 
00040 /* Disk Status Bits (DSTATUS) */
00041 
00042 #define STA_NOINIT              0x01    /* Drive not initialized */
00043 #define STA_NODISK              0x02    /* No medium in the drive */
00044 #define STA_PROTECT             0x04    /* Write protected */
00045 
00046 
00047 /* Command code for disk_ioctrl fucntion */
00048 
00049 /* Generic command (defined for FatFs) */
00050 #define CTRL_SYNC                       0       /* Flush disk cache (for write functions) */
00051 #define GET_SECTOR_COUNT        1       /* Get media size (for only f_mkfs()) */
00052 #define GET_SECTOR_SIZE         2       /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
00053 #define GET_BLOCK_SIZE          3       /* Get erase block size (for only f_mkfs()) */
00054 #define CTRL_ERASE_SECTOR       4       /* Force erased a block of sectors (for only _USE_ERASE) */
00055 
00056 /* Generic command */
00057 #define CTRL_POWER                      5       /* Get/Set power status */
00058 #define CTRL_LOCK                       6       /* Lock/Unlock media removal */
00059 #define CTRL_EJECT                      7       /* Eject media */
00060 
00061 /* MMC/SDC specific ioctl command */
00062 #define MMC_GET_TYPE            10      /* Get card type */
00063 #define MMC_GET_CSD                     11      /* Get CSD */
00064 #define MMC_GET_CID                     12      /* Get CID */
00065 #define MMC_GET_OCR                     13      /* Get OCR */
00066 #define MMC_GET_SDSTAT          14      /* Get SD status */
00067 
00068 /* ATA/CF specific ioctl command */
00069 #define ATA_GET_REV                     20      /* Get F/W revision */
00070 #define ATA_GET_MODEL           21      /* Get model name */
00071 #define ATA_GET_SN                      22      /* Get serial number */
00072 
00073 /* NAND specific ioctl command */
00074 #define NAND_FORMAT                     30      /* Create physical format */
00075 
00076 
00077 #define _DISKIO
00078 #endif

Generated on Wed Aug 22 2012 11:44:35 by  doxygen 1.7.1