Dependencies:   mbed

Committer:
emh203
Date:
Thu Feb 16 00:41:26 2012 +0000
Revision:
0:76427232f435

        

Who changed what in which revision?

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