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