-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDSK.H
135 lines (103 loc) · 3.76 KB
/
DSK.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*-----------------------------------------------------------------------
/ Low level disk interface modlue include file R0.04a (C)ChaN, 2007
/-----------------------------------------------------------------------*/
#ifndef _DISKIO
#define _READONLY 0 /* 1: Read-only mode */
/* #include "integer.h" */
#define BYTE unsigned char
/* Definitions corresponds to multi partition */
#define _MULTI_PARTITION 1
/* When _MULTI_PARTITION is set to 0, each logical drive is bound to same
/ physical drive number and can mount only 1st primaly partition. When it is
/ set to 1, each logical drive can mount a partition listed in Drives[]. */
#if _MULTI_PARTITION != 0 /* Multiple partition cfg */
typedef struct _PARTITION {
BYTE pd; /* Physical drive # (0-255) */
int /*BYTE*/ pt; /* Partition # (0-3) */
#ifdef ORION_HOSTED
unsigned long size; /* Partition size (in LBA blocks) */
unsigned long po; /* Partition offset (LBA addr); 0=global/entire drive */
unsigned int pc; /* Partition offset checksumm */
char ptype; /* Partition type */
char mediaid; /* -1 = not opened, otherwise minor number */
#endif
} PARTITION;
#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
#define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
#ifdef ORION_HOSTED
#define LD2PS(drv) (Drives[drv].size) /* Get partition size */
#define LD2PO(drv) (Drives[drv].po) /* Get partition offset */
#define LD2PC(drv) (Drives[drv].pc) /* Get partition record checksumm */
#define LD2PY(drv) (Drives[drv].ptype) /* Get partition type */
#endif
#else /* Single partition cfg */
#define LD2PD(drv) (drv) /* Physical drive# is equal to logical drive# */
#define LD2PT(drv) 0 /* Always mounts the 1st partition */
#ifdef ORION_HOSTED
#define LD2PS(drv) 0 /* Must be initialized */
#define LD2PO(drv) 0 /* Always whole disk */
#define LD2PC(drv) 66 /* magic number */
#define LD2PY(drv) 0 /* partition type */
#endif
#endif
/* Status of Disk Functions */
typedef unsigned char DSTATUS;
typedef unsigned char DRESULT;
/* Results of Disk Functions */
/* +-serge*/
/*typedef enum { */
/* RES_OK = 0, 0: Successful */
/* RES_ERROR, 1: R/W Error */
/* RES_WRPRT, 2: Write Protected */
/* RES_NOTRDY, 3: Not Ready */
/* RES_PARERR 4: Invalid Parameter */
/*} DRESULT;*/
#define RES_OK 0 /* Successful */
#define RES_ERROR 1 /* R/W Error */
#define RES_WRPRT 2 /* Write Protected */
#define RES_NOTRDY 3 /* Not Ready */
#define RES_PARERR 4 /* Invalid Parameter */
/* serge*/
/*---------------------------------------*/
/* Prototypes for disk control functions */
#ifdef ORION_HOSTED
unsigned char init_drive(unsigned char drv);
#endif
DSTATUS disk_initialize (BYTE);
DSTATUS disk_status (BYTE);
#ifdef ORI_UZIX
DRESULT disk_read (BYTE, BYTE*, unsigned long, BYTE, BYTE);
#else
DRESULT disk_read (BYTE, BYTE*, unsigned long, BYTE);
#endif
#if _READONLY == 0
#ifdef ORI_UZIX
DRESULT disk_write (BYTE, BYTE*, unsigned long, BYTE, BYTE);
#else
DRESULT disk_write (BYTE, BYTE*, unsigned long, BYTE);
#endif
#endif
DRESULT disk_ioctl (BYTE, BYTE, void*);
/*void disk_timerproc (void);*/
/* Disk Status Bits (DSTATUS) */
#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */
/* Command code for disk_ioctrl() */
#define GET_SECTOR_COUNT 1
#define GET_SECTOR_SIZE 2
#define CTRL_SYNC 3
/*
#define CTRL_POWER 4
#define CTRL_LOCK 5
#define CTRL_EJECT 6
#define MMC_GET_CSD 10
#define MMC_GET_CID 11
#define MMC_GET_OCR 12
#define ATA_GET_REV 20
#define ATA_GET_MODEL 21
#define ATA_GET_SN 22
*/
#define GET_PARAMS_STRUCT 65
#define _DISKIO
#endif