megan gimple / SDFileSystem

Dependents:   gimple_A4_3_Temp_Light

Committer:
mgimple
Date:
Sat Nov 13 20:10:05 2021 +0000
Revision:
0:07ff9ae5339f
SD

Who changed what in which revision?

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