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

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