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