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

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