1 /* 2 * sbpcd.h Specify interface address and interface type here. 3 */ 4 5 /* 6 * the definitions for the first controller can get overridden by 7 * the kernel command line ("lilo boot option"). 8 * Examples: 9 * sbpcd=0x230,SoundBlaster 10 * or 11 * sbpcd=0x300,LaserMate 12 * or 13 * sbpcd=0x330,SPEA 14 * 15 * These strings are case sensitive !!! 16 */ 17 18 /* 19 * put your CDROM port base address into CDROM_PORT 20 * and specify the type of your interface in SBPRO. 21 * 22 * SBPRO addresses typically are 0x0230 (=0x220+0x10), 0x0250, ... 23 * LASERMATE (CI-101P, WDH-7001C) addresses typically are 0x0300, 0x0310, ... 24 * SPEA addresses are 0x320, 0x330, 0x340, 0x350 25 * there are some soundcards on the market with 0x0630, 0x0650, ... 26 * 27 * example: if your SBPRO audio address is 0x220, specify 0x230. 28 * 29 * 30 * set SBPRO to 1 for "true" SoundBlaster card 31 * set SBPRO to 0 for "poor" (no sound) interface cards 32 * and for "compatible" soundcards. 33 * set SBPRO to 2 for the SPEA Media FX card 34 * 35 * most "compatible" sound boards like Galaxy need to set SBPRO to 0 !!! 36 * if SBPRO gets set wrong, the drive will get found - but any 37 * data access will give errors (audio access will work). 38 * The OmniCD interface card from CreativeLabs needs SBPRO 1. 39 * 40 * mail to emoenke@gwdg.de if your "compatible" card needs SBPRO 1 41 * (currently I do not know any "compatible" with SBPRO 1) 42 * then I can include better information with the next release. 43 */ 44 #if !(SBPCD_ISSUE-1) /* first (or if you have only one) interface board: */ 45 #define CDROM_PORT 0x0340 46 #define SBPRO 0 47 #endif 48 49 /* 50 * If you have a "compatible" soundcard of type "SBPRO 0" or "SBPRO 2", 51 * enter your sound card's base address here if you want sbpcd to turn 52 * the CD sound channels on. 53 * 54 * Example: #define SOUND_BASE 0x220 enables the sound card's CD channels 55 * #define SOUND_BASE 0 leaves the soundcard untouched 56 */ 57 #define SOUND_BASE 0x220 58 59 /* ignore the rest if you have only one interface board & driver */ 60 61 #if !(SBPCD_ISSUE-2) /* second interface board: */ 62 #define CDROM_PORT 0x0370 63 #define SBPRO 0 64 #endif 65 #if !(SBPCD_ISSUE-3) /* third interface board: */ 66 #define CDROM_PORT 0x0330 67 #define SBPRO 0 68 #endif 69 #if !(SBPCD_ISSUE-4) /* fourth interface board: */ 70 #define CDROM_PORT 0x0230 71 #define SBPRO 1 72 #endif 73 74 /*==========================================================================*/ 75 /*==========================================================================*/ 76 /* 77 * nothing to change below here if you are not experimenting 78 */ 79 #ifndef _LINUX_SBPCD_H 80 81 #define _LINUX_SBPCD_H 82 83 /*==========================================================================*/ 84 /*==========================================================================*/ 85 /* 86 * DDI interface definitions 87 * "invented" by Fred N. van Kempen.. 88 */ 89 #define DDIOCSDBG 0x9000 90 #define DPRINTF(x) sbpcd_dprintf x 91 92 /*==========================================================================*/ 93 /* 94 * Debug output levels 95 */ 96 #define DBG_INF 1 /* necessary information */ 97 #define DBG_BSZ 2 /* BLOCK_SIZE trace */ 98 #define DBG_REA 3 /* "read" status trace */ 99 #define DBG_CHK 4 /* "media check" trace */ 100 #define DBG_TIM 5 /* datarate timer test */ 101 #define DBG_INI 6 /* initialization trace */ 102 #define DBG_TOC 7 /* tell TocEntry values */ 103 #define DBG_IOC 8 /* ioctl trace */ 104 #define DBG_STA 9 /* "ResponseStatus" trace */ 105 #define DBG_ERR 10 /* "xx_ReadError" trace */ 106 #define DBG_CMD 11 /* "cmd_out" trace */ 107 #define DBG_WRN 12 /* give explanation before auto-probing */ 108 #define DBG_MUL 13 /* multi session code test */ 109 #define DBG_ID 14 /* "drive_id !=0" test code */ 110 #define DBG_IOX 15 /* some special information */ 111 #define DBG_DID 16 /* drive ID test */ 112 #define DBG_RES 17 /* drive reset info */ 113 #define DBG_SPI 18 /* SpinUp test */ 114 #define DBG_IOS 19 /* ioctl trace: "subchannel" */ 115 #define DBG_IO2 20 /* ioctl trace: general */ 116 #define DBG_UPC 21 /* show UPC information */ 117 #define DBG_XA 22 /* XA mode debugging */ 118 #define DBG_LCK 23 /* door (un)lock info */ 119 #define DBG_SQ 24 /* dump SubQ frame */ 120 #define DBG_AUD 25 /* "read audio" debugging */ 121 #define DBG_SEQ 26 /* Sequoia interface configuration trace */ 122 #define DBG_LCS 27 /* Longshine LCS-7260 debugging trace */ 123 #define DBG_TEA 28 /* TEAC CD-55A debugging trace */ 124 #define DBG_000 29 /* unnecessary information */ 125 126 /*==========================================================================*/ 127 /*==========================================================================*/ 128 129 /* 130 * bits of flags_cmd_out: 131 */ 132 #define f_respo3 0x100 133 #define f_putcmd 0x80 134 #define f_respo2 0x40 135 #define f_lopsta 0x20 136 #define f_getsta 0x10 137 #define f_ResponseStatus 0x08 138 #define f_obey_p_check 0x04 139 #define f_bit1 0x02 140 #define f_wait_if_busy 0x01 141 142 /* 143 * diskstate_flags: 144 */ 145 #define upc_bit 0x40 146 #define volume_bit 0x20 147 #define toc_bit 0x10 148 #define cd_size_bit 0x04 149 #define subq_bit 0x02 150 #define frame_size_bit 0x01 151 152 /* 153 * disk states (bits of diskstate_flags): 154 */ 155 #define upc_valid (DriveStruct[d].diskstate_flags&upc_bit) 156 #define volume_valid (DriveStruct[d].diskstate_flags&volume_bit) 157 #define toc_valid (DriveStruct[d].diskstate_flags&toc_bit) 158 #define cd_size_valid (DriveStruct[d].diskstate_flags&cd_size_bit) 159 #define subq_valid (DriveStruct[d].diskstate_flags&subq_bit) 160 #define frame_size_valid (DriveStruct[d].diskstate_flags&frame_size_bit) 161 162 163 /* 164 * bits of the status_byte (result of xx_ReadStatus): 165 */ 166 #define p_door_closed 0x80 167 #define p_caddy_in 0x40 168 #define p_spinning 0x20 169 #define p_check 0x10 170 #define p_busy_new 0x08 171 #define p_door_locked 0x04 172 #define p_bit_1 0x02 /* hopefully unused now */ 173 #define p_lcs_door_locked 0x02 /* new use of old bit */ 174 #define p_disk_ok 0x01 175 #define p_lcs_door_closed 0x01 /* new use of old bit */ 176 /* 177 * "old" drives status result bits: 178 */ 179 #define p_caddin_old 0x40 180 #define p_success_old 0x08 181 #define p_busy_old 0x04 182 183 /* 184 * used drive states: 185 */ 186 #define st_door_closed (DriveStruct[d].status_byte&p_door_closed) 187 #define st_caddy_in (DriveStruct[d].status_byte&p_caddy_in) 188 #define st_spinning (DriveStruct[d].status_byte&p_spinning) 189 #define st_check (DriveStruct[d].status_byte&p_check) 190 #define st_busy (DriveStruct[d].status_byte&p_busy_new) 191 #define st_door_locked (DriveStruct[d].status_byte&p_door_locked) 192 #define st_diskok (DriveStruct[d].status_byte&p_disk_ok) 193 194 /* 195 * bits of the CDi_status register: 196 */ 197 #define s_not_result_ready 0x04 /* 0: "result ready" */ 198 #define s_not_data_ready 0x02 /* 0: "data ready" */ 199 #define s_attention 0x01 /* 1: "attention required" */ 200 /* 201 * usable as: 202 */ 203 #define DRV_ATTN ((inb(CDi_status)&s_attention)!=0) 204 #define DATA_READY ((inb(CDi_status)&s_not_data_ready)==0) 205 #define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0) 206 207 /* 208 * drive types (firmware versions): 209 */ 210 #define drv_old 0x10 /* CR-52x family */ 211 #define drv_199 0x11 /* <200 */ 212 #define drv_200 0x12 /* <201 */ 213 #define drv_201 0x13 /* <210 */ 214 #define drv_210 0x14 /* <211 */ 215 #define drv_211 0x15 /* <300 */ 216 #define drv_300 0x16 /* >=300 */ 217 218 #define drv_lcs 0x20 /* Longshine family */ 219 #define drv_260 0x21 /* LCS-7260 */ 220 221 #define drv_new 0x40 /* CR-56x family */ 222 #define drv_099 0x41 /* <100 */ 223 #define drv_100 0x42 /* >=100 */ 224 225 #define old_drive (DriveStruct[d].drv_type&drv_old) 226 #define lcs_drive (DriveStruct[d].drv_type&drv_lcs) 227 #define new_drive (DriveStruct[d].drv_type&drv_new) 228 229 /* 230 * audio states: 231 */ 232 #define audio_playing 2 233 #define audio_pausing 1 234 235 /* 236 * drv_pattern, drv_options: 237 */ 238 #define speed_auto 0x80 239 #define speed_300 0x40 240 #define speed_150 0x20 241 #define sax_a 0x04 242 #define sax_xn2 0x02 243 #define sax_xn1 0x01 244 245 /* 246 * values of cmd_type (0 else): 247 */ 248 #define READ_M1 0x01 /* "data mode 1": 2048 bytes per frame */ 249 #define READ_M2 0x02 /* "data mode 2": 12+2048+280 bytes per frame */ 250 #define READ_SC 0x04 /* "subchannel info": 96 bytes per frame */ 251 #define READ_AU 0x08 /* "audio frame": 2352 bytes per frame */ 252 253 /* 254 * sense byte: used only if new_drive 255 * only during cmd 09 00 xx ah al 00 00 256 * 257 * values: 00 258 * 82 "raw audio" mode 259 * xx from infobuf[0] after 85 00 00 00 00 00 00 260 */ 261 262 /* audio status (bin) */ 263 #define aud_00 0x00 /* Audio status byte not supported or not valid */ 264 #define audx11 0x0b /* Audio play operation in progress */ 265 #define audx12 0x0c /* Audio play operation paused */ 266 #define audx13 0x0d /* Audio play operation successfully completed */ 267 #define audx14 0x0e /* Audio play operation stopped due to error */ 268 #define audx15 0x0f /* No current audio status to return */ 269 270 /* audio status (bcd) */ 271 #define aud_11 0x11 /* Audio play operation in progress */ 272 #define aud_12 0x12 /* Audio play operation paused */ 273 #define aud_13 0x13 /* Audio play operation successfully completed */ 274 #define aud_14 0x14 /* Audio play operation stopped due to error */ 275 #define aud_15 0x15 /* No current audio status to return */ 276 277 /*============================================================================ 278 ============================================================================== 279 280 COMMAND SET of "old" drives like CR-521, CR-522 281 (the CR-562 family is different): 282 283 No. Command Code 284 -------------------------------------------- 285 286 Drive Commands: 287 1 Seek 01 288 2 Read Data 02 289 3 Read XA-Data 03 290 4 Read Header 04 291 5 Spin Up 05 292 6 Spin Down 06 293 7 Diagnostic 07 294 8 Read UPC 08 295 9 Read ISRC 09 296 10 Play Audio 0A 297 11 Play Audio MSF 0B 298 12 Play Audio Track/Index 0C 299 300 Status Commands: 301 13 Read Status 81 302 14 Read Error 82 303 15 Read Drive Version 83 304 16 Mode Select 84 305 17 Mode Sense 85 306 18 Set XA Parameter 86 307 19 Read XA Parameter 87 308 20 Read Capacity 88 309 21 Read SUB_Q 89 310 22 Read Disc Code 8A 311 23 Read Disc Information 8B 312 24 Read TOC 8C 313 25 Pause/Resume 8D 314 26 Read Packet 8E 315 27 Read Path Check 00 316 317 318 all numbers (lba, msf-bin, msf-bcd, counts) to transfer high byte first 319 320 mnemo 7-byte command #bytes response (r0...rn) 321 ________ ____________________ ____ 322 323 Read Status: 324 status: 81. (1) one-byte command, gives the main 325 status byte 326 Read Error: 327 check1: 82 00 00 00 00 00 00. (6) r1: audio status 328 329 Read Packet: 330 check2: 8e xx 00 00 00 00 00. (xx) gets xx bytes response, relating 331 to commands 01 04 05 07 08 09 332 333 Play Audio: 334 play: 0a ll-bb-aa nn-nn-nn. (0) play audio, ll-bb-aa: starting block (lba), 335 nn-nn-nn: #blocks 336 Play Audio MSF: 337 0b mm-ss-ff mm-ss-ff (0) play audio from/to 338 339 Play Audio Track/Index: 340 0c ... 341 342 Pause/Resume: 343 pause: 8d pr 00 00 00 00 00. (0) pause (pr=00) 344 resume (pr=80) audio playing 345 346 Mode Select: 347 84 00 nn-nn ??-?? 00 (0) nn-nn: 2048 or 2340 348 possibly defines transfer size 349 350 set_vol: 84 83 00 00 sw le 00. (0) sw(itch): lrxxxxxx (off=1) 351 le(vel): min=0, max=FF, else half 352 (firmware 2.11) 353 354 Mode Sense: 355 get_vol: 85 03 00 00 00 00 00. (2) tell current audio volume setting 356 357 Read Disc Information: 358 tocdesc: 8b 00 00 00 00 00 00. (6) read the toc descriptor ("msf-bin"-format) 359 360 Read TOC: 361 tocent: 8c fl nn 00 00 00 00. (8) read toc entry #nn 362 (fl=0:"lba"-, =2:"msf-bin"-format) 363 364 Read Capacity: 365 capacit: 88 00 00 00 00 00 00. (5) "read CD-ROM capacity" 366 367 368 Read Path Check: 369 ping: 00 00 00 00 00 00 00. (2) r0=AA, r1=55 370 ("ping" if the drive is connected) 371 372 Read Drive Version: 373 ident: 83 00 00 00 00 00 00. (12) gives "MATSHITAn.nn" 374 (n.nn = 2.01, 2.11., 3.00, ...) 375 376 Seek: 377 seek: 01 00 ll-bb-aa 00 00. (0) 378 seek: 01 02 mm-ss-ff 00 00. (0) 379 380 Read Data: 381 read: 02 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2048 bytes, 382 starting at block xx-xx-xx 383 fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx 384 385 Read XA-Data: 386 read: 03 xx-xx-xx nn-nn fl. (??) read nn-nn blocks of 2340 bytes, 387 starting at block xx-xx-xx 388 fl=0: "lba"-, =2:"msf-bcd"-coded xx-xx-xx 389 390 Read SUB_Q: 391 89 fl 00 00 00 00 00. (13) r0: audio status, r4-r7: lba/msf, 392 fl=0: "lba", fl=2: "msf" 393 394 Read Disc Code: 395 8a 00 00 00 00 00 00. (14) possibly extended "check condition"-info 396 397 Read Header: 398 04 00 ll-bb-aa 00 00. (0) 4 bytes response with "check2" 399 04 02 mm-ss-ff 00 00. (0) 4 bytes response with "check2" 400 401 Spin Up: 402 05 00 ll-bb-aa 00 00. (0) possibly implies a "seek" 403 404 Spin Down: 405 06 ... 406 407 Diagnostic: 408 07 00 ll-bb-aa 00 00. (2) 2 bytes response with "check2" 409 07 02 mm-ss-ff 00 00. (2) 2 bytes response with "check2" 410 411 Read UPC: 412 08 00 ll-bb-aa 00 00. (16) 413 08 02 mm-ss-ff 00 00. (16) 414 415 Read ISRC: 416 09 00 ll-bb-aa 00 00. (15) 15 bytes response with "check2" 417 09 02 mm-ss-ff 00 00. (15) 15 bytes response with "check2" 418 419 Set XA Parameter: 420 86 ... 421 422 Read XA Parameter: 423 87 ... 424 425 ============================================================================== 426 ============================================================================*/ 427 428 /*==========================================================================*/ 429 /*==========================================================================*/ 430 431 /* 432 * highest allowed drive number (MINOR+1) 433 */ 434 #define NR_SBPCD 4 435 436 /* 437 * we try to never disable interrupts - seems to work 438 */ 439 #define SBPCD_DIS_IRQ 0 440 441 /* 442 * "write byte to port" 443 */ 444 #define OUT(x,y) outb(y,x) 445 446 /* 447 * use "REP INSB" for strobing the data in: 448 */ 449 #define READ_DATA(port, buf, nr) insb(port, buf, nr) 450 451 /*==========================================================================*/ 452 453 #define MIXER_CD_Volume 0x28 /* internal SB Pro register address */ 454 455 /*==========================================================================*/ 456 /* 457 * Creative Labs Programmers did this: 458 */ 459 #define MAX_TRACKS 120 /* why more than 99? */ 460 461 /*==========================================================================*/ 462 /* 463 * To make conversions easier (machine dependent!) 464 */ 465 typedef union _msf 466 { 467 u_int n; 468 u_char c[4]; 469 } 470 MSF; 471 472 typedef union _blk 473 { 474 u_int n; 475 u_char c[4]; 476 } 477 BLK; 478 479 /*==========================================================================*/ 480 #endif _LINUX_SBPCD_H