comparison fatfs/diskio.h @ 49:ace431a0d0f5

Add SDIO code poached from STM. Use FatFS to read from SD card. LFN doesn't work reliably so it's disabled for now.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 03 Apr 2013 23:34:20 +1030
parents
children
comparison
equal deleted inserted replaced
48:2f336d212c74 49:ace431a0d0f5
1 /*-----------------------------------------------------------------------
2 / Low level disk interface modlue include file (C)ChaN, 2013
3 /-----------------------------------------------------------------------*/
4
5 #ifndef _DISKIO_DEFINED
6 #define _DISKIO_DEFINED
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #define _USE_WRITE 1 /* 1: Enable disk_write function */
13 #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
14
15 #include "integer.h"
16
17
18 /* Status of Disk Functions */
19 typedef BYTE DSTATUS;
20
21 /* Results of Disk Functions */
22 typedef enum {
23 RES_OK = 0, /* 0: Successful */
24 RES_ERROR, /* 1: R/W Error */
25 RES_WRPRT, /* 2: Write Protected */
26 RES_NOTRDY, /* 3: Not Ready */
27 RES_PARERR /* 4: Invalid Parameter */
28 } DRESULT;
29
30
31 /*---------------------------------------*/
32 /* Prototypes for disk control functions */
33
34
35 DSTATUS disk_initialize (BYTE pdrv);
36 DSTATUS disk_status (BYTE pdrv);
37 DRESULT disk_read (BYTE pdrv, BYTE*buff, DWORD sector, BYTE count);
38 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, BYTE count);
39 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
40
41
42 /* Disk Status Bits (DSTATUS) */
43 #define STA_NOINIT 0x01 /* Drive not initialized */
44 #define STA_NODISK 0x02 /* No medium in the drive */
45 #define STA_PROTECT 0x04 /* Write protected */
46
47
48 /* Command code for disk_ioctrl fucntion */
49
50 /* Generic command (used by FatFs) */
51 #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
52 #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
53 #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
54 #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
55 #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
56
57 /* Generic command (not used by FatFs) */
58 #define CTRL_POWER 5 /* Get/Set power status */
59 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
60 #define CTRL_EJECT 7 /* Eject media */
61 #define CTRL_FORMAT 8 /* Create physical format on the media */
62
63 /* MMC/SDC specific ioctl command */
64 #define MMC_GET_TYPE 10 /* Get card type */
65 #define MMC_GET_CSD 11 /* Get CSD */
66 #define MMC_GET_CID 12 /* Get CID */
67 #define MMC_GET_OCR 13 /* Get OCR */
68 #define MMC_GET_SDSTAT 14 /* Get SD status */
69
70 /* ATA/CF specific ioctl command */
71 #define ATA_GET_REV 20 /* Get F/W revision */
72 #define ATA_GET_MODEL 21 /* Get model name */
73 #define ATA_GET_SN 22 /* Get serial number */
74
75
76 /* MMC card type flags (MMC_GET_TYPE) */
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 */
82
83
84 #ifdef __cplusplus
85 }
86 #endif
87
88 #endif