s

Fork of FATFileSystem by Chaiyaporn Boonyasathian

Committer:
583405000008
Date:
Tue Dec 06 07:22:42 2016 +0000
Revision:
1:6fa3f673d44c
Parent:
0:9296bb2a98a8
d;

Who changed what in which revision?

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