1 /*
2  * sbpcd.h   Specify interface address and interface type here.
3  */
4 
5 /*
6  * Attention! This file contains user-serviceable parts!
7  * I recommend to make use of it...
8  * If you feel helpless, look into linux/Documentation/cdrom/sbpcd
9  * (good idea anyway, at least before mailing me).
10  *
11  * The definitions for the first controller can get overridden by
12  * the kernel command line ("lilo boot option").
13  * Examples:
14  *                                 sbpcd=0x300,LaserMate
15  *                             or
16  *                                 sbpcd=0x230,SoundBlaster
17  *                             or
18  *                                 sbpcd=0x338,SoundScape
19  *                             or
20  *                                 sbpcd=0x2C0,Teac16bit
21  *
22  * If sbpcd gets used as a module, you can load it with
23  *     insmod sbpcd.o sbpcd=0x300,0
24  * or
25  *     insmod sbpcd.o sbpcd=0x230,1
26  * or
27  *     insmod sbpcd.o sbpcd=0x338,2
28  * or
29  *     insmod sbpcd.o sbpcd=0x2C0,3
30  * respective to override the configured address and type.
31  */
32 
33 /*
34  * define your CDROM port base address as CDROM_PORT
35  * and specify the type of your interface card as SBPRO.
36  *
37  * address:
38  * ========
39  * SBPRO type addresses typically are 0x0230 (=0x220+0x10), 0x0250, ...
40  * LASERMATE type (CI-101P, WDH-7001C) addresses typically are 0x0300, ...
41  * SOUNDSCAPE addresses are from the LASERMATE type and range. You have to
42  * specify the REAL address here, not the configuration port address. Look
43  * at the CDROM driver's invoking line within your DOS CONFIG.SYS, or let
44  * sbpcd auto-probe, if you are not firm with the address.
45  * There are some soundcards on the market with 0x0630, 0x0650, ...; their
46  * type is not obvious (both types are possible).
47  *
48  * example: if your SBPRO audio address is 0x220, specify 0x230 and SBPRO 1.
49  *          if your soundcard has its CDROM port above 0x300, specify
50  *          that address and try SBPRO 0 first.
51  *          if your SoundScape configuration port is at 0x330, specify
52  *          0x338 and SBPRO 2.
53  *
54  * interface type:
55  * ===============
56  * set SBPRO to 1 for "true" SoundBlaster card
57  * set SBPRO to 0 for "compatible" soundcards and
58  *                for "poor" (no sound) interface cards.
59  * set SBPRO to 2 for Ensonic SoundScape or SPEA Media FX cards
60  * set SBPRO to 3 for Teac 16bit interface cards
61  *
62  * Almost all "compatible" sound boards need to set SBPRO to 0.
63  * If SBPRO is set wrong, the drives will get found - but any
64  * data access will give errors (audio access will work).
65  * The "OmniCD" no-sound interface card from CreativeLabs and most Teac
66  * interface cards need SBPRO 1.
67  *
68  * sound base:
69  * ===========
70  * The SOUND_BASE definition tells if we should try to turn the CD sound
71  * channels on. It will only be of use regarding soundcards with a SbPro
72  * compatible mixer.
73  *
74  * Example: #define SOUND_BASE 0x220 enables the sound card's CD channels
75  *          #define SOUND_BASE 0     leaves the soundcard untouched
76  */
77 #if !(SBPCD_ISSUE-1)     /* first (or if you have only one) interface board: */
78 #define CDROM_PORT 0x340 /* <-----------<< port address                      */
79 #define SBPRO      0     /* <-----------<< interface type                    */
80 #define MAX_DRIVES 4     /* set to 1 if the card does not use "drive select" */
81 #define SOUND_BASE 0x220 /* <-----------<< sound address of this card or 0   */
82 #endif
83 #if !(SBPCD_ISSUE-2)     /* ==================== second interface board: === */
84 #define CDROM_PORT 0x344 /* <-----------<< port address                      */
85 #define SBPRO      0     /* <-----------<< interface type                    */
86 #define MAX_DRIVES 4     /* set to 1 if the card does not use "drive select" */
87 #define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0   */
88 #endif
89 #if !(SBPCD_ISSUE-3)     /* ===================== third interface board: === */
90 #define CDROM_PORT 0x630 /* <-----------<< port address                      */
91 #define SBPRO      1     /* <-----------<< interface type                    */
92 #define MAX_DRIVES 4     /* set to 1 if the card does not use "drive select" */
93 #define SOUND_BASE 0x240 /* <-----------<< sound address of this card or 0   */
94 #endif
95 #if !(SBPCD_ISSUE-4)     /* ==================== fourth interface board: === */
96 #define CDROM_PORT 0x634 /* <-----------<< port address                      */
97 #define SBPRO      0     /* <-----------<< interface type                    */
98 #define MAX_DRIVES 4     /* set to 1 if the card does not use "drive select" */
99 #define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0   */
100 #endif
101 
102 /*
103  * some more or less user dependent definitions - service them!
104  */
105 
106 /* Set this to 0 once you have configured your interface definitions right. */
107 #define DISTRIBUTION 1
108 
109 /*
110  * Time to wait after giving a message.
111  * This gets important if you enable non-standard DBG_xxx flags.
112  * You will see what happens if you omit the pause or make it
113  * too short. Be warned!
114  */
115 #define KLOGD_PAUSE 1
116 
117 /* tray control: eject tray if no disk is in */
118 #if DISTRIBUTION
119 #define JUKEBOX 0
120 #else
121 #define JUKEBOX 1
122 #endif /* DISTRIBUTION */
123 
124 /* tray control: eject tray after last use */
125 #if DISTRIBUTION
126 #define EJECT 0
127 #else
128 #define EJECT 1
129 #endif /* DISTRIBUTION */
130 
131 /* max. number of audio frames to read with one     */
132 /* request (allocates n* 2352 bytes kernel memory!) */
133 /* may be freely adjusted, f.e. 75 (= 1 sec.), at   */
134 /* runtime by use of the CDROMAUDIOBUFSIZ ioctl.    */
135 #define READ_AUDIO 0
136 
137 /* Optimizations for the Teac CD-55A drive read performance.
138  * SBP_TEAC_SPEED can be changed here, or one can set the
139  * variable "teac" when loading as a module.
140  * Valid settings are:
141  *   0 - very slow - the recommended "DISTRIBUTION 1" setup.
142  *   1 - 2x performance with little overhead. No busy waiting.
143  *   2 - 4x performance with 5ms overhead per read. Busy wait.
144  *
145  * Setting SBP_TEAC_SPEED or the variable 'teac' to anything
146  * other than 0 may cause problems. If you run into them, first
147  * change SBP_TEAC_SPEED back to 0 and see if your drive responds
148  * normally. If yes, you are "allowed" to report your case - to help
149  * me with the driver, not to solve your hassle. Don�t mail if you
150  * simply are stuck into your own "tuning" experiments, you know?
151  */
152 #define SBP_TEAC_SPEED 1
153 
154 /*==========================================================================*/
155 /*==========================================================================*/
156 /*
157  * nothing to change below here if you are not fully aware what you're doing
158  */
159 #ifndef _LINUX_SBPCD_H
160 
161 #define _LINUX_SBPCD_H
162 /*==========================================================================*/
163 /*==========================================================================*/
164 /*
165  * driver's own read_ahead, data mode
166  */
167 #define SBP_BUFFER_FRAMES 8
168 
169 #define LONG_TIMING 0 /* test against timeouts with "gold" CDs on CR-521 */
170 #undef  FUTURE
171 #undef SAFE_MIXED
172 
173 #define TEST_UPC 0
174 #define SPEA_TEST 0
175 #define TEST_STI 0
176 #define OLD_BUSY 0
177 #undef PATH_CHECK
178 #ifndef SOUND_BASE
179 #define SOUND_BASE 0
180 #endif
181 #if DISTRIBUTION
182 #undef SBP_TEAC_SPEED
183 #define SBP_TEAC_SPEED 0
184 #endif
185 /*==========================================================================*/
186 /*
187  * DDI interface definitions
188  * "invented" by Fred N. van Kempen..
189  */
190 #define DDIOCSDBG	0x9000
191 
192 /*==========================================================================*/
193 /*
194  * "private" IOCTL functions
195  */
196 #define CDROMAUDIOBUFSIZ	0x5382 /* set the audio buffer size */
197 
198 /*==========================================================================*/
199 /*
200  * Debug output levels
201  */
202 #define DBG_INF	1	/* necessary information */
203 #define DBG_BSZ	2	/* BLOCK_SIZE trace */
204 #define DBG_REA	3	/* READ status trace */
205 #define DBG_CHK	4	/* MEDIA CHECK trace */
206 #define DBG_TIM	5	/* datarate timer test */
207 #define DBG_INI	6	/* initialization trace */
208 #define DBG_TOC	7	/* tell TocEntry values */
209 #define DBG_IOC	8	/* ioctl trace */
210 #define DBG_STA	9	/* ResponseStatus() trace */
211 #define DBG_ERR	10	/* cc_ReadError() trace */
212 #define DBG_CMD	11	/* cmd_out() trace */
213 #define DBG_WRN	12	/* give explanation before auto-probing */
214 #define DBG_MUL	13	/* multi session code test */
215 #define DBG_IDX	14	/* test code for drive_id !=0 */
216 #define DBG_IOX	15	/* some special information */
217 #define DBG_DID	16	/* drive ID test */
218 #define DBG_RES	17	/* drive reset info */
219 #define DBG_SPI	18	/* SpinUp test */
220 #define DBG_IOS	19	/* ioctl trace: subchannel functions */
221 #define DBG_IO2	20	/* ioctl trace: general */
222 #define DBG_UPC	21	/* show UPC information */
223 #define DBG_XA1	22	/* XA mode debugging */
224 #define DBG_LCK	23	/* door (un)lock info */
225 #define DBG_SQ1	24	/* dump SubQ frame */
226 #define DBG_AUD	25	/* READ AUDIO debugging */
227 #define DBG_SEQ	26	/* Sequoia interface configuration trace */
228 #define DBG_LCS	27	/* Longshine LCS-7260 debugging trace */
229 #define DBG_CD2	28	/* MKE/Funai CD200 debugging trace */
230 #define DBG_TEA	29	/* TEAC CD-55A debugging trace */
231 #define DBG_ECS	30	/* ECS-AT (Vertos 100) debugging trace */
232 #define DBG_000	31	/* unnecessary information */
233 
234 /*==========================================================================*/
235 /*==========================================================================*/
236 
237 /*
238  * bits of flags_cmd_out:
239  */
240 #define f_respo3		0x100
241 #define f_putcmd		0x80
242 #define f_respo2		0x40
243 #define f_lopsta		0x20
244 #define f_getsta		0x10
245 #define f_ResponseStatus	0x08
246 #define f_obey_p_check		0x04
247 #define f_bit1			0x02
248 #define f_wait_if_busy		0x01
249 
250 /*
251  * diskstate_flags:
252  */
253 #define x80_bit			0x80
254 #define upc_bit			0x40
255 #define volume_bit		0x20
256 #define toc_bit			0x10
257 #define multisession_bit	0x08
258 #define cd_size_bit		0x04
259 #define subq_bit		0x02
260 #define frame_size_bit		0x01
261 
262 /*
263  * disk states (bits of diskstate_flags):
264  */
265 #define upc_valid		(D_S[d].diskstate_flags&upc_bit)
266 #define volume_valid		(D_S[d].diskstate_flags&volume_bit)
267 #define toc_valid		(D_S[d].diskstate_flags&toc_bit)
268 #define cd_size_valid		(D_S[d].diskstate_flags&cd_size_bit)
269 #define subq_valid		(D_S[d].diskstate_flags&subq_bit)
270 #define frame_size_valid	(D_S[d].diskstate_flags&frame_size_bit)
271 
272 /*
273  * the status_bits variable
274  */
275 #define p_success	0x100
276 #define p_door_closed	0x80
277 #define p_caddy_in	0x40
278 #define p_spinning	0x20
279 #define p_check		0x10
280 #define p_busy_new	0x08
281 #define p_door_locked	0x04
282 #define p_disk_ok	0x01
283 
284 /*
285  * LCS-7260 special status result bits:
286  */
287 #define p_lcs_door_locked	0x02
288 #define p_lcs_door_closed	0x01 /* probably disk_in */
289 
290 /*
291  * CR-52x special status result bits:
292  */
293 #define p_caddin_old	0x40
294 #define p_success_old	0x08
295 #define p_busy_old	0x04
296 #define p_bit_1		0x02	/* hopefully unused now */
297 
298 /*
299  * "generation specific" defs of the status result bits:
300  */
301 #define p0_door_closed	0x80
302 #define p0_caddy_in	0x40
303 #define p0_spinning	0x20
304 #define p0_check	0x10
305 #define p0_success	0x08 /* unused */
306 #define p0_busy		0x04
307 #define p0_bit_1	0x02 /* unused */
308 #define p0_disk_ok	0x01
309 
310 #define pL_disk_in	0x40
311 #define pL_spinning	0x20
312 #define pL_check	0x10
313 #define pL_success	0x08 /* unused ?? */
314 #define pL_busy		0x04
315 #define pL_door_locked	0x02
316 #define pL_door_closed	0x01
317 
318 #define pV_door_closed	0x40
319 #define pV_spinning	0x20
320 #define pV_check	0x10
321 #define pV_success	0x08
322 #define pV_busy		0x04
323 #define pV_door_locked	0x02
324 #define pV_disk_ok	0x01
325 
326 #define p1_door_closed	0x80
327 #define p1_disk_in	0x40
328 #define p1_spinning	0x20
329 #define p1_check	0x10
330 #define p1_busy		0x08
331 #define p1_door_locked	0x04
332 #define p1_bit_1	0x02 /* unused */
333 #define p1_disk_ok	0x01
334 
335 #define p2_disk_ok	0x80
336 #define p2_door_locked	0x40
337 #define p2_spinning	0x20
338 #define p2_busy2	0x10
339 #define p2_busy1	0x08
340 #define p2_door_closed	0x04
341 #define p2_disk_in	0x02
342 #define p2_check	0x01
343 
344 /*
345  * used drive states:
346  */
347 #define st_door_closed	(D_S[d].status_bits&p_door_closed)
348 #define st_caddy_in	(D_S[d].status_bits&p_caddy_in)
349 #define st_spinning	(D_S[d].status_bits&p_spinning)
350 #define st_check	(D_S[d].status_bits&p_check)
351 #define st_busy		(D_S[d].status_bits&p_busy_new)
352 #define st_door_locked	(D_S[d].status_bits&p_door_locked)
353 #define st_diskok	(D_S[d].status_bits&p_disk_ok)
354 
355 /*
356  * bits of the CDi_status register:
357  */
358 #define s_not_result_ready	0x04 /* 0: "result ready" */
359 #define s_not_data_ready	0x02 /* 0: "data ready"   */
360 #define s_attention		0x01 /* 1: "attention required" */
361 /*
362  * usable as:
363  */
364 #define DRV_ATTN	((inb(CDi_status)&s_attention)!=0)
365 #define DATA_READY	((inb(CDi_status)&s_not_data_ready)==0)
366 #define RESULT_READY	((inb(CDi_status)&s_not_result_ready)==0)
367 
368 /*
369  * drive families and types (firmware versions):
370  */
371 #define drv_fam0	0x0100		/* CR-52x family */
372 #define drv_199		(drv_fam0+0x01)	/* <200 */
373 #define drv_200		(drv_fam0+0x02)	/* <201 */
374 #define drv_201		(drv_fam0+0x03)	/* <210 */
375 #define drv_210		(drv_fam0+0x04)	/* <211 */
376 #define drv_211		(drv_fam0+0x05)	/* <300 */
377 #define drv_300		(drv_fam0+0x06)	/* >=300 */
378 
379 #define drv_fam1	0x0200		/* CR-56x family */
380 #define drv_099		(drv_fam1+0x01)	/* <100 */
381 #define drv_100		(drv_fam1+0x02)	/* >=100, only 1.02 and 5.00 known */
382 
383 #define drv_fam2	0x0400		/* CD200 family */
384 
385 #define drv_famT	0x0800		/* TEAC CD-55A */
386 
387 #define drv_famL	0x1000		/* Longshine family */
388 #define drv_260		(drv_famL+0x01)	/* LCS-7260 */
389 #define drv_e1		(drv_famL+0x01)	/* LCS-7260, firmware "A E1" */
390 #define drv_f4		(drv_famL+0x02)	/* LCS-7260, firmware "A4F4" */
391 
392 #define drv_famV	0x2000		/* ECS-AT (vertos-100) family */
393 #define drv_at		(drv_famV+0x01)	/* ECS-AT, firmware "1.00" */
394 
395 #define fam0_drive	(D_S[d].drv_type&drv_fam0)
396 #define famL_drive	(D_S[d].drv_type&drv_famL)
397 #define famV_drive	(D_S[d].drv_type&drv_famV)
398 #define fam1_drive	(D_S[d].drv_type&drv_fam1)
399 #define fam2_drive	(D_S[d].drv_type&drv_fam2)
400 #define famT_drive	(D_S[d].drv_type&drv_famT)
401 #define fam0L_drive	(D_S[d].drv_type&(drv_fam0|drv_famL))
402 #define fam0V_drive	(D_S[d].drv_type&(drv_fam0|drv_famV))
403 #define famLV_drive	(D_S[d].drv_type&(drv_famL|drv_famV))
404 #define fam0LV_drive	(D_S[d].drv_type&(drv_fam0|drv_famL|drv_famV))
405 #define fam1L_drive	(D_S[d].drv_type&(drv_fam1|drv_famL))
406 #define fam1V_drive	(D_S[d].drv_type&(drv_fam1|drv_famV))
407 #define fam1LV_drive	(D_S[d].drv_type&(drv_fam1|drv_famL|drv_famV))
408 #define fam01_drive	(D_S[d].drv_type&(drv_fam0|drv_fam1))
409 #define fam12_drive	(D_S[d].drv_type&(drv_fam1|drv_fam2))
410 #define fam2T_drive	(D_S[d].drv_type&(drv_fam2|drv_famT))
411 
412 /*
413  * audio states:
414  */
415 #define audio_completed	3 /* Forgot this one! --AJK */
416 #define audio_playing	2
417 #define audio_pausing	1
418 
419 /*
420  * drv_pattern, drv_options:
421  */
422 #define speed_auto	0x80
423 #define speed_300	0x40
424 #define speed_150	0x20
425 #define audio_mono	0x04
426 
427 /*
428  * values of cmd_type (0 else):
429  */
430 #define READ_M1	0x01	/* "data mode 1": 2048 bytes per frame */
431 #define READ_M2	0x02	/* "data mode 2": 12+2048+280 bytes per frame */
432 #define READ_SC	0x04	/* "subchannel info": 96 bytes per frame */
433 #define READ_AU	0x08	/* "audio frame": 2352 bytes per frame */
434 
435 /*
436  * sense_byte:
437  *
438  *          values: 00
439  *                  01
440  *                  81
441  *                  82 "raw audio" mode
442  *                  xx from infobuf[0] after 85 00 00 00 00 00 00
443  */
444 
445 /* audio status (bin) */
446 #define aud_00 0x00 /* Audio status byte not supported or not valid */
447 #define audx11 0x0b /* Audio play operation in progress             */
448 #define audx12 0x0c /* Audio play operation paused                  */
449 #define audx13 0x0d /* Audio play operation successfully completed  */
450 #define audx14 0x0e /* Audio play operation stopped due to error    */
451 #define audx15 0x0f /* No current audio status to return            */
452 /* audio status (bcd) */
453 #define aud_11 0x11 /* Audio play operation in progress             */
454 #define aud_12 0x12 /* Audio play operation paused                  */
455 #define aud_13 0x13 /* Audio play operation successfully completed  */
456 #define aud_14 0x14 /* Audio play operation stopped due to error    */
457 #define aud_15 0x15 /* No current audio status to return            */
458 
459 /*
460  * highest allowed drive number (MINOR+1)
461  */
462 #define NR_SBPCD	4
463 
464 /*
465  * we try to never disable interrupts - seems to work
466  */
467 #define SBPCD_DIS_IRQ	0
468 
469 /*
470  * "write byte to port"
471  */
472 #define OUT(x,y)	outb(y,x)
473 
474 /*==========================================================================*/
475 
476 #define MIXER_addr SOUND_BASE+4 /* sound card's address register */
477 #define MIXER_data SOUND_BASE+5 /* sound card's data register */
478 #define MIXER_CD_Volume	0x28	/* internal SB Pro register address */
479 
480 /*==========================================================================*/
481 
482 #define MAX_TRACKS	99
483 
484 #define ERR_DISKCHANGE 615
485 
486 /*==========================================================================*/
487 /*
488  * To make conversions easier (machine dependent!)
489  */
490 typedef union _msf
491 {
492 	u_int n;
493 	u_char c[4];
494 } MSF;
495 
496 typedef union _blk
497 {
498 	u_int n;
499 	u_char c[4];
500 } BLK;
501 
502 /*==========================================================================*/
503 
504 /*============================================================================
505 ==============================================================================
506 
507 COMMAND SET of "old" drives like CR-521, CR-522
508                (the CR-562 family is different):
509 
510 No.	Command			       Code
511 --------------------------------------------
512 
513 Drive Commands:
514  1	Seek				01
515  2	Read Data			02
516  3	Read XA-Data			03
517  4	Read Header			04
518  5	Spin Up				05
519  6	Spin Down			06
520  7	Diagnostic			07
521  8	Read UPC			08
522  9	Read ISRC			09
523 10	Play Audio			0A
524 11	Play Audio MSF			0B
525 12	Play Audio Track/Index		0C
526 
527 Status Commands:
528 13	Read Status			81
529 14	Read Error			82
530 15	Read Drive Version		83
531 16	Mode Select			84
532 17	Mode Sense			85
533 18	Set XA Parameter		86
534 19	Read XA Parameter		87
535 20	Read Capacity			88
536 21	Read SUB_Q			89
537 22	Read Disc Code			8A
538 23	Read Disc Information		8B
539 24	Read TOC			8C
540 25	Pause/Resume			8D
541 26	Read Packet			8E
542 27	Read Path Check			00
543 
544 
545 all numbers (lba, msf-bin, msf-bcd, counts) to transfer high byte first
546 
547 mnemo     7-byte command        #bytes response (r0...rn)
548 ________ ____________________  ____
549 
550 Read Status:
551 status:  81.                    (1)  one-byte command, gives the main
552                                                           status byte
553 Read Error:
554 check1:  82 00 00 00 00 00 00.  (6)  r1: audio status
555 
556 Read Packet:
557 check2:  8e xx 00 00 00 00 00. (xx)  gets xx bytes response, relating
558                                         to commands 01 04 05 07 08 09
559 
560 Play Audio:
561 play:    0a ll-bb-aa nn-nn-nn.  (0)  play audio, ll-bb-aa: starting block (lba),
562                                                  nn-nn-nn: #blocks
563 Play Audio MSF:
564          0b mm-ss-ff mm-ss-ff   (0)  play audio from/to
565 
566 Play Audio Track/Index:
567          0c ...
568 
569 Pause/Resume:
570 pause:   8d pr 00 00 00 00 00.  (0)  pause (pr=00)
571                                      resume (pr=80) audio playing
572 
573 Mode Select:
574          84 00 nn-nn ??.?? 00   (0)  nn-nn: 2048 or 2340
575                                      possibly defines transfer size
576 
577 set_vol: 84 83 00 00 sw le 00.  (0)  sw(itch): lrxxxxxx (off=1)
578                                      le(vel): min=0, max=FF, else half
579 				     (firmware 2.11)
580 
581 Mode Sense:
582 get_vol: 85 03 00 00 00 00 00.  (2)  tell current audio volume setting
583 
584 Read Disc Information:
585 tocdesc: 8b 00 00 00 00 00 00.  (6)  read the toc descriptor ("msf-bin"-format)
586 
587 Read TOC:
588 tocent:  8c fl nn 00 00 00 00.  (8)  read toc entry #nn
589                                        (fl=0:"lba"-, =2:"msf-bin"-format)
590 
591 Read Capacity:
592 capacit: 88 00 00 00 00 00 00.  (5)  "read CD-ROM capacity"
593 
594 
595 Read Path Check:
596 ping:    00 00 00 00 00 00 00.  (2)  r0=AA, r1=55
597                                      ("ping" if the drive is connected)
598 
599 Read Drive Version:
600 ident:   83 00 00 00 00 00 00. (12)  gives "MATSHITAn.nn"
601                                      (n.nn = 2.01, 2.11., 3.00, ...)
602 
603 Seek:
604 seek:    01 00 ll-bb-aa 00 00.  (0)
605 seek:    01 02 mm-ss-ff 00 00.  (0)
606 
607 Read Data:
608 read:    02 xx-xx-xx nn-nn fl.  (?)  read nn-nn blocks of 2048 bytes,
609                                      starting at block xx-xx-xx
610                                      fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
611 
612 Read XA-Data:
613 read:    03 xx-xx-xx nn-nn fl.  (?)  read nn-nn blocks of 2340 bytes,
614                                      starting at block xx-xx-xx
615                                      fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx
616 
617 Read SUB_Q:
618          89 fl 00 00 00 00 00. (13)  r0: audio status, r4-r7: lba/msf,
619                                        fl=0: "lba", fl=2: "msf"
620 
621 Read Disc Code:
622          8a 00 00 00 00 00 00. (14)  possibly extended "check condition"-info
623 
624 Read Header:
625          04 00 ll-bb-aa 00 00.  (0)   4 bytes response with "check2"
626          04 02 mm-ss-ff 00 00.  (0)   4 bytes response with "check2"
627 
628 Spin Up:
629          05 00 ll-bb-aa 00 00.  (0)  possibly implies a "seek"
630 
631 Spin Down:
632          06 ...
633 
634 Diagnostic:
635          07 00 ll-bb-aa 00 00.  (2)   2 bytes response with "check2"
636          07 02 mm-ss-ff 00 00.  (2)   2 bytes response with "check2"
637 
638 Read UPC:
639          08 00 ll-bb-aa 00 00. (16)
640          08 02 mm-ss-ff 00 00. (16)
641 
642 Read ISRC:
643          09 00 ll-bb-aa 00 00. (15)  15 bytes response with "check2"
644          09 02 mm-ss-ff 00 00. (15)  15 bytes response with "check2"
645 
646 Set XA Parameter:
647          86 ...
648 
649 Read XA Parameter:
650          87 ...
651 
652 ==============================================================================
653 ============================================================================*/
654 
655 /*
656  * commands
657  *
658  * CR-52x:      CMD0_
659  * CR-56x:      CMD1_
660  * CD200:       CMD2_
661  * LCS-7260:    CMDL_
662  * TEAC CD-55A: CMDT_
663  * ECS-AT:      CMDV_
664  */
665 #define CMD1_RESET	0x0a
666 #define CMD2_RESET	0x01
667 #define CMDT_RESET	0xc0
668 
669 #define CMD1_LOCK_CTL	0x0c
670 #define CMD2_LOCK_CTL	0x1e
671 #define CMDT_LOCK_CTL	CMD2_LOCK_CTL
672 #define CMDL_LOCK_CTL	0x0e
673 #define CMDV_LOCK_CTL	CMDL_LOCK_CTL
674 
675 #define CMD1_TRAY_CTL	0x07
676 #define CMD2_TRAY_CTL	0x1b
677 #define CMDT_TRAY_CTL	CMD2_TRAY_CTL
678 #define CMDL_TRAY_CTL	0x0d
679 #define CMDV_TRAY_CTL	CMDL_TRAY_CTL
680 
681 #define CMD1_MULTISESS	0x8d
682 #define CMDL_MULTISESS	0x8c
683 #define CMDV_MULTISESS	CMDL_MULTISESS
684 
685 #define CMD1_SUBCHANINF	0x11
686 #define CMD2_SUBCHANINF	0x??
687 
688 #define CMD1_ABORT	0x08
689 #define CMD2_ABORT	0x08
690 #define CMDT_ABORT	0x08
691 
692 #define CMD2_x02	0x02
693 
694 #define CMD2_SETSPEED	0xda
695 
696 #define CMD0_PATH_CHECK	0x00
697 #define CMD1_PATH_CHECK	0x???
698 #define CMD2_PATH_CHECK	0x???
699 #define CMDT_PATH_CHECK	0x???
700 #define CMDL_PATH_CHECK	CMD0_PATH_CHECK
701 #define CMDV_PATH_CHECK	CMD0_PATH_CHECK
702 
703 #define CMD0_SEEK	0x01
704 #define CMD1_SEEK	CMD0_SEEK
705 #define CMD2_SEEK	0x2b
706 #define CMDT_SEEK	CMD2_SEEK
707 #define CMDL_SEEK	CMD0_SEEK
708 #define CMDV_SEEK	CMD0_SEEK
709 
710 #define CMD0_READ	0x02
711 #define CMD1_READ	0x10
712 #define CMD2_READ	0x28
713 #define CMDT_READ	CMD2_READ
714 #define CMDL_READ	CMD0_READ
715 #define CMDV_READ	CMD0_READ
716 
717 #define CMD0_READ_XA	0x03
718 #define CMD2_READ_XA	0xd4
719 #define CMD2_READ_XA2	0xd5
720 #define CMDL_READ_XA	CMD0_READ_XA /* really ?? */
721 #define CMDV_READ_XA	CMD0_READ_XA
722 
723 #define CMD0_READ_HEAD	0x04
724 
725 #define CMD0_SPINUP	0x05
726 #define CMD1_SPINUP	0x02
727 #define CMD2_SPINUP	CMD2_TRAY_CTL
728 #define CMDL_SPINUP	CMD0_SPINUP
729 #define CMDV_SPINUP	CMD0_SPINUP
730 
731 #define CMD0_SPINDOWN	0x06 /* really??? */
732 #define CMD1_SPINDOWN	0x06
733 #define CMD2_SPINDOWN	CMD2_TRAY_CTL
734 #define CMDL_SPINDOWN	0x0d
735 #define CMDV_SPINDOWN	CMD0_SPINDOWN
736 
737 #define CMD0_DIAG	0x07
738 
739 #define CMD0_READ_UPC	0x08
740 #define CMD1_READ_UPC	0x88
741 #define CMD2_READ_UPC	0x???
742 #define CMDL_READ_UPC	CMD0_READ_UPC
743 #define CMDV_READ_UPC	0x8f
744 
745 #define CMD0_READ_ISRC	0x09
746 
747 #define CMD0_PLAY	0x0a
748 #define CMD1_PLAY	0x???
749 #define CMD2_PLAY	0x???
750 #define CMDL_PLAY	CMD0_PLAY
751 #define CMDV_PLAY	CMD0_PLAY
752 
753 #define CMD0_PLAY_MSF	0x0b
754 #define CMD1_PLAY_MSF	0x0e
755 #define CMD2_PLAY_MSF	0x47
756 #define CMDT_PLAY_MSF	CMD2_PLAY_MSF
757 #define CMDL_PLAY_MSF	0x???
758 
759 #define CMD0_PLAY_TI	0x0c
760 #define CMD1_PLAY_TI	0x0f
761 
762 #define CMD0_STATUS	0x81
763 #define CMD1_STATUS	0x05
764 #define CMD2_STATUS	0x00
765 #define CMDT_STATUS	CMD2_STATUS
766 #define CMDL_STATUS	CMD0_STATUS
767 #define CMDV_STATUS	CMD0_STATUS
768 #define CMD2_SEEK_LEADIN 0x00
769 
770 #define CMD0_READ_ERR	0x82
771 #define CMD1_READ_ERR	CMD0_READ_ERR
772 #define CMD2_READ_ERR	0x03
773 #define CMDT_READ_ERR	CMD2_READ_ERR /* get audio status */
774 #define CMDL_READ_ERR	CMD0_READ_ERR
775 #define CMDV_READ_ERR	CMD0_READ_ERR
776 
777 #define CMD0_READ_VER	0x83
778 #define CMD1_READ_VER	CMD0_READ_VER
779 #define CMD2_READ_VER	0x12
780 #define CMDT_READ_VER	CMD2_READ_VER /* really ?? */
781 #define CMDL_READ_VER	CMD0_READ_VER
782 #define CMDV_READ_VER	CMD0_READ_VER
783 
784 #define CMD0_SETMODE	0x84
785 #define CMD1_SETMODE	0x09
786 #define CMD2_SETMODE	0x55
787 #define CMDT_SETMODE	CMD2_SETMODE
788 #define CMDL_SETMODE	CMD0_SETMODE
789 
790 #define CMD0_GETMODE	0x85
791 #define CMD1_GETMODE	0x84
792 #define CMD2_GETMODE	0x5a
793 #define CMDT_GETMODE	CMD2_GETMODE
794 #define CMDL_GETMODE	CMD0_GETMODE
795 
796 #define CMD0_SET_XA	0x86
797 
798 #define CMD0_GET_XA	0x87
799 
800 #define CMD0_CAPACITY	0x88
801 #define CMD1_CAPACITY	0x85
802 #define CMD2_CAPACITY	0x25
803 #define CMDL_CAPACITY	CMD0_CAPACITY /* missing in some firmware versions */
804 
805 #define CMD0_READSUBQ	0x89
806 #define CMD1_READSUBQ	0x87
807 #define CMD2_READSUBQ	0x42
808 #define CMDT_READSUBQ	CMD2_READSUBQ
809 #define CMDL_READSUBQ	CMD0_READSUBQ
810 #define CMDV_READSUBQ	CMD0_READSUBQ
811 
812 #define CMD0_DISKCODE	0x8a
813 
814 #define CMD0_DISKINFO	0x8b
815 #define CMD1_DISKINFO	CMD0_DISKINFO
816 #define CMD2_DISKINFO	0x43
817 #define CMDT_DISKINFO	CMD2_DISKINFO
818 #define CMDL_DISKINFO	CMD0_DISKINFO
819 #define CMDV_DISKINFO	CMD0_DISKINFO
820 
821 #define CMD0_READTOC	0x8c
822 #define CMD1_READTOC	CMD0_READTOC
823 #define CMD2_READTOC	0x???
824 #define CMDL_READTOC	CMD0_READTOC
825 #define CMDV_READTOC	CMD0_READTOC
826 
827 #define CMD0_PAU_RES	0x8d
828 #define CMD1_PAU_RES	0x0d
829 #define CMD2_PAU_RES	0x4b
830 #define CMDT_PAUSE	CMD2_PAU_RES
831 #define CMDL_PAU_RES	CMD0_PAU_RES
832 #define CMDV_PAUSE	CMD0_PAU_RES
833 
834 #define CMD0_PACKET	0x8e
835 #define CMD1_PACKET	CMD0_PACKET
836 #define CMD2_PACKET	0x???
837 #define CMDL_PACKET	CMD0_PACKET
838 #define CMDV_PACKET	0x???
839 
840 /*==========================================================================*/
841 /*==========================================================================*/
842 #endif /* _LINUX_SBPCD_H */
843 /*==========================================================================*/
844 /*
845  * Overrides for Emacs so that we follow Linus's tabbing style.
846  * Emacs will notice this stuff at the end of the file and automatically
847  * adjust the settings for this buffer only.  This must remain at the end
848  * of the file.
849  * ---------------------------------------------------------------------------
850  * Local variables:
851  * c-indent-level: 8
852  * c-brace-imaginary-offset: 0
853  * c-brace-offset: -8
854  * c-argdecl-indent: 8
855  * c-label-offset: -8
856  * c-continued-statement-offset: 8
857  * c-continued-brace-offset: 0
858  * End:
859  */
860