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

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