OSDN Git Service

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