Updated FAT File System driver. Features include: * Updated to R0.09 - Sep 06, 2011 [[http://elm-chan.org/fsw/ff/00index_e.html]] * Bug fixes from Stéphane Bausseron ** [[http://mbed.org/forum/mbed/topic/2273/?page=1#comment-11521]] ** [[http://mbed.org/forum/mbed/topic/2307]] * Long filename support enabled and exposed through mbed SDK.

Dependents:   WeatherStation GPSLogger Deneme dotHR_EKF ... more

Committer:
AdamGreen
Date:
Sun Dec 25 01:45:20 2011 +0000
Revision:
0:6ceefe1c53e4

        

Who changed what in which revision?

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