1 /*-----------------------------------------------------------------------
2 / Low level disk interface modlue include file
3 /-----------------------------------------------------------------------*/
7 #define _READONLY 0 /* 1: Remove write functions */
8 #define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */
13 /* Status of Disk Functions */
16 /* Results of Disk Functions */
18 RES_OK
= 0, /* 0: Successful */
19 RES_ERROR
, /* 1: R/W Error */
20 RES_WRPRT
, /* 2: Write Protected */
21 RES_NOTRDY
, /* 3: Not Ready */
22 RES_PARERR
/* 4: Invalid Parameter */
26 /*---------------------------------------*/
27 /* Prototypes for disk control functions */
29 int assign_drives (int, int);
30 DSTATUS
disk_initialize (BYTE
);
31 DSTATUS
disk_status (BYTE
);
32 DRESULT
disk_read (BYTE
, BYTE
*, DWORD
, BYTE
);
34 DRESULT
disk_write (BYTE
, const BYTE
*, DWORD
, BYTE
);
36 DRESULT
disk_ioctl (BYTE
, BYTE
, void*);
40 /* Disk Status Bits (DSTATUS) */
42 #define STA_NOINIT 0x01 /* Drive not initialized */
43 #define STA_NODISK 0x02 /* No medium in the drive */
44 #define STA_PROTECT 0x04 /* Write protected */
47 /* Command code for disk_ioctrl fucntion */
49 /* Generic command (defined for FatFs) */
50 #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
51 #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
52 #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
53 #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
54 #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
57 #define CTRL_POWER 5 /* Get/Set power status */
58 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
59 #define CTRL_EJECT 7 /* Eject media */
61 /* MMC/SDC specific ioctl command */
62 #define MMC_GET_TYPE 10 /* Get card type */
63 #define MMC_GET_CSD 11 /* Get CSD */
64 #define MMC_GET_CID 12 /* Get CID */
65 #define MMC_GET_OCR 13 /* Get OCR */
66 #define MMC_GET_SDSTAT 14 /* Get SD status */
68 /* ATA/CF specific ioctl command */
69 #define ATA_GET_REV 20 /* Get F/W revision */
70 #define ATA_GET_MODEL 21 /* Get model name */
71 #define ATA_GET_SN 22 /* Get serial number */
73 /* NAND specific ioctl command */
74 #define NAND_FORMAT 30 /* Create physical format */
76 /* Card type flags (CardType) */
77 #define CT_MMC 0x01 /* MMC ver 3 */
78 #define CT_SD1 0x02 /* SD ver 1 */
79 #define CT_SD2 0x04 /* SD ver 2 */
80 #define CT_SDC (CT_SD1|CT_SD2) /* SD */
81 #define CT_BLOCK 0x08 /* Block addressing */
This page took 0.04361 seconds and 5 git commands to generate.