Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:54:50 2016 +0000
Revision:
1:d96dbedaebdb
Parent:
0:6c56fb4bc5f0
Removed extra directories for other platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 /*-----------------------------------------------------------------------/
nexpaq 0:6c56fb4bc5f0 2 / Low level disk interface modlue include file (C)ChaN, 2014 /
nexpaq 0:6c56fb4bc5f0 3 /-----------------------------------------------------------------------*/
nexpaq 0:6c56fb4bc5f0 4
nexpaq 0:6c56fb4bc5f0 5 #ifndef _DISKIO_DEFINED
nexpaq 0:6c56fb4bc5f0 6 #define _DISKIO_DEFINED
nexpaq 0:6c56fb4bc5f0 7
nexpaq 0:6c56fb4bc5f0 8 #ifdef __cplusplus
nexpaq 0:6c56fb4bc5f0 9 extern "C" {
nexpaq 0:6c56fb4bc5f0 10 #endif
nexpaq 0:6c56fb4bc5f0 11
nexpaq 0:6c56fb4bc5f0 12 #define _USE_WRITE 1 /* 1: Enable disk_write function */
nexpaq 0:6c56fb4bc5f0 13 #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
nexpaq 0:6c56fb4bc5f0 14
nexpaq 0:6c56fb4bc5f0 15 #include "integer.h"
nexpaq 0:6c56fb4bc5f0 16
nexpaq 0:6c56fb4bc5f0 17
nexpaq 0:6c56fb4bc5f0 18 /* Status of Disk Functions */
nexpaq 0:6c56fb4bc5f0 19 typedef BYTE DSTATUS;
nexpaq 0:6c56fb4bc5f0 20
nexpaq 0:6c56fb4bc5f0 21 /* Results of Disk Functions */
nexpaq 0:6c56fb4bc5f0 22 typedef enum {
nexpaq 0:6c56fb4bc5f0 23 RES_OK = 0, /* 0: Successful */
nexpaq 0:6c56fb4bc5f0 24 RES_ERROR, /* 1: R/W Error */
nexpaq 0:6c56fb4bc5f0 25 RES_WRPRT, /* 2: Write Protected */
nexpaq 0:6c56fb4bc5f0 26 RES_NOTRDY, /* 3: Not Ready */
nexpaq 0:6c56fb4bc5f0 27 RES_PARERR /* 4: Invalid Parameter */
nexpaq 0:6c56fb4bc5f0 28 } DRESULT;
nexpaq 0:6c56fb4bc5f0 29
nexpaq 0:6c56fb4bc5f0 30
nexpaq 0:6c56fb4bc5f0 31 /*---------------------------------------*/
nexpaq 0:6c56fb4bc5f0 32 /* Prototypes for disk control functions */
nexpaq 0:6c56fb4bc5f0 33
nexpaq 0:6c56fb4bc5f0 34
nexpaq 0:6c56fb4bc5f0 35 DSTATUS disk_initialize (BYTE pdrv);
nexpaq 0:6c56fb4bc5f0 36 DSTATUS disk_status (BYTE pdrv);
nexpaq 0:6c56fb4bc5f0 37 DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
nexpaq 0:6c56fb4bc5f0 38 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
nexpaq 0:6c56fb4bc5f0 39 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
nexpaq 0:6c56fb4bc5f0 40
nexpaq 0:6c56fb4bc5f0 41
nexpaq 0:6c56fb4bc5f0 42 /* Disk Status Bits (DSTATUS) */
nexpaq 0:6c56fb4bc5f0 43
nexpaq 0:6c56fb4bc5f0 44 #define STA_NOINIT 0x01 /* Drive not initialized */
nexpaq 0:6c56fb4bc5f0 45 #define STA_NODISK 0x02 /* No medium in the drive */
nexpaq 0:6c56fb4bc5f0 46 #define STA_PROTECT 0x04 /* Write protected */
nexpaq 0:6c56fb4bc5f0 47
nexpaq 0:6c56fb4bc5f0 48
nexpaq 0:6c56fb4bc5f0 49 /* Command code for disk_ioctrl fucntion */
nexpaq 0:6c56fb4bc5f0 50
nexpaq 0:6c56fb4bc5f0 51 /* Generic command (Used by FatFs) */
nexpaq 0:6c56fb4bc5f0 52 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
nexpaq 0:6c56fb4bc5f0 53 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
nexpaq 0:6c56fb4bc5f0 54 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
nexpaq 0:6c56fb4bc5f0 55 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
nexpaq 0:6c56fb4bc5f0 56 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
nexpaq 0:6c56fb4bc5f0 57
nexpaq 0:6c56fb4bc5f0 58 /* Generic command (Not used by FatFs) */
nexpaq 0:6c56fb4bc5f0 59 #define CTRL_POWER 5 /* Get/Set power status */
nexpaq 0:6c56fb4bc5f0 60 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
nexpaq 0:6c56fb4bc5f0 61 #define CTRL_EJECT 7 /* Eject media */
nexpaq 0:6c56fb4bc5f0 62 #define CTRL_FORMAT 8 /* Create physical format on the media */
nexpaq 0:6c56fb4bc5f0 63
nexpaq 0:6c56fb4bc5f0 64 /* MMC/SDC specific ioctl command */
nexpaq 0:6c56fb4bc5f0 65 #define MMC_GET_TYPE 10 /* Get card type */
nexpaq 0:6c56fb4bc5f0 66 #define MMC_GET_CSD 11 /* Get CSD */
nexpaq 0:6c56fb4bc5f0 67 #define MMC_GET_CID 12 /* Get CID */
nexpaq 0:6c56fb4bc5f0 68 #define MMC_GET_OCR 13 /* Get OCR */
nexpaq 0:6c56fb4bc5f0 69 #define MMC_GET_SDSTAT 14 /* Get SD status */
nexpaq 0:6c56fb4bc5f0 70
nexpaq 0:6c56fb4bc5f0 71 /* ATA/CF specific ioctl command */
nexpaq 0:6c56fb4bc5f0 72 #define ATA_GET_REV 20 /* Get F/W revision */
nexpaq 0:6c56fb4bc5f0 73 #define ATA_GET_MODEL 21 /* Get model name */
nexpaq 0:6c56fb4bc5f0 74 #define ATA_GET_SN 22 /* Get serial number */
nexpaq 0:6c56fb4bc5f0 75
nexpaq 0:6c56fb4bc5f0 76 #ifdef __cplusplus
nexpaq 0:6c56fb4bc5f0 77 }
nexpaq 0:6c56fb4bc5f0 78 #endif
nexpaq 0:6c56fb4bc5f0 79
nexpaq 0:6c56fb4bc5f0 80 #endif