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

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