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

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