root/include/linux/sbpcd.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


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

/* [previous][next][first][last][top][bottom][index][help] */