root/include/linux/cdrom.h

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

INCLUDED FROM


   1 /****************************************************************************************
   2  *                                                                                      *
   3  * general (not only SCSI) header library for linux CDROM drivers                       *
   4  * (C) 1992 David Giller rafetmad@oxy.edu                                               *
   5  *     1994 Eberhard Moenkeberg emoenke@gwdg.de ("read audio" and some other stuff)     *
   6  *                                                                                      *
   7  * <linux/cdrom.h> -- CD-ROM IOCTLs and structs                                         *
   8  *                                                                                      *
   9  ****************************************************************************************/
  10 
  11 #ifndef _LINUX_CDROM_H
  12 #define _LINUX_CDROM_H
  13 
  14 /*
  15  * some fix numbers
  16  */
  17 #define CD_MINS                   74  /* max. minutes per CD             */
  18 #define CD_SECS                   60  /* seconds per minute              */
  19 #define CD_FRAMES                 75  /* frames per second               */
  20 #define CD_CHUNK_SIZE             24  /* lowest-level "data bytes piece" */
  21 #define CD_NUM_OF_CHUNKS          98  /* chunks per frame                */
  22 #define CD_FRAMESIZE            2048  /* bytes per frame, cooked mode    */
  23 #define CD_FRAMESIZE_RAW0       2336  /* bytes per frame, "raw" mode     */
  24 #define CD_FRAMESIZE_XA         2340  /* bytes per frame, "xa" mode      */
  25 #define CD_FRAMESIZE_RAW        2352  /* bytes per frame, "raw" mode     */
  26 #define CD_FRAMESIZE_SUB          96  /* subchannel data size            */
  27 #define CD_BLOCK_OFFSET          150  /* offset of first logical frame   */
  28 #define CD_XA_HEAD                12  /* header size of XA frame         */
  29 #define CD_XA_TAIL               280  /* tail size of XA frame           */
  30 
  31 /*
  32  *
  33  * For IOCTL calls, we will commandeer byte 0x53, or 'S'.
  34  *
  35  */
  36 
  37 /*
  38  * CD-ROM-specific SCSI command opcodes
  39  */
  40 
  41 /*
  42  * Group 2 (10-byte).  All of these are called 'optional' by SCSI-II.
  43  */
  44 
  45 #define SCMD_READ_TOC           0x43            /* read table of contents       */
  46 #define SCMD_PLAYAUDIO_MSF      0x47            /* play data at time offset     */
  47 #define SCMD_PLAYAUDIO_TI       0x48            /* play data at track/index     */
  48 #define SCMD_PAUSE_RESUME       0x4B            /* pause/resume audio           */
  49 #define SCMD_READ_SUBCHANNEL    0x42            /* read SC info on playing disc */
  50 #define SCMD_PLAYAUDIO10        0x45            /* play data at logical block   */
  51 #define SCMD_READ_HEADER        0x44            /* read TOC header              */
  52 
  53 /*
  54  * Group 5
  55  */
  56 
  57 #define SCMD_PLAYAUDIO12        0xA5            /* play data at logical block   */
  58 #define SCMD_PLAYTRACK_REL12    0xA9            /* play track at relative offset*/
  59 
  60 /*
  61  * Group 6 Commands
  62  */
  63 
  64 #define SCMD_CD_PLAYBACK_CONTROL 0xC9           /* Sony vendor-specific audio   */
  65 #define SCMD_CD_PLAYBACK_STATUS 0xC4            /* control opcodes. info please!*/
  66 
  67 /*
  68  * CD-ROM capacity structure.
  69  */
  70 
  71 struct scsi_capacity 
  72         {
  73         u_long  capacity;
  74         u_long  lbasize;
  75         };
  76 
  77 /*
  78  * CD-ROM MODE_SENSE/MODE_SELECT parameters
  79  */
  80 
  81 #define ERR_RECOVERY_PARMS      0x01
  82 #define DISCO_RECO_PARMS        0x02
  83 #define FORMAT_PARMS            0x03
  84 #define GEOMETRY_PARMS          0x04
  85 #define CERTIFICATION_PARMS     0x06
  86 #define CACHE_PARMS             0x38
  87 
  88 /*
  89  * standard mode-select header prepended to all mode-select commands
  90  */
  91 
  92 struct ccs_modesel_head 
  93         {
  94         u_char  _r1;                    /* reserved                             */
  95         u_char  medium;                 /* device-specific medium type          */
  96         u_char  _r2;                    /* reserved                             */
  97         u_char  block_desc_length;      /* block descriptor length              */
  98         u_char  density;                /* device-specific density code         */
  99         u_char  number_blocks_hi;       /* number of blocks in this block desc  */
 100         u_char  number_blocks_med;
 101         u_char  number_blocks_lo;
 102         u_char  _r3;
 103         u_char  block_length_hi;        /* block length for blocks in this desc */
 104         u_short block_length;
 105         };
 106 
 107 /*
 108  * error recovery parameters
 109  */
 110 
 111 struct ccs_err_recovery 
 112         {
 113         u_char  _r1             : 2;    /* reserved                             */
 114         u_char  page_code       : 6;    /* page code                            */
 115         u_char  page_length;            /* page length                          */
 116         u_char  awre            : 1;    /* auto write realloc enabled           */
 117         u_char  arre            : 1;    /* auto read realloc enabled            */
 118         u_char  tb              : 1;    /* transfer block                       */
 119         u_char  rc              : 1;    /* read continuous                      */
 120         u_char  eec             : 1;    /* enable early correction              */
 121         u_char  per             : 1;    /* post error                           */
 122         u_char  dte             : 1;    /* disable transfer on error            */
 123         u_char  dcr             : 1;    /* disable correction                   */
 124         u_char  retry_count;            /* error retry count                    */
 125         u_char  correction_span;        /* largest recov. to be attempted, bits */
 126         u_char  head_offset_count;      /* head offset (2's C) for each retry   */
 127         u_char  strobe_offset_count;    /* data strobe "                        */
 128         u_char  recovery_time_limit;    /* time limit on recovery attempts      */
 129 };
 130 
 131 /*
 132  * disco/reco parameters
 133  */
 134 
 135 struct ccs_disco_reco 
 136         {
 137         u_char  _r1             : 2;    /* reserved                             */
 138         u_char  page_code       : 6;    /* page code                            */
 139         u_char  page_length;            /* page length                          */
 140         u_char  buffer_full_ratio;      /* write buffer reconnect threshold     */
 141         u_char  buffer_empty_ratio;     /* read "                               */
 142         u_short bus_inactivity_limit;   /* limit on bus inactivity time         */
 143         u_short disconnect_time_limit;  /* minimum disconnect time              */
 144         u_short connect_time_limit;     /* minimum connect time                 */
 145         u_short _r2;                    /* reserved                             */
 146 };
 147 
 148 /*
 149  * drive geometry parameters
 150  */
 151 
 152 struct ccs_geometry 
 153         {
 154         u_char  _r1             : 2;    /* reserved                             */
 155         u_char  page_code       : 6;    /* page code                            */
 156         u_char  page_length;            /* page length                          */
 157         u_char  cyl_ub;                 /* #cyls                                */
 158         u_char  cyl_mb;
 159         u_char  cyl_lb;
 160         u_char  heads;                  /* #heads                               */
 161         u_char  precomp_cyl_ub;         /* precomp start                        */
 162         u_char  precomp_cyl_mb;
 163         u_char  precomp_cyl_lb;
 164         u_char  current_cyl_ub;         /* reduced current start                */
 165         u_char  current_cyl_mb;
 166         u_char  current_cyl_lb;
 167         u_short step_rate;              /* stepping motor rate                  */
 168         u_char  landing_cyl_ub;         /* landing zone                         */
 169         u_char  landing_cyl_mb;
 170         u_char  landing_cyl_lb;
 171         u_char  _r2;
 172         u_char  _r3;
 173         u_char  _r4;
 174         };
 175 
 176 /*
 177  * cache parameters
 178  */
 179 
 180 struct ccs_cache 
 181         {
 182         u_char  _r1             : 2;    /* reserved                             */
 183         u_char  page_code       : 6;    /* page code                            */
 184         u_char  page_length;            /* page length                          */
 185         u_char  mode;                   /* cache control byte                   */
 186         u_char  threshold;              /* prefetch threshold                   */
 187         u_char  max_prefetch;           /* maximum prefetch size                */
 188         u_char  max_multiplier;         /* maximum prefetch multiplier          */
 189         u_char  min_prefetch;           /* minimum prefetch size                */
 190         u_char  min_multiplier;         /* minimum prefetch multiplier          */
 191         u_char  _r2[8];
 192         };
 193 
 194 /*
 195  * CDROM IOCTL structures
 196  */
 197 
 198 struct cdrom_msf 
 199         {
 200         u_char  cdmsf_min0;             /* start minute                         */
 201         u_char  cdmsf_sec0;             /* start second                         */
 202         u_char  cdmsf_frame0;           /* start frame                          */
 203         u_char  cdmsf_min1;             /* end minute                           */
 204         u_char  cdmsf_sec1;             /* end second                           */
 205         u_char  cdmsf_frame1;           /* end frame                            */
 206         };
 207 
 208 struct cdrom_ti 
 209         {
 210         u_char  cdti_trk0;              /* start track                          */
 211         u_char  cdti_ind0;              /* start index                          */
 212         u_char  cdti_trk1;              /* end track                            */
 213         u_char  cdti_ind1;              /* end index                            */
 214         };
 215 
 216 struct cdrom_tochdr     
 217         {
 218         u_char  cdth_trk0;              /* start track                          */
 219         u_char  cdth_trk1;              /* end track                            */
 220         };
 221 
 222 struct cdrom_tocentry 
 223         {
 224         u_char  cdte_track;
 225         u_char  cdte_adr        :4;
 226         u_char  cdte_ctrl       :4;
 227         u_char  cdte_format;
 228         union
 229                 {
 230                 struct
 231                         {
 232                         u_char  minute;
 233                         u_char  second;
 234                         u_char  frame;
 235                         } msf;
 236                 int     lba;
 237                 } cdte_addr;
 238         u_char  cdte_datamode;
 239         };
 240 
 241 /*
 242  * CD-ROM address types (cdrom_tocentry.cdte_format)
 243  */
 244 #define CDROM_LBA 0x01 /* "logical block": first frame is #0 */
 245 #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */
 246 
 247 /*
 248  * bit to tell whether track is data or audio
 249  */
 250 
 251 #define CDROM_DATA_TRACK        0x04
 252 
 253 /*
 254  * The leadout track is always 0xAA, regardless of # of tracks on disc
 255  */
 256 
 257 #define CDROM_LEADOUT   0xAA
 258 
 259 struct cdrom_subchnl 
 260         {
 261         u_char  cdsc_format;
 262         u_char  cdsc_audiostatus;
 263         u_char  cdsc_adr:       4;
 264         u_char  cdsc_ctrl:      4;
 265         u_char  cdsc_trk;
 266         u_char  cdsc_ind;
 267         union
 268                 {
 269                 struct                  
 270                         {
 271                         u_char  minute;
 272                         u_char  second;
 273                         u_char  frame;
 274                         } msf;
 275                 int     lba;
 276                 } cdsc_absaddr;
 277         union 
 278                 {
 279                 struct 
 280                         {
 281                         u_char  minute;
 282                         u_char  second;
 283                         u_char  frame;
 284                         } msf;
 285                 int     lba;
 286                 } cdsc_reladdr;
 287         };
 288 
 289 /*
 290  * return value from READ SUBCHANNEL DATA
 291  */
 292 
 293 #define CDROM_AUDIO_INVALID     0x00    /* audio status not supported           */
 294 #define CDROM_AUDIO_PLAY        0x11    /* audio play operation in progress     */
 295 #define CDROM_AUDIO_PAUSED      0x12    /* audio play operation paused          */
 296 #define CDROM_AUDIO_COMPLETED   0x13    /* audio play successfully completed    */
 297 #define CDROM_AUDIO_ERROR       0x14    /* audio play stopped due to error      */
 298 #define CDROM_AUDIO_NO_STATUS   0x15    /* no current audio status to return    */
 299 
 300 struct cdrom_volctrl
 301         {
 302         u_char  channel0;
 303         u_char  channel1;
 304         u_char  channel2;
 305         u_char  channel3;
 306         };
 307 
 308 struct cdrom_read      
 309         {
 310         int     cdread_lba;
 311         caddr_t cdread_bufaddr;
 312         int     cdread_buflen;
 313         };
 314 
 315 /*
 316  * preliminary extensions for transferring audio frames
 317  * currently used by sbpcd.c
 318  * (still may change if other drivers will use it, too):
 319  */
 320 struct cdrom_read_audio
 321         {
 322           union
 323             {
 324               struct                    
 325                 {
 326                   u_char minute;
 327                   u_char second;
 328                   u_char frame;
 329                 } msf;
 330               int       lba;
 331             } addr; /* frame address */
 332           u_char addr_format; /* CDROM_LBA or CDROM_MSF */
 333           int nframes; /* number of 2352-byte-frames to read at once, limited by the drivers */
 334           u_char *buf; /* frame buffer (size: nframes*2352 bytes) */
 335         };
 336 
 337 /*
 338  * this has to be the "arg" of the CDROMMULTISESSION ioctl
 339  * for obtaining multi session info.
 340  * The returned "addr" is valid only if "xa_flag" is true.
 341  */
 342 struct cdrom_multisession
 343         {
 344           union
 345             {
 346               struct                    
 347                 {
 348                   u_char minute;
 349                   u_char second;
 350                   u_char frame;
 351                 } msf;
 352               int lba;
 353             } addr; /* frame address: start-of-last-session (not the new "frame 16"!)*/
 354           u_char xa_flag; /* 1: "is XA disk" */
 355           u_char addr_format; /* CDROM_LBA or CDROM_MSF */
 356         };
 357 
 358 #ifdef FIVETWELVE
 359 #define CDROM_MODE1_SIZE        512
 360 #else
 361 #define CDROM_MODE1_SIZE        2048
 362 #endif FIVETWELVE
 363 #define CDROM_MODE2_SIZE        2336
 364 
 365 /*
 366  * CD-ROM IOCTL commands
 367  */
 368 
 369 #define CDROMPAUSE              0x5301          /* pause                        */
 370 #define CDROMRESUME             0x5302          /* resume                       */
 371 
 372 #define CDROMPLAYMSF            0x5303          /* (struct cdrom_msf)           */
 373                                                 /* SCMD_PLAY_AUDIO_MSF          */
 374 
 375 #define CDROMPLAYTRKIND         0x5304          /* (struct cdrom_ti)            */
 376                                                 /* SCMD_PLAY_AUDIO_TI           */
 377 
 378 #define CDROMREADTOCHDR         0x5305          /* (struct cdrom_tochdr)        */
 379                                                 /* read the TOC header          */
 380 #define CDROMREADTOCENTRY       0x5306          /* (struct cdrom_tocentry)      */
 381                                                 /* read a TOC entry             */
 382 
 383 #define CDROMSTOP               0x5307          /* stop the drive motor         */
 384 #define CDROMSTART              0x5308          /* turn the motor on            */
 385 
 386 #define CDROMEJECT              0x5309          /* eject CD-ROM media           */
 387 
 388 #define CDROMVOLCTRL            0x530a          /* (struct cdrom_volctrl)       */
 389                                                 /* volume control               */
 390 
 391 #define CDROMSUBCHNL            0x530b          /* (struct cdrom_subchnl)       */
 392                                                 /* read Q sub-channel data      */
 393 
 394 #define CDROMREADMODE2          0x530c          /* (struct cdrom_read)          */
 395                                                 /* read type-2 data (not suppt) */
 396 
 397 #define CDROMREADMODE1          0x530d          /* (struct cdrom_read)          */
 398                                                 /* read type-1 data             */
 399 /*
 400  * preliminary extension for transferring audio frames
 401  * currently used by cdu31a.c and sbpcd.c
 402  * (still may change if other drivers will use it, too):
 403  */
 404 #define CDROMREADAUDIO          0x530e          /* (struct cdrom_read_audio)    */
 405 /*
 406  * preliminary extension for enable (1) / disable (0) auto-ejecting
 407  * currently used by sbpcd.c
 408  * (still may change if other drivers will use it, too):
 409  */
 410 #define CDROMEJECT_SW           0x530f          /* arg: 0 or 1 */
 411  
 412 /*
 413  * obtain the start-of-last-session address of multi session disks
 414  */
 415 #define CDROMMULTISESSION       0x5310 /* (struct cdrom_multisession) */
 416 
 417 #endif  _LINUX_CDROM_H

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