Mark Schwarzer / SDFileSystem

Dependents:   Schwarzer_A7_1

Committer:
markschwarzer
Date:
Mon Nov 09 14:25:13 2020 +0000
Revision:
0:964d386ab059
logged data in SD card

Who changed what in which revision?

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