P2-2 Harris Barton

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Committer:
hbarton7
Date:
Wed Nov 25 01:17:39 2020 +0000
Revision:
3:e2fb359d6545
Parent:
1:10330bce85cb
P2-2 Harris Barton;

Who changed what in which revision?

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