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 #if !(SBPCD_ISSUE-1)
45 #define CDROM_PORT 0x0340
46 #define SBPRO 0
47 #endif
48
49
50
51
52
53
54
55
56
57 #define SOUND_BASE 0x220
58
59
60
61 #if !(SBPCD_ISSUE-2)
62 #define CDROM_PORT 0x0320
63 #define SBPRO 0
64 #endif
65 #if !(SBPCD_ISSUE-3)
66 #define CDROM_PORT 0x0630
67 #define SBPRO 1
68 #endif
69 #if !(SBPCD_ISSUE-4)
70 #define CDROM_PORT 0x0634
71 #define SBPRO 0
72 #endif
73
74
75
76
77
78
79 #ifndef _LINUX_SBPCD_H
80
81 #define _LINUX_SBPCD_H
82
83
84
85
86
87
88
89 #define DDIOCSDBG 0x9000
90 #define DPRINTF(x) sbpcd_dprintf x
91
92
93
94
95
96 #define DBG_INF 1
97 #define DBG_BSZ 2
98 #define DBG_REA 3
99 #define DBG_CHK 4
100 #define DBG_TIM 5
101 #define DBG_INI 6
102 #define DBG_TOC 7
103 #define DBG_IOC 8
104 #define DBG_STA 9
105 #define DBG_ERR 10
106 #define DBG_CMD 11
107 #define DBG_WRN 12
108 #define DBG_MUL 13
109 #define DBG_ID 14
110 #define DBG_IOX 15
111 #define DBG_DID 16
112 #define DBG_RES 17
113 #define DBG_SPI 18
114 #define DBG_IOS 19
115 #define DBG_IO2 20
116 #define DBG_UPC 21
117 #define DBG_XA 22
118 #define DBG_LCK 23
119 #define DBG_SQ 24
120 #define DBG_AUD 25
121 #define DBG_SEQ 26
122 #define DBG_LCS 27
123 #define DBG_CD2 28
124 #define DBG_000 29
125
126
127
128
129
130
131
132 #define f_respo3 0x100
133 #define f_putcmd 0x80
134 #define f_respo2 0x40
135 #define f_lopsta 0x20
136 #define f_getsta 0x10
137 #define f_ResponseStatus 0x08
138 #define f_obey_p_check 0x04
139 #define f_bit1 0x02
140 #define f_wait_if_busy 0x01
141
142
143
144
145 #define x80_bit 0x80
146 #define upc_bit 0x40
147 #define volume_bit 0x20
148 #define toc_bit 0x10
149 #define multisession_bit 0x08
150 #define cd_size_bit 0x04
151 #define subq_bit 0x02
152 #define frame_size_bit 0x01
153
154
155
156
157 #define upc_valid (DriveStruct[d].diskstate_flags&upc_bit)
158 #define volume_valid (DriveStruct[d].diskstate_flags&volume_bit)
159 #define toc_valid (DriveStruct[d].diskstate_flags&toc_bit)
160 #define cd_size_valid (DriveStruct[d].diskstate_flags&cd_size_bit)
161 #define subq_valid (DriveStruct[d].diskstate_flags&subq_bit)
162 #define frame_size_valid (DriveStruct[d].diskstate_flags&frame_size_bit)
163
164
165
166
167 #define p_door_closed 0x80
168 #define p_caddy_in 0x40
169 #define p_spinning 0x20
170 #define p_check 0x10
171 #define p_busy_new 0x08
172 #define p_door_locked 0x04
173 #define p_bit_1 0x02
174 #define p_lcs_door_locked 0x02
175 #define p_disk_ok 0x01
176 #define p_lcs_door_closed 0x01
177
178
179
180 #define p_caddin_old 0x40
181 #define p_success_old 0x08
182 #define p_busy_old 0x04
183
184
185
186
187 #define p0_door_closed 0x80
188 #define p0_caddy_in 0x40
189 #define p0_spinning 0x20
190 #define p0_check 0x10
191 #define p0_success 0x08
192 #define p0_busy 0x04
193 #define p0_bit_1 0x02
194 #define p0_disk_ok 0x01
195
196 #define p1_door_closed 0x80
197 #define p1_disk_in 0x40
198 #define p1_spinning 0x20
199 #define p1_check 0x10
200 #define p1_busy 0x08
201 #define p1_door_locked 0x04
202 #define p1_bit_1 0x02
203 #define p1_disk_ok 0x01
204
205 #define p2_disk_ok 0x80
206 #define p2_door_locked 0x40
207 #define p2_spinning 0x20
208 #define p2_busy2 0x10
209 #define p2_busy1 0x08
210 #define p2_door_closed 0x04
211 #define p2_disk_in 0x02
212 #define p2_check 0x01
213
214
215
216
217 #define st_door_closed (DriveStruct[d].status_byte&p_door_closed)
218 #define st_caddy_in (DriveStruct[d].status_byte&p_caddy_in)
219 #define st_spinning (DriveStruct[d].status_byte&p_spinning)
220 #define st_check (DriveStruct[d].status_byte&p_check)
221 #define st_busy (DriveStruct[d].status_byte&p_busy_new)
222 #define st_door_locked (DriveStruct[d].status_byte&p_door_locked)
223 #define st_diskok (DriveStruct[d].status_byte&p_disk_ok)
224
225
226
227
228 #define s_not_result_ready 0x04
229 #define s_not_data_ready 0x02
230 #define s_attention 0x01
231
232
233
234 #define DRV_ATTN ((inb(CDi_status)&s_attention)!=0)
235 #define DATA_READY ((inb(CDi_status)&s_not_data_ready)==0)
236 #define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0)
237
238
239
240
241 #define drv_fam0 0x08
242 #define drv_199 (drv_fam0+0x01)
243 #define drv_200 (drv_fam0+0x02)
244 #define drv_201 (drv_fam0+0x03)
245 #define drv_210 (drv_fam0+0x04)
246 #define drv_211 (drv_fam0+0x05)
247 #define drv_300 (drv_fam0+0x06)
248
249 #define drv_famL 0x10
250 #define drv_260 (drv_famL+0x01)
251
252 #define drv_fam1 0x20
253 #define drv_099 (drv_fam1+0x01)
254 #define drv_100 (drv_fam1+0x02)
255
256 #define drv_fam2 0x80
257
258 #define fam0_drive (DriveStruct[d].drv_type&drv_fam0)
259 #define famL_drive (DriveStruct[d].drv_type&drv_famL)
260 #define fam1_drive (DriveStruct[d].drv_type&drv_fam1)
261 #define fam2_drive (DriveStruct[d].drv_type&drv_fam2)
262 #define fam0L_drive (DriveStruct[d].drv_type&(drv_fam0|drv_famL))
263 #define fam1L_drive (DriveStruct[d].drv_type&(drv_fam1|drv_famL))
264 #define fam01_drive (DriveStruct[d].drv_type&(drv_fam0|drv_fam1))
265
266
267
268
269 #define audio_playing 2
270 #define audio_pausing 1
271
272
273
274
275 #define speed_auto 0x80
276 #define speed_300 0x40
277 #define speed_150 0x20
278 #define audio_mono 0x04
279
280
281
282
283 #define READ_M1 0x01
284 #define READ_M2 0x02
285 #define READ_SC 0x04
286 #define READ_AU 0x08
287
288
289
290
291
292
293
294
295
296
297
298
299 #define aud_00 0x00
300 #define audx11 0x0b
301 #define audx12 0x0c
302 #define audx13 0x0d
303 #define audx14 0x0e
304 #define audx15 0x0f
305
306
307 #define aud_11 0x11
308 #define aud_12 0x12
309 #define aud_13 0x13
310 #define aud_14 0x14
311 #define aud_15 0x15
312
313
314
315
316
317 #define NR_SBPCD 4
318
319
320
321
322 #define SBPCD_DIS_IRQ 0
323
324
325
326
327 #define OUT(x,y) outb(y,x)
328
329
330
331
332 #define READ_DATA(port, buf, nr) insb(port, buf, nr)
333
334
335
336 #define MIXER_CD_Volume 0x28
337
338
339
340
341
342 #define MAX_TRACKS 120
343
344
345
346
347
348 typedef union _msf
349 {
350 u_int n;
351 u_char c[4];
352 }
353 MSF;
354
355 typedef union _blk
356 {
357 u_int n;
358 u_char c[4];
359 }
360 BLK;
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523 #define CMD1_RESET 0x0a
524 #define CMD2_RESET 0x01
525 #define CMD1_LOCK_CTL 0x0c
526 #define CMD2_LOCK_CTL 0x1e
527 #define CMDL_LOCK_CTL 0x0e
528 #define CMD1_TRAY_CTL 0x07
529 #define CMD2_TRAY_CTL 0x1b
530 #define CMDL_TRAY_CTL 0x0d
531 #define CMD1_MULTISESS 0x8d
532 #define CMDL_MULTISESS 0x8c
533 #define CMD1_SUBCHANINF 0x11
534 #define CMD2_SUBCHANINF 0x
535 #define CMD2_x02 0x02
536 #define CMD1_x08 0x08
537 #define CMD2_x08 0x08
538 #define CMD2_SETSPEED 0xda
539
540 #define CMD0_PATH_CHECK 0x00
541 #define CMD1_PATH_CHECK 0x00
542 #define CMD2_PATH_CHECK 0x
543 #define CMDL_PATH_CHECK 0x00
544 #define CMD0_SEEK 0x01
545 #define CMD1_SEEK 0x01
546 #define CMD2_SEEK 0x2b
547 #define CMDL_SEEK 0x01
548 #define CMD0_READ 0x02
549 #define CMD1_READ 0x10
550 #define CMD2_READ 0x28
551 #define CMDL_READ 0x02
552 #define CMD0_READ_XA 0x03
553 #define CMD2_READ_XA 0xd4
554 #define CMDL_READ_XA 0x03
555 #define CMD0_READ_HEAD 0x04
556 #define CMD0_SPINUP 0x05
557 #define CMD1_SPINUP 0x02
558 #define CMD2_SPINUP CMD2_TRAY_CTL
559 #define CMDL_SPINUP 0x05
560 #define CMD0_SPINDOWN 0x06
561 #define CMD1_SPINDOWN 0x06
562 #define CMD2_SPINDOWN CMD2_TRAY_CTL
563 #define CMDL_SPINDOWN 0x0d
564 #define CMD0_DIAG 0x07
565 #define CMD0_READ_UPC 0x08
566 #define CMD1_READ_UPC 0x88
567 #define CMD2_READ_UPC 0x
568 #define CMDL_READ_UPC 0x08
569 #define CMD0_READ_ISRC 0x09
570 #define CMD0_PLAY 0x0a
571 #define CMD1_PLAY 0x
572 #define CMD2_PLAY 0x
573 #define CMDL_PLAY 0x0a
574 #define CMD0_PLAY_MSF 0x0b
575 #define CMD1_PLAY_MSF 0x0e
576 #define CMD2_PLAY_MSF 0x47
577 #define CMDL_PLAY_MSF 0x
578 #define CMD0_PLAY_TI 0x0c
579 #define CMD0_STATUS 0x81
580 #define CMD1_STATUS 0x05
581 #define CMD2_STATUS 0x00
582 #define CMDL_STATUS 0x81
583 #define CMD0_READ_ERR 0x82
584 #define CMD1_READ_ERR 0x82
585 #define CMD2_READ_ERR 0x03
586 #define CMDL_READ_ERR 0x82
587 #define CMD0_READ_VER 0x83
588 #define CMD1_READ_VER 0x83
589 #define CMD2_READ_VER 0x12
590 #define CMDL_READ_VER 0x83
591 #define CMD0_SETMODE 0x84
592 #define CMD1_SETMODE 0x09
593 #define CMD2_SETMODE 0x55
594 #define CMDL_SETMODE 0x84
595 #define CMD0_GETMODE 0x85
596 #define CMD1_GETMODE 0x84
597 #define CMD2_GETMODE 0x5a
598 #define CMDL_GETMODE 0x85
599 #define CMD0_SET_XA 0x86
600 #define CMD0_GET_XA 0x87
601 #define CMD0_CAPACITY 0x88
602 #define CMD1_CAPACITY 0x85
603 #define CMD2_CAPACITY 0x25
604 #define CMDL_CAPACITY 0x88
605 #define CMD0_READSUBQ 0x89
606 #define CMD1_READSUBQ 0x87
607 #define CMD2_READSUBQ 0x42
608 #define CMDL_READSUBQ 0x89
609 #define CMD0_DISKCODE 0x8a
610 #define CMD0_DISKINFO 0x8b
611 #define CMD1_DISKINFO 0x8b
612 #define CMD2_DISKINFO 0x43
613 #define CMDL_DISKINFO 0x8b
614 #define CMD0_READTOC 0x8c
615 #define CMD1_READTOC 0x8c
616 #define CMD2_READTOC 0x
617 #define CMDL_READTOC 0x8c
618 #define CMD0_PAU_RES 0x8d
619 #define CMD1_PAU_RES 0x0d
620 #define CMD2_PAU_RES 0x4b
621 #define CMDL_PAU_RES 0x8d
622 #define CMD0_PACKET 0x8e
623 #define CMD1_PACKET 0x8e
624 #define CMD2_PACKET 0x
625 #define CMDL_PACKET 0x8e
626
627
628
629 #endif _LINUX_SBPCD_H