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_TEA 28
124 #define DBG_CD2 29
125 #define DBG_000 30
126
127
128
129
130
131
132
133 #define f_respo3 0x100
134 #define f_putcmd 0x80
135 #define f_respo2 0x40
136 #define f_lopsta 0x20
137 #define f_getsta 0x10
138 #define f_ResponseStatus 0x08
139 #define f_obey_p_check 0x04
140 #define f_bit1 0x02
141 #define f_wait_if_busy 0x01
142
143
144
145
146 #define x80_bit 0x80
147 #define upc_bit 0x40
148 #define volume_bit 0x20
149 #define toc_bit 0x10
150 #define multisession_bit 0x08
151 #define cd_size_bit 0x04
152 #define subq_bit 0x02
153 #define frame_size_bit 0x01
154
155
156
157
158 #define upc_valid (DriveStruct[d].diskstate_flags&upc_bit)
159 #define volume_valid (DriveStruct[d].diskstate_flags&volume_bit)
160 #define toc_valid (DriveStruct[d].diskstate_flags&toc_bit)
161 #define cd_size_valid (DriveStruct[d].diskstate_flags&cd_size_bit)
162 #define subq_valid (DriveStruct[d].diskstate_flags&subq_bit)
163 #define frame_size_valid (DriveStruct[d].diskstate_flags&frame_size_bit)
164
165
166
167
168 #define p_door_closed 0x80
169 #define p_caddy_in 0x40
170 #define p_spinning 0x20
171 #define p_check 0x10
172 #define p_busy_new 0x08
173 #define p_door_locked 0x04
174 #define p_bit_1 0x02
175 #define p_lcs_door_locked 0x02
176 #define p_disk_ok 0x01
177 #define p_lcs_door_closed 0x01
178
179
180
181 #define p_caddin_old 0x40
182 #define p_success_old 0x08
183 #define p_busy_old 0x04
184
185
186
187
188 #define p0_door_closed 0x80
189 #define p0_caddy_in 0x40
190 #define p0_spinning 0x20
191 #define p0_check 0x10
192 #define p0_success 0x08
193 #define p0_busy 0x04
194 #define p0_bit_1 0x02
195 #define p0_disk_ok 0x01
196
197 #define p1_door_closed 0x80
198 #define p1_disk_in 0x40
199 #define p1_spinning 0x20
200 #define p1_check 0x10
201 #define p1_busy 0x08
202 #define p1_door_locked 0x04
203 #define p1_bit_1 0x02
204 #define p1_disk_ok 0x01
205
206 #define p2_disk_ok 0x80
207 #define p2_door_locked 0x40
208 #define p2_spinning 0x20
209 #define p2_busy2 0x10
210 #define p2_busy1 0x08
211 #define p2_door_closed 0x04
212 #define p2_disk_in 0x02
213 #define p2_check 0x01
214
215
216
217
218 #define st_door_closed (DriveStruct[d].status_byte&p_door_closed)
219 #define st_caddy_in (DriveStruct[d].status_byte&p_caddy_in)
220 #define st_spinning (DriveStruct[d].status_byte&p_spinning)
221 #define st_check (DriveStruct[d].status_byte&p_check)
222 #define st_busy (DriveStruct[d].status_byte&p_busy_new)
223 #define st_door_locked (DriveStruct[d].status_byte&p_door_locked)
224 #define st_diskok (DriveStruct[d].status_byte&p_disk_ok)
225
226
227
228
229 #define s_not_result_ready 0x04
230 #define s_not_data_ready 0x02
231 #define s_attention 0x01
232
233
234
235 #define DRV_ATTN ((inb(CDi_status)&s_attention)!=0)
236 #define DATA_READY ((inb(CDi_status)&s_not_data_ready)==0)
237 #define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0)
238
239
240
241
242 #define drv_fam0 0x08
243 #define drv_199 (drv_fam0+0x01)
244 #define drv_200 (drv_fam0+0x02)
245 #define drv_201 (drv_fam0+0x03)
246 #define drv_210 (drv_fam0+0x04)
247 #define drv_211 (drv_fam0+0x05)
248 #define drv_300 (drv_fam0+0x06)
249
250 #define drv_famL 0x10
251 #define drv_260 (drv_famL+0x01)
252
253 #define drv_fam1 0x20
254 #define drv_099 (drv_fam1+0x01)
255 #define drv_100 (drv_fam1+0x02)
256
257 #define drv_famT 0x40
258 #define drv_fam2 0x80
259
260 #define fam0_drive (DriveStruct[d].drv_type&drv_fam0)
261 #define famL_drive (DriveStruct[d].drv_type&drv_famL)
262 #define fam1_drive (DriveStruct[d].drv_type&drv_fam1)
263 #define famT_drive (DriveStruct[d].drv_type&drv_famT)
264 #define fam2_drive (DriveStruct[d].drv_type&drv_fam2)
265 #define fam0L_drive (DriveStruct[d].drv_type&(drv_fam0|drv_famL))
266 #define fam1L_drive (DriveStruct[d].drv_type&(drv_fam1|drv_famL))
267 #define fam01_drive (DriveStruct[d].drv_type&(drv_fam0|drv_fam1))
268
269
270
271
272 #define audio_playing 2
273 #define audio_pausing 1
274
275
276
277
278 #define speed_auto 0x80
279 #define speed_300 0x40
280 #define speed_150 0x20
281 #define audio_mono 0x04
282
283
284
285
286 #define READ_M1 0x01
287 #define READ_M2 0x02
288 #define READ_SC 0x04
289 #define READ_AU 0x08
290
291
292
293
294
295
296
297
298
299
300
301
302 #define aud_00 0x00
303 #define audx11 0x0b
304 #define audx12 0x0c
305 #define audx13 0x0d
306 #define audx14 0x0e
307 #define audx15 0x0f
308
309
310 #define aud_11 0x11
311 #define aud_12 0x12
312 #define aud_13 0x13
313 #define aud_14 0x14
314 #define aud_15 0x15
315
316
317
318
319
320 #define NR_SBPCD 4
321
322
323
324
325 #define SBPCD_DIS_IRQ 0
326
327
328
329
330 #define OUT(x,y) outb(y,x)
331
332
333
334
335 #define READ_DATA(port, buf, nr) insb(port, buf, nr)
336
337
338
339 #define MIXER_CD_Volume 0x28
340
341
342
343
344
345 #define MAX_TRACKS 120
346
347
348
349
350
351 typedef union _msf
352 {
353 u_int n;
354 u_char c[4];
355 }
356 MSF;
357
358 typedef union _blk
359 {
360 u_int n;
361 u_char c[4];
362 }
363 BLK;
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
524
525
526
527 #define CMD1_RESET 0x0a
528 #define CMD2_RESET 0x01
529 #define CMDL_RESET 0x0a
530 #define CMDT_RESET 0xc0
531 #define CMD1_LOCK_CTL 0x0c
532 #define CMD2_LOCK_CTL 0x1e
533 #define CMDL_LOCK_CTL 0x0e
534 #define CMDT_LOCK_CTL 0x1e
535 #define CMD1_TRAY_CTL 0x07
536 #define CMD2_TRAY_CTL 0x1b
537 #define CMDL_TRAY_CTL 0x0d
538 #define CMDT_TRAY_CTL 0x1b
539 #define CMD1_MULTISESS 0x8d
540 #define CMD2_MULTISESS 0x43
541 #define CMDL_MULTISESS 0x8c
542 #define CMD1_SUBCHANINF 0x11
543 #define CMD2_SUBCHANINF 0x
544 #define CMD2_x02 0x02
545 #define CMD1_x08 0x08
546 #define CMD2_x08 0x08
547 #define CMDT_x08 0x08
548 #define CMD2_SETSPEED 0xda
549
550 #define CMD0_PATH_CHECK 0x00
551 #define CMD1_PATH_CHECK 0x00
552 #define CMD2_PATH_CHECK 0x
553 #define CMDL_PATH_CHECK 0x00
554 #define CMD0_SEEK 0x01
555 #define CMD1_SEEK 0x01
556 #define CMD2_SEEK 0x2b
557 #define CMDL_SEEK 0x01
558 #define CMDT_SEEK 0x2b
559 #define CMD0_READ 0x02
560 #define CMD1_READ 0x10
561 #define CMD2_READ 0x28
562 #define CMDL_READ 0x02
563 #define CMDT_READ 0x28
564 #define CMD0_READ_XA 0x03
565 #define CMD2_READ_XA 0xd4
566 #define CMDL_READ_XA 0x03
567 #define CMD0_READ_HEAD 0x04
568 #define CMD0_SPINUP 0x05
569 #define CMD1_SPINUP 0x02
570 #define CMD2_SPINUP CMD2_TRAY_CTL
571 #define CMDL_SPINUP 0x05
572 #define CMD0_SPINDOWN 0x06
573 #define CMD1_SPINDOWN 0x06
574 #define CMD2_SPINDOWN CMD2_TRAY_CTL
575 #define CMDL_SPINDOWN 0x0d
576 #define CMD0_DIAG 0x07
577 #define CMD0_READ_UPC 0x08
578 #define CMD1_READ_UPC 0x88
579 #define CMD2_READ_UPC 0x
580 #define CMDL_READ_UPC 0x08
581 #define CMD0_READ_ISRC 0x09
582 #define CMD0_PLAY 0x0a
583 #define CMD1_PLAY 0x
584 #define CMD2_PLAY 0x
585 #define CMDL_PLAY 0x0a
586 #define CMD0_PLAY_MSF 0x0b
587 #define CMD1_PLAY_MSF 0x0e
588 #define CMD2_PLAY_MSF 0x47
589 #define CMDL_PLAY_MSF 0x
590 #define CMDT_PLAY_MSF 0x47
591 #define CMD0_PLAY_TI 0x0c
592 #define CMD0_STATUS 0x81
593 #define CMD1_STATUS 0x05
594 #define CMD2_STATUS 0x00
595 #define CMDL_STATUS 0x81
596 #define CMDT_STATUS 0x00
597 #define CMD0_READ_ERR 0x82
598 #define CMD1_READ_ERR 0x82
599 #define CMD2_READ_ERR 0x03
600 #define CMDL_READ_ERR 0x82
601 #define CMDT_READ_ERR 0x03
602 #define CMD0_READ_VER 0x83
603 #define CMD1_READ_VER 0x83
604 #define CMD2_READ_VER 0x12
605 #define CMDT_READ_VER 0x12
606 #define CMDL_READ_VER 0x83
607 #define CMD0_SETMODE 0x84
608 #define CMD1_SETMODE 0x09
609 #define CMD2_SETMODE 0x55
610 #define CMDL_SETMODE 0x84
611 #define CMDT_SETMODE 0x55
612 #define CMD0_GETMODE 0x85
613 #define CMD1_GETMODE 0x84
614 #define CMD2_GETMODE 0x5a
615 #define CMDL_GETMODE 0x85
616 #define CMDT_GETMODE 0x5a
617 #define CMD0_SET_XA 0x86
618 #define CMD0_GET_XA 0x87
619 #define CMD0_CAPACITY 0x88
620 #define CMD1_CAPACITY 0x85
621 #define CMD2_CAPACITY 0x25
622 #define CMDL_CAPACITY 0x88
623 #define CMD0_READSUBQ 0x89
624 #define CMD1_READSUBQ 0x87
625 #define CMD2_READSUBQ 0x42
626 #define CMDL_READSUBQ 0x89
627 #define CMDT_READSUBQ 0x42
628 #define CMD0_DISKCODE 0x8a
629 #define CMD0_DISKINFO 0x8b
630 #define CMD1_DISKINFO 0x8b
631 #define CMD2_DISKINFO 0x
632 #define CMDL_DISKINFO 0x8b
633 #define CMDT_DISKINFO 0x43
634 #define CMD0_READTOC 0x8c
635 #define CMD1_READTOC 0x8c
636 #define CMD2_READTOC 0x
637 #define CMDL_READTOC 0x8c
638 #define CMD0_PAU_RES 0x8d
639 #define CMD1_PAU_RES 0x0d
640 #define CMD2_PAU_RES 0x4b
641 #define CMDL_PAU_RES 0x8d
642 #define CMDT_PAU_RES 0x4b
643 #define CMD0_PACKET 0x8e
644 #define CMD1_PACKET 0x8e
645 #define CMD2_PACKET 0x
646 #define CMDL_PACKET 0x8e
647
648
649
650 #endif _LINUX_SBPCD_H