Murat Kilivan / USBFileSystem

Fork of USBFileSystem by Erik -

Committer:
Sissors
Date:
Wed Oct 23 20:32:07 2013 +0000
Revision:
2:9af05743d551
FATFileSystem 'Tiny' option enabled -> Primary to solve a buffering issue when USB writes a file, also reduces RAM consumed
;
; USBDevice back to main branch
;
; USBMode 1 is default now

Who changed what in which revision?

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