hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hattori_atsushi 0:f77369cabd75 1 /*-----------------------------------------------------------------------
hattori_atsushi 0:f77369cabd75 2 / Low level disk interface modlue include file
hattori_atsushi 0:f77369cabd75 3 /-----------------------------------------------------------------------*/
hattori_atsushi 0:f77369cabd75 4
hattori_atsushi 0:f77369cabd75 5 #ifndef _DISKIO
hattori_atsushi 0:f77369cabd75 6
hattori_atsushi 0:f77369cabd75 7 #define _READONLY 0 /* 1: Remove write functions */
hattori_atsushi 0:f77369cabd75 8 #define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */
hattori_atsushi 0:f77369cabd75 9
hattori_atsushi 0:f77369cabd75 10 #include "integer.h"
hattori_atsushi 0:f77369cabd75 11
hattori_atsushi 0:f77369cabd75 12
hattori_atsushi 0:f77369cabd75 13 /* Status of Disk Functions */
hattori_atsushi 0:f77369cabd75 14 typedef BYTE DSTATUS;
hattori_atsushi 0:f77369cabd75 15
hattori_atsushi 0:f77369cabd75 16 /* Results of Disk Functions */
hattori_atsushi 0:f77369cabd75 17 typedef enum {
hattori_atsushi 0:f77369cabd75 18 RES_OK = 0, /* 0: Successful */
hattori_atsushi 0:f77369cabd75 19 RES_ERROR, /* 1: R/W Error */
hattori_atsushi 0:f77369cabd75 20 RES_WRPRT, /* 2: Write Protected */
hattori_atsushi 0:f77369cabd75 21 RES_NOTRDY, /* 3: Not Ready */
hattori_atsushi 0:f77369cabd75 22 RES_PARERR /* 4: Invalid Parameter */
hattori_atsushi 0:f77369cabd75 23 } DRESULT;
hattori_atsushi 0:f77369cabd75 24
hattori_atsushi 0:f77369cabd75 25
hattori_atsushi 0:f77369cabd75 26 /*---------------------------------------*/
hattori_atsushi 0:f77369cabd75 27 /* Prototypes for disk control functions */
hattori_atsushi 0:f77369cabd75 28
hattori_atsushi 0:f77369cabd75 29 int assign_drives (int, int);
hattori_atsushi 0:f77369cabd75 30 DSTATUS disk_initialize (BYTE);
hattori_atsushi 0:f77369cabd75 31 DSTATUS disk_status (BYTE);
hattori_atsushi 0:f77369cabd75 32 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
hattori_atsushi 0:f77369cabd75 33 #if _READONLY == 0
hattori_atsushi 0:f77369cabd75 34 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
hattori_atsushi 0:f77369cabd75 35 #endif
hattori_atsushi 0:f77369cabd75 36 DRESULT disk_ioctl (BYTE, BYTE, void*);
hattori_atsushi 0:f77369cabd75 37 void disk_timerproc (void);
hattori_atsushi 0:f77369cabd75 38
hattori_atsushi 0:f77369cabd75 39
hattori_atsushi 0:f77369cabd75 40
hattori_atsushi 0:f77369cabd75 41
hattori_atsushi 0:f77369cabd75 42 /* Disk Status Bits (DSTATUS) */
hattori_atsushi 0:f77369cabd75 43
hattori_atsushi 0:f77369cabd75 44 #define STA_NOINIT 0x01 /* Drive not initialized */
hattori_atsushi 0:f77369cabd75 45 #define STA_NODISK 0x02 /* No medium in the drive */
hattori_atsushi 0:f77369cabd75 46 #define STA_PROTECT 0x04 /* Write protected */
hattori_atsushi 0:f77369cabd75 47
hattori_atsushi 0:f77369cabd75 48
hattori_atsushi 0:f77369cabd75 49 /* Command code for disk_ioctrl fucntion */
hattori_atsushi 0:f77369cabd75 50
hattori_atsushi 0:f77369cabd75 51 /* Generic command (defined for FatFs) */
hattori_atsushi 0:f77369cabd75 52 #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
hattori_atsushi 0:f77369cabd75 53 #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
hattori_atsushi 0:f77369cabd75 54 #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
hattori_atsushi 0:f77369cabd75 55 #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
hattori_atsushi 0:f77369cabd75 56 #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
hattori_atsushi 0:f77369cabd75 57
hattori_atsushi 0:f77369cabd75 58 /* Generic command */
hattori_atsushi 0:f77369cabd75 59 #define CTRL_POWER 5 /* Get/Set power status */
hattori_atsushi 0:f77369cabd75 60 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
hattori_atsushi 0:f77369cabd75 61 #define CTRL_EJECT 7 /* Eject media */
hattori_atsushi 0:f77369cabd75 62
hattori_atsushi 0:f77369cabd75 63 /* MMC/SDC specific ioctl command */
hattori_atsushi 0:f77369cabd75 64 #define MMC_GET_TYPE 10 /* Get card type */
hattori_atsushi 0:f77369cabd75 65 #define MMC_GET_CSD 11 /* Get CSD */
hattori_atsushi 0:f77369cabd75 66 #define MMC_GET_CID 12 /* Get CID */
hattori_atsushi 0:f77369cabd75 67 #define MMC_GET_OCR 13 /* Get OCR */
hattori_atsushi 0:f77369cabd75 68 #define MMC_GET_SDSTAT 14 /* Get SD status */
hattori_atsushi 0:f77369cabd75 69
hattori_atsushi 0:f77369cabd75 70 /* ATA/CF specific ioctl command */
hattori_atsushi 0:f77369cabd75 71 #define ATA_GET_REV 20 /* Get F/W revision */
hattori_atsushi 0:f77369cabd75 72 #define ATA_GET_MODEL 21 /* Get model name */
hattori_atsushi 0:f77369cabd75 73 #define ATA_GET_SN 22 /* Get serial number */
hattori_atsushi 0:f77369cabd75 74
hattori_atsushi 0:f77369cabd75 75 /* NAND specific ioctl command */
hattori_atsushi 0:f77369cabd75 76 #define NAND_FORMAT 30 /* Create physical format */
hattori_atsushi 0:f77369cabd75 77
hattori_atsushi 0:f77369cabd75 78
hattori_atsushi 0:f77369cabd75 79 #define _DISKIO
hattori_atsushi 0:f77369cabd75 80 #endif