1
2
3
4 #ifndef _LINUX_OPTCD_H
5
6 #define _LINUX_OPTCD_H
7
8
9 #define OPTCD_PORTBASE 0x340
10
11 #define DATA_PORT optcd_port
12 #define STATUS_PORT optcd_port+1
13
14 #define COMIN_PORT optcd_port
15 #define RESET_PORT optcd_port+1
16 #define HCON_PORT optcd_port+2
17
18
19
20 #define ST_DRVERR 0x80
21 #define ST_DOOR_OPEN 0x40
22 #define ST_MIXEDMODE_DISK 0x20
23 #define ST_MODE_BITS 0x1c
24 #define ST_M_STOP 0x00
25 #define ST_M_READ 0x04
26 #define ST_M_AUDIO 0x04
27 #define ST_M_PAUSE 0x08
28 #define ST_M_INITIAL 0x0c
29 #define ST_M_ERROR 0x10
30 #define ST_M_OTHERS 0x14
31 #define ST_MODE2TRACK 0x02
32 #define ST_DSK_CHG 0x01
33 #define ST_L_LOCK 0x01
34 #define ST_CMD_OK 0x00
35 #define ST_OP_OK 0x01
36 #define ST_PA_OK 0x02
37 #define ST_OP_ERROR 0x05
38 #define ST_PA_ERROR 0x06
39
40
41
42 #define ERR_ILLCMD 0x11
43 #define ERR_ILLPARM 0x12
44 #define ERR_SLEDGE 0x13
45 #define ERR_FOCUS 0x14
46 #define ERR_MOTOR 0x15
47 #define ERR_RADIAL 0x16
48 #define ERR_PLL 0x17
49 #define ERR_SUB_TIM 0x18
50 #define ERR_SUB_NF 0x19
51 #define ERR_TRAY 0x1a
52 #define ERR_TOC 0x1b
53 #define ERR_JUMP 0x1c
54
55 #define ERR_MODE 0x21
56 #define ERR_FORM 0x22
57 #define ERR_HEADADDR 0x23
58 #define ERR_CRC 0x24
59 #define ERR_ECC 0x25
60 #define ERR_CRC_UNC 0x26
61 #define ERR_ILLBSYNC 0x27
62 #define ERR_VDST 0x28
63
64 #define ERR_READ_TIM 0x31
65 #define ERR_DEC_STP 0x32
66 #define ERR_DEC_TIM 0x33
67
68 #define ERR_KEY 0x41
69 #define ERR_READ_FINISH 0x42
70
71 #define ERR_NOBSYNC 0x01
72 #define ERR_SHORTB 0x02
73 #define ERR_LONGB 0x03
74 #define ERR_SHORTDSP 0x04
75 #define ERR_LONGDSP 0x05
76
77
78
79 #define FL_EJECT 0x20
80 #define FL_WAIT 0x10
81 #define FL_EOP 0x08
82 #define FL_STEN 0x04
83 #define FL_DTEN 0x02
84 #define FL_DRQ 0x01
85 #define FL_RESET 0xde
86 #define FL_STDT (FL_STEN|FL_DTEN)
87
88
89
90 #define HCON_DTS 0x08
91 #define HCON_SDRQB 0x04
92 #define HCON_LOHI 0x02
93 #define HCON_DMA16 0x01
94
95
96
97
98 #define COMDRVST 0x20
99 #define COMERRST 0x21
100 #define COMIOCTLISTAT 0x22
101 #define COMINITSINGLE 0x28
102 #define COMINITDOUBLE 0x29
103 #define COMUNLOCK 0x30
104 #define COMLOCK 0x31
105 #define COMLOCKST 0x32
106 #define COMVERSION 0x40
107 #define COMVOIDREADMODE 0x50
108
109 #define COMFETCH 0x60
110 #define COMREAD 0x61
111 #define COMREADRAW 0x62
112 #define COMREADALL 0x63
113
114 #define COMLEADIN 0x70
115 #define COMSEEK 0x71
116 #define COMPAUSEON 0x80
117 #define COMPAUSEOFF 0x81
118 #define COMSTOP 0x82
119 #define COMOPEN 0x90
120 #define COMCLOSE 0x91
121 #define COMPLAY 0xa0
122 #define COMPLAY_TNO 0xa2
123 #define COMSUBQ 0xb0
124 #define COMLOCATION 0xb1
125
126 #define COMCHCTRL 0xc0
127
128 #define COMDRVTEST 0xd0
129 #define COMTEST 0xd1
130
131
132 #define BUSY_TIMEOUT 10000000
133 #define SLEEP_TIMEOUT 400
134 #define READ_TIMEOUT 3000
135 #define RESET_WAIT 1000
136
137 #define SET_TIMER(func, jifs) \
138 delay_timer.expires = jifs; \
139 delay_timer.function = (void *) func; \
140 add_timer(&delay_timer);
141 #define CLEAR_TIMER del_timer(&delay_timer)
142
143 #define MAX_TRACKS 104
144
145 struct msf {
146 unsigned char min;
147 unsigned char sec;
148 unsigned char frame;
149 };
150
151 struct opt_Play_msf {
152 struct msf start;
153 struct msf end;
154 };
155
156 struct opt_DiskInfo {
157 unsigned char first;
158 unsigned char last;
159 struct msf diskLength;
160 struct msf firstTrack;
161 };
162
163 struct opt_Toc {
164 unsigned char ctrl_addr;
165 unsigned char track;
166 unsigned char pointIndex;
167 struct msf trackTime;
168 struct msf diskTime;
169 };
170
171
172 #define CURRENT_VALID \
173 (CURRENT && MAJOR(CURRENT -> dev) == MAJOR_NR \
174 && CURRENT -> cmd == READ && CURRENT -> sector != -1)
175
176
177 #undef DEBUG_DRIVE_IF
178 #undef DEBUG_COMMANDS
179 #undef DEBUG_VFS
180 #undef DEBUG_CONV
181 #undef DEBUG_TOC
182 #undef DEBUG_BUFFERS
183 #undef DEBUG_REQUEST
184 #undef DEBUG_STATE
185
186
187
188
189
190 #define ERR_IF_CMD_TIMEOUT 0x100
191 #define ERR_IF_ERR_TIMEOUT 0x101
192 #define ERR_IF_RESP_TIMEOUT 0x102
193 #define ERR_IF_DATA_TIMEOUT 0x103
194 #define ERR_IF_NOSTAT 0x104
195
196 #define ERR_TOC_MISSINGINFO 0x120
197 #define ERR_TOC_MISSINGENTRY 0x121
198
199
200 #endif _LINUX_OPTCD_H