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