Rev Author Line No. Line
1234 kaklik 1 /*-----------------------------------------------------------------------
2 / Low level disk interface modlue include file R0.04a (C)ChaN, 2007
3 /-----------------------------------------------------------------------*/
4  
5 #ifndef _DISKIO
6  
7 #define _READONLY 0 /* 1: Read-only mode */
8  
9 #include "integer.h"
10  
11  
12 /* Status of Disk Functions */
13 typedef BYTE DSTATUS;
14  
15 /* Results of Disk Functions */
16 typedef enum {
17 RES_OK = 0, /* 0: Successful */
18 RES_ERROR, /* 1: R/W Error */
19 RES_WRPRT, /* 2: Write Protected */
20 RES_NOTRDY, /* 3: Not Ready */
21 RES_PARERR /* 4: Invalid Parameter */
22 } DRESULT;
23  
24  
25 /*---------------------------------------*/
26 /* Prototypes for disk control functions */
27  
28 DSTATUS disk_initialize (BYTE);
29 DSTATUS disk_status (BYTE);
30 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
31 #if _READONLY == 0
32 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
33 #endif
34 DRESULT disk_ioctl (BYTE, BYTE, void*);
35 void disk_timerproc (void);
36  
37  
38  
39  
40 /* Disk Status Bits (DSTATUS) */
41  
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 */
45  
46  
47 /* Command code for disk_ioctrl() */
48  
49 #define GET_SECTOR_COUNT 1
50 #define GET_SECTOR_SIZE 2
51 #define CTRL_SYNC 3
52 #define CTRL_POWER 4
53 #define CTRL_LOCK 5
54 #define CTRL_EJECT 6
55 #define MMC_GET_CSD 10
56 #define MMC_GET_CID 11
57 #define MMC_GET_OCR 12
58 #define ATA_GET_REV 20
59 #define ATA_GET_MODEL 21
60 #define ATA_GET_SN 22
61  
62  
63 #define _DISKIO
64 #endif