Local copy of the FatFileSystem.

Dependents:   SimpleWaveRecorderPlayer y_CameraC1098_ES_01 _test_SDHCFileSystem Application-SimpleWaveRecorderPlayerGenerator ... more

Committer:
shintamainjp
Date:
Sat Apr 14 02:24:08 2012 +0000
Revision:
0:8c55801ce311
Initial version.

Who changed what in which revision?

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