root/include/linux/cdrom.h

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

INCLUDED FROM


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

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