help :(

Dependencies:   FFT

Committer:
dimitryjl23
Date:
Fri Dec 04 18:01:22 2020 +0000
Revision:
11:951bbb0385aa
Parent:
0:d6c9b09b4042
Final :)

Who changed what in which revision?

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