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 #if !(SBPCD_ISSUE-1)
76 #define CDROM_PORT 0x340
77 #define SBPRO 0
78 #define MAX_DRIVES 4
79 #define SOUND_BASE 0x220
80 #endif
81 #if !(SBPCD_ISSUE-2)
82 #define CDROM_PORT 0x344
83 #define SBPRO 0
84 #define MAX_DRIVES 4
85 #define SOUND_BASE 0x000
86 #endif
87 #if !(SBPCD_ISSUE-3)
88 #define CDROM_PORT 0x634
89 #define SBPRO 1
90 #define MAX_DRIVES 4
91 #define SOUND_BASE 0x240
92 #endif
93 #if !(SBPCD_ISSUE-4)
94 #define CDROM_PORT 0x634
95 #define SBPRO 0
96 #define MAX_DRIVES 4
97 #define SOUND_BASE 0x000
98 #endif
99
100
101
102
103
104
105 #define DISTRIBUTION 1
106
107 #if DISTRIBUTION
108 #define READ_AUDIO 0
109 #else
110
111
112
113
114 #define READ_AUDIO 75
115
116
117 #define JUKEBOX 1
118
119
120 #define EJECT 1
121 #endif DISTRIBUTION
122
123
124
125
126
127
128 #ifndef _LINUX_SBPCD_H
129
130 #define _LINUX_SBPCD_H
131
132
133 #define LONG_TIMING 0
134 #undef FUTURE
135
136 #define TEST_UPC 0
137 #define SPEA_TEST 0
138 #define TEST_STI 0
139 #undef PATH_CHECK
140
141
142
143
144
145 #define DDIOCSDBG 0x9000
146
147
148
149
150
151 #define CDROMAUDIOBUFSIZ 0x5382
152
153
154
155
156
157 #define DBG_INF 1
158 #define DBG_BSZ 2
159 #define DBG_REA 3
160 #define DBG_CHK 4
161 #define DBG_TIM 5
162 #define DBG_INI 6
163 #define DBG_TOC 7
164 #define DBG_IOC 8
165 #define DBG_STA 9
166 #define DBG_ERR 10
167 #define DBG_CMD 11
168 #define DBG_WRN 12
169 #define DBG_MUL 13
170 #define DBG_IDX 14
171 #define DBG_IOX 15
172 #define DBG_DID 16
173 #define DBG_RES 17
174 #define DBG_SPI 18
175 #define DBG_IOS 19
176 #define DBG_IO2 20
177 #define DBG_UPC 21
178 #define DBG_XA1 22
179 #define DBG_LCK 23
180 #define DBG_SQ1 24
181 #define DBG_AUD 25
182 #define DBG_SEQ 26
183 #define DBG_LCS 27
184 #define DBG_CD2 28
185 #define DBG_TEA 29
186 #define DBG_ECS 30
187 #define DBG_000 31
188
189
190
191
192
193
194
195 #define f_respo3 0x100
196 #define f_putcmd 0x80
197 #define f_respo2 0x40
198 #define f_lopsta 0x20
199 #define f_getsta 0x10
200 #define f_ResponseStatus 0x08
201 #define f_obey_p_check 0x04
202 #define f_bit1 0x02
203 #define f_wait_if_busy 0x01
204
205
206
207
208 #define x80_bit 0x80
209 #define upc_bit 0x40
210 #define volume_bit 0x20
211 #define toc_bit 0x10
212 #define multisession_bit 0x08
213 #define cd_size_bit 0x04
214 #define subq_bit 0x02
215 #define frame_size_bit 0x01
216
217
218
219
220 #define upc_valid (D_S[d].diskstate_flags&upc_bit)
221 #define volume_valid (D_S[d].diskstate_flags&volume_bit)
222 #define toc_valid (D_S[d].diskstate_flags&toc_bit)
223 #define cd_size_valid (D_S[d].diskstate_flags&cd_size_bit)
224 #define subq_valid (D_S[d].diskstate_flags&subq_bit)
225 #define frame_size_valid (D_S[d].diskstate_flags&frame_size_bit)
226
227
228
229
230 #define p_success 0x100
231 #define p_door_closed 0x80
232 #define p_caddy_in 0x40
233 #define p_spinning 0x20
234 #define p_check 0x10
235 #define p_busy_new 0x08
236 #define p_door_locked 0x04
237 #define p_disk_ok 0x01
238
239
240
241
242 #define p_lcs_door_locked 0x02
243 #define p_lcs_door_closed 0x01
244
245
246
247
248 #define p_caddin_old 0x40
249 #define p_success_old 0x08
250 #define p_busy_old 0x04
251 #define p_bit_1 0x02
252
253
254
255
256 #define p0_door_closed 0x80
257 #define p0_caddy_in 0x40
258 #define p0_spinning 0x20
259 #define p0_check 0x10
260 #define p0_success 0x08
261 #define p0_busy 0x04
262 #define p0_bit_1 0x02
263 #define p0_disk_ok 0x01
264
265 #define pL_disk_in 0x40
266 #define pL_spinning 0x20
267 #define pL_check 0x10
268 #define pL_success 0x08
269 #define pL_busy 0x04
270 #define pL_door_locked 0x02
271 #define pL_door_closed 0x01
272
273 #define pV_door_closed 0x40
274 #define pV_spinning 0x20
275 #define pV_check 0x10
276 #define pV_success 0x08
277 #define pV_busy 0x04
278 #define pV_door_locked 0x02
279 #define pV_disk_ok 0x01
280
281 #define p1_door_closed 0x80
282 #define p1_disk_in 0x40
283 #define p1_spinning 0x20
284 #define p1_check 0x10
285 #define p1_busy 0x08
286 #define p1_door_locked 0x04
287 #define p1_bit_1 0x02
288 #define p1_disk_ok 0x01
289
290 #define p2_disk_ok 0x80
291 #define p2_door_locked 0x40
292 #define p2_spinning 0x20
293 #define p2_busy2 0x10
294 #define p2_busy1 0x08
295 #define p2_door_closed 0x04
296 #define p2_disk_in 0x02
297 #define p2_check 0x01
298
299
300
301
302 #define st_door_closed (D_S[d].status_bits&p_door_closed)
303 #define st_caddy_in (D_S[d].status_bits&p_caddy_in)
304 #define st_spinning (D_S[d].status_bits&p_spinning)
305 #define st_check (D_S[d].status_bits&p_check)
306 #define st_busy (D_S[d].status_bits&p_busy_new)
307 #define st_door_locked (D_S[d].status_bits&p_door_locked)
308 #define st_diskok (D_S[d].status_bits&p_disk_ok)
309
310
311
312
313 #define s_not_result_ready 0x04
314 #define s_not_data_ready 0x02
315 #define s_attention 0x01
316
317
318
319 #define DRV_ATTN ((inb(CDi_status)&s_attention)!=0)
320 #define DATA_READY ((inb(CDi_status)&s_not_data_ready)==0)
321 #define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0)
322
323
324
325
326 #define drv_fam0 0x0100
327 #define drv_199 (drv_fam0+0x01)
328 #define drv_200 (drv_fam0+0x02)
329 #define drv_201 (drv_fam0+0x03)
330 #define drv_210 (drv_fam0+0x04)
331 #define drv_211 (drv_fam0+0x05)
332 #define drv_300 (drv_fam0+0x06)
333
334 #define drv_fam1 0x0200
335 #define drv_099 (drv_fam1+0x01)
336 #define drv_100 (drv_fam1+0x02)
337
338 #define drv_fam2 0x0400
339
340 #define drv_famT 0x0800
341
342 #define drv_famL 0x1000
343 #define drv_260 (drv_famL+0x01)
344 #define drv_e1 (drv_famL+0x01)
345 #define drv_f4 (drv_famL+0x02)
346
347 #define drv_famV 0x2000
348 #define drv_at (drv_famV+0x01)
349
350 #define fam0_drive (D_S[d].drv_type&drv_fam0)
351 #define famL_drive (D_S[d].drv_type&drv_famL)
352 #define famV_drive (D_S[d].drv_type&drv_famV)
353 #define fam1_drive (D_S[d].drv_type&drv_fam1)
354 #define fam2_drive (D_S[d].drv_type&drv_fam2)
355 #define famT_drive (D_S[d].drv_type&drv_famT)
356 #define fam0L_drive (D_S[d].drv_type&(drv_fam0|drv_famL))
357 #define fam0V_drive (D_S[d].drv_type&(drv_fam0|drv_famV))
358 #define famLV_drive (D_S[d].drv_type&(drv_famL|drv_famV))
359 #define fam0LV_drive (D_S[d].drv_type&(drv_fam0|drv_famL|drv_famV))
360 #define fam1L_drive (D_S[d].drv_type&(drv_fam1|drv_famL))
361 #define fam1V_drive (D_S[d].drv_type&(drv_fam1|drv_famV))
362 #define fam1LV_drive (D_S[d].drv_type&(drv_fam1|drv_famL|drv_famV))
363 #define fam01_drive (D_S[d].drv_type&(drv_fam0|drv_fam1))
364 #define fam12_drive (D_S[d].drv_type&(drv_fam1|drv_fam2))
365 #define fam2T_drive (D_S[d].drv_type&(drv_fam2|drv_famT))
366
367
368
369
370 #define audio_playing 2
371 #define audio_pausing 1
372
373
374
375
376 #define speed_auto 0x80
377 #define speed_300 0x40
378 #define speed_150 0x20
379 #define audio_mono 0x04
380
381
382
383
384 #define READ_M1 0x01
385 #define READ_M2 0x02
386 #define READ_SC 0x04
387 #define READ_AU 0x08
388
389
390
391
392
393
394
395
396
397
398
399
400 #define aud_00 0x00
401 #define audx11 0x0b
402 #define audx12 0x0c
403 #define audx13 0x0d
404 #define audx14 0x0e
405 #define audx15 0x0f
406
407 #define aud_11 0x11
408 #define aud_12 0x12
409 #define aud_13 0x13
410 #define aud_14 0x14
411 #define aud_15 0x15
412
413
414
415
416 #define NR_SBPCD 4
417
418
419
420
421 #define SBPCD_DIS_IRQ 0
422
423
424
425
426 #define OUT(x,y) outb(y,x)
427
428
429
430 #define MIXER_CD_Volume 0x28
431
432
433
434 #define MAX_TRACKS 99
435
436
437
438
439
440 typedef union _msf
441 {
442 u_int n;
443 u_char c[4];
444 } MSF;
445
446 typedef union _blk
447 {
448 u_int n;
449 u_char c[4];
450 } BLK;
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
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615 #define CMD1_RESET 0x0a
616 #define CMD2_RESET 0x01
617 #define CMDT_RESET 0xc0
618
619 #define CMD1_LOCK_CTL 0x0c
620 #define CMD2_LOCK_CTL 0x1e
621 #define CMDT_LOCK_CTL CMD2_LOCK_CTL
622 #define CMDL_LOCK_CTL 0x0e
623 #define CMDV_LOCK_CTL CMDL_LOCK_CTL
624
625 #define CMD1_TRAY_CTL 0x07
626 #define CMD2_TRAY_CTL 0x1b
627 #define CMDT_TRAY_CTL CMD2_TRAY_CTL
628 #define CMDL_TRAY_CTL 0x0d
629 #define CMDV_TRAY_CTL CMDL_TRAY_CTL
630
631 #define CMD1_MULTISESS 0x8d
632 #define CMDL_MULTISESS 0x8c
633 #define CMDV_MULTISESS CMDL_MULTISESS
634
635 #define CMD1_SUBCHANINF 0x11
636 #define CMD2_SUBCHANINF 0x??
637
638 #define CMD1_ABORT 0x08
639 #define CMD2_ABORT 0x08
640 #define CMDT_ABORT 0x08
641
642 #define CMD2_x02 0x02
643
644 #define CMD2_SETSPEED 0xda
645
646 #define CMD0_PATH_CHECK 0x00
647 #define CMD1_PATH_CHECK 0x???
648 #define CMD2_PATH_CHECK 0x???
649 #define CMDT_PATH_CHECK 0x???
650 #define CMDL_PATH_CHECK CMD0_PATH_CHECK
651 #define CMDV_PATH_CHECK CMD0_PATH_CHECK
652
653 #define CMD0_SEEK 0x01
654 #define CMD1_SEEK CMD0_SEEK
655 #define CMD2_SEEK 0x2b
656 #define CMDT_SEEK CMD2_SEEK
657 #define CMDL_SEEK CMD0_SEEK
658 #define CMDV_SEEK CMD0_SEEK
659
660 #define CMD0_READ 0x02
661 #define CMD1_READ 0x10
662 #define CMD2_READ 0x28
663 #define CMDT_READ CMD2_READ
664 #define CMDL_READ CMD0_READ
665 #define CMDV_READ CMD0_READ
666
667 #define CMD0_READ_XA 0x03
668 #define CMD2_READ_XA 0xd4
669 #define CMD2_READ_XA2 0xd5
670 #define CMDL_READ_XA CMD0_READ_XA
671 #define CMDV_READ_XA CMD0_READ_XA
672
673 #define CMD0_READ_HEAD 0x04
674
675 #define CMD0_SPINUP 0x05
676 #define CMD1_SPINUP 0x02
677 #define CMD2_SPINUP CMD2_TRAY_CTL
678 #define CMDL_SPINUP CMD0_SPINUP
679 #define CMDV_SPINUP CMD0_SPINUP
680
681 #define CMD0_SPINDOWN 0x06
682 #define CMD1_SPINDOWN 0x06
683 #define CMD2_SPINDOWN CMD2_TRAY_CTL
684 #define CMDL_SPINDOWN 0x0d
685 #define CMDV_SPINDOWN CMD0_SPINDOWN
686
687 #define CMD0_DIAG 0x07
688
689 #define CMD0_READ_UPC 0x08
690 #define CMD1_READ_UPC 0x88
691 #define CMD2_READ_UPC 0x???
692 #define CMDL_READ_UPC CMD0_READ_UPC
693 #define CMDV_READ_UPC 0x8f
694
695 #define CMD0_READ_ISRC 0x09
696
697 #define CMD0_PLAY 0x0a
698 #define CMD1_PLAY 0x???
699 #define CMD2_PLAY 0x???
700 #define CMDL_PLAY CMD0_PLAY
701 #define CMDV_PLAY CMD0_PLAY
702
703 #define CMD0_PLAY_MSF 0x0b
704 #define CMD1_PLAY_MSF 0x0e
705 #define CMD2_PLAY_MSF 0x47
706 #define CMDT_PLAY_MSF CMD2_PLAY_MSF
707 #define CMDL_PLAY_MSF 0x???
708
709 #define CMD0_PLAY_TI 0x0c
710 #define CMD1_PLAY_TI 0x0f
711
712 #define CMD0_STATUS 0x81
713 #define CMD1_STATUS 0x05
714 #define CMD2_STATUS 0x00
715 #define CMDT_STATUS CMD2_STATUS
716 #define CMDL_STATUS CMD0_STATUS
717 #define CMDV_STATUS CMD0_STATUS
718 #define CMD2_SEEK_LEADIN 0x00
719
720 #define CMD0_READ_ERR 0x82
721 #define CMD1_READ_ERR CMD0_READ_ERR
722 #define CMD2_READ_ERR 0x03
723 #define CMDT_READ_ERR CMD2_READ_ERR
724 #define CMDL_READ_ERR CMD0_READ_ERR
725 #define CMDV_READ_ERR CMD0_READ_ERR
726
727 #define CMD0_READ_VER 0x83
728 #define CMD1_READ_VER CMD0_READ_VER
729 #define CMD2_READ_VER 0x12
730 #define CMDT_READ_VER CMD2_READ_VER
731 #define CMDL_READ_VER CMD0_READ_VER
732 #define CMDV_READ_VER CMD0_READ_VER
733
734 #define CMD0_SETMODE 0x84
735 #define CMD1_SETMODE 0x09
736 #define CMD2_SETMODE 0x55
737 #define CMDT_SETMODE CMD2_SETMODE
738 #define CMDL_SETMODE CMD0_SETMODE
739
740 #define CMD0_GETMODE 0x85
741 #define CMD1_GETMODE 0x84
742 #define CMD2_GETMODE 0x5a
743 #define CMDT_GETMODE CMD2_GETMODE
744 #define CMDL_GETMODE CMD0_GETMODE
745
746 #define CMD0_SET_XA 0x86
747
748 #define CMD0_GET_XA 0x87
749
750 #define CMD0_CAPACITY 0x88
751 #define CMD1_CAPACITY 0x85
752 #define CMD2_CAPACITY 0x25
753 #define CMDL_CAPACITY CMD0_CAPACITY
754
755 #define CMD0_READSUBQ 0x89
756 #define CMD1_READSUBQ 0x87
757 #define CMD2_READSUBQ 0x42
758 #define CMDT_READSUBQ CMD2_READSUBQ
759 #define CMDL_READSUBQ CMD0_READSUBQ
760 #define CMDV_READSUBQ CMD0_READSUBQ
761
762 #define CMD0_DISKCODE 0x8a
763
764 #define CMD0_DISKINFO 0x8b
765 #define CMD1_DISKINFO CMD0_DISKINFO
766 #define CMD2_DISKINFO 0x43
767 #define CMDT_DISKINFO CMD2_DISKINFO
768 #define CMDL_DISKINFO CMD0_DISKINFO
769 #define CMDV_DISKINFO CMD0_DISKINFO
770
771 #define CMD0_READTOC 0x8c
772 #define CMD1_READTOC CMD0_READTOC
773 #define CMD2_READTOC 0x???
774 #define CMDL_READTOC CMD0_READTOC
775 #define CMDV_READTOC CMD0_READTOC
776
777 #define CMD0_PAU_RES 0x8d
778 #define CMD1_PAU_RES 0x0d
779 #define CMD2_PAU_RES 0x4b
780 #define CMDT_PAUSE CMD2_PAU_RES
781 #define CMDL_PAU_RES CMD0_PAU_RES
782 #define CMDV_PAUSE CMD0_PAU_RES
783
784 #define CMD0_PACKET 0x8e
785 #define CMD1_PACKET CMD0_PACKET
786 #define CMD2_PACKET 0x???
787 #define CMDL_PACKET CMD0_PACKET
788 #define CMDV_PACKET 0x???
789
790
791
792 #endif _LINUX_SBPCD_H
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809