Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE mbed wave_player
SDFileSystem/FATFileSystem/ChaN/diskio.h@1:c18c231cb299, 2017-11-08 (annotated)
- Committer:
- rconnorlawson
- Date:
- Wed Nov 08 21:01:43 2017 +0000
- Revision:
- 1:c18c231cb299
- Parent:
- 0:cf4396614a79
Fix delta computation in physics update.
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| rconnorlawson | 0:cf4396614a79 | 1 | //----------------------------------------------------------------------- | 
| rconnorlawson | 0:cf4396614a79 | 2 | // Low level disk interface modlue include file | 
| rconnorlawson | 0:cf4396614a79 | 3 | //----------------------------------------------------------------------- | 
| rconnorlawson | 0:cf4396614a79 | 4 | |
| rconnorlawson | 0:cf4396614a79 | 5 | #ifndef _DISKIO | 
| rconnorlawson | 0:cf4396614a79 | 6 | |
| rconnorlawson | 0:cf4396614a79 | 7 | #define _READONLY 0 // 1: Remove write functions | 
| rconnorlawson | 0:cf4396614a79 | 8 | #define _USE_IOCTL 1 // 1: Use disk_ioctl fucntion | 
| rconnorlawson | 0:cf4396614a79 | 9 | |
| rconnorlawson | 0:cf4396614a79 | 10 | #include "integer.h" | 
| rconnorlawson | 0:cf4396614a79 | 11 | |
| rconnorlawson | 0:cf4396614a79 | 12 | |
| rconnorlawson | 0:cf4396614a79 | 13 | // Status of Disk Functions | 
| rconnorlawson | 0:cf4396614a79 | 14 | typedef BYTE DSTATUS; | 
| rconnorlawson | 0:cf4396614a79 | 15 | |
| rconnorlawson | 0:cf4396614a79 | 16 | // Results of Disk Functions | 
| rconnorlawson | 0:cf4396614a79 | 17 | typedef enum { | 
| rconnorlawson | 0:cf4396614a79 | 18 | RES_OK = 0, // 0: Successful | 
| rconnorlawson | 0:cf4396614a79 | 19 | RES_ERROR, // 1: R/W Error | 
| rconnorlawson | 0:cf4396614a79 | 20 | RES_WRPRT, // 2: Write Protected | 
| rconnorlawson | 0:cf4396614a79 | 21 | RES_NOTRDY, // 3: Not Ready | 
| rconnorlawson | 0:cf4396614a79 | 22 | RES_PARERR // 4: Invalid Parameter | 
| rconnorlawson | 0:cf4396614a79 | 23 | } DRESULT; | 
| rconnorlawson | 0:cf4396614a79 | 24 | |
| rconnorlawson | 0:cf4396614a79 | 25 | |
| rconnorlawson | 0:cf4396614a79 | 26 | // Prototypes for disk control functions | 
| rconnorlawson | 0:cf4396614a79 | 27 | |
| rconnorlawson | 0:cf4396614a79 | 28 | int assign_drives (int, int); | 
| rconnorlawson | 0:cf4396614a79 | 29 | DSTATUS disk_initialize (BYTE); | 
| rconnorlawson | 0:cf4396614a79 | 30 | DSTATUS disk_status (BYTE); | 
| rconnorlawson | 0:cf4396614a79 | 31 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); | 
| rconnorlawson | 0:cf4396614a79 | 32 | #if _READONLY == 0 | 
| rconnorlawson | 0:cf4396614a79 | 33 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); | 
| rconnorlawson | 0:cf4396614a79 | 34 | #endif | 
| rconnorlawson | 0:cf4396614a79 | 35 | DRESULT disk_ioctl (BYTE, BYTE, void*); | 
| rconnorlawson | 0:cf4396614a79 | 36 | |
| rconnorlawson | 0:cf4396614a79 | 37 | |
| rconnorlawson | 0:cf4396614a79 | 38 | |
| rconnorlawson | 0:cf4396614a79 | 39 | // Disk Status Bits (DSTATUS) | 
| rconnorlawson | 0:cf4396614a79 | 40 | #define STA_NOINIT 0x01 // Drive not initialized | 
| rconnorlawson | 0:cf4396614a79 | 41 | #define STA_NODISK 0x02 // No medium in the drive | 
| rconnorlawson | 0:cf4396614a79 | 42 | #define STA_PROTECT 0x04 // Write protected | 
| rconnorlawson | 0:cf4396614a79 | 43 | |
| rconnorlawson | 0:cf4396614a79 | 44 | |
| rconnorlawson | 0:cf4396614a79 | 45 | // Command code for disk_ioctrl fucntion | 
| rconnorlawson | 0:cf4396614a79 | 46 | |
| rconnorlawson | 0:cf4396614a79 | 47 | // Generic command (defined for FatFs) | 
| rconnorlawson | 0:cf4396614a79 | 48 | #define CTRL_SYNC 0 // Flush disk cache (for write functions) | 
| rconnorlawson | 0:cf4396614a79 | 49 | #define GET_SECTOR_COUNT 1 // Get media size (for only f_mkfs()) | 
| rconnorlawson | 0:cf4396614a79 | 50 | #define GET_SECTOR_SIZE 2 // Get sector size (for multiple sector size (_MAX_SS >= 1024)) | 
| rconnorlawson | 0:cf4396614a79 | 51 | #define GET_BLOCK_SIZE 3 // Get erase block size (for only f_mkfs()) | 
| rconnorlawson | 0:cf4396614a79 | 52 | #define CTRL_ERASE_SECTOR 4 // Force erased a block of sectors (for only _USE_ERASE) | 
| rconnorlawson | 0:cf4396614a79 | 53 | |
| rconnorlawson | 0:cf4396614a79 | 54 | // Generic command | 
| rconnorlawson | 0:cf4396614a79 | 55 | #define CTRL_POWER 5 // Get/Set power status | 
| rconnorlawson | 0:cf4396614a79 | 56 | #define CTRL_LOCK 6 // Lock/Unlock media removal | 
| rconnorlawson | 0:cf4396614a79 | 57 | #define CTRL_EJECT 7 // Eject media | 
| rconnorlawson | 0:cf4396614a79 | 58 | |
| rconnorlawson | 0:cf4396614a79 | 59 | // MMC/SDC specific ioctl command | 
| rconnorlawson | 0:cf4396614a79 | 60 | #define MMC_GET_TYPE 10 // Get card type | 
| rconnorlawson | 0:cf4396614a79 | 61 | #define MMC_GET_CSD 11 // Get CSD | 
| rconnorlawson | 0:cf4396614a79 | 62 | #define MMC_GET_CID 12 // Get CID | 
| rconnorlawson | 0:cf4396614a79 | 63 | #define MMC_GET_OCR 13 // Get OCR | 
| rconnorlawson | 0:cf4396614a79 | 64 | #define MMC_GET_SDSTAT 14 // Get SD status | 
| rconnorlawson | 0:cf4396614a79 | 65 | |
| rconnorlawson | 0:cf4396614a79 | 66 | // ATA/CF specific ioctl command | 
| rconnorlawson | 0:cf4396614a79 | 67 | #define ATA_GET_REV 20 // Get F/W revision | 
| rconnorlawson | 0:cf4396614a79 | 68 | #define ATA_GET_MODEL 21 // Get model name | 
| rconnorlawson | 0:cf4396614a79 | 69 | #define ATA_GET_SN 22 // Get serial number | 
| rconnorlawson | 0:cf4396614a79 | 70 | |
| rconnorlawson | 0:cf4396614a79 | 71 | // NAND specific ioctl command | 
| rconnorlawson | 0:cf4396614a79 | 72 | #define NAND_FORMAT 30 // Create physical format | 
| rconnorlawson | 0:cf4396614a79 | 73 | |
| rconnorlawson | 0:cf4396614a79 | 74 | |
| rconnorlawson | 0:cf4396614a79 | 75 | #define _DISKIO | 
| rconnorlawson | 0:cf4396614a79 | 76 | #endif |