cdrom.h

Go to the documentation of this file.
00001 /**
00002 *
00003 ***************************************************************************************
00004  *                                                                                      *
00005  * SCSI header library for linux                                                        *
00006  * (C) 1992 David Giller rafetmad@oxy.edu                                               *
00007  *                                                                                      *
00008  * <linux/cdrom.h> -- CD-ROM IOCTLs and structs                                         *
00009  *                                                                                      *
00010 
00011 
00012 */
00013 
00014 #ifndef _LINUX_CDROM_H
00015 #define _LINUX_CDROM_H
00016 
00017 /**
00018 *
00019 
00020  *
00021  * For IOCTL calls, we will commandeer byte 0x53, or 'S'.
00022  *
00023 
00024 
00025 */
00026 
00027 /**
00028 *
00029 
00030  * CD-ROM-specific SCSI command opcodes
00031 
00032 
00033 */
00034 
00035 /**
00036 *
00037 
00038  * Group 2 (10-byte).  All of these are called 'optional' by SCSI-II.
00039 
00040 
00041 */
00042 
00043 #define SCMD_READ_TOC           0x43            ///< read table of contents     
00044 #define SCMD_PLAYAUDIO_MSF      0x47            ///< play data at time offset   
00045 #define SCMD_PLAYAUDIO_TI       0x48            ///< play data at track/index   
00046 #define SCMD_PAUSE_RESUME       0x4B            ///< pause/resume audio         
00047 #define SCMD_READ_SUBCHANNEL    0x42            ///< read SC info on playing disc 
00048 #define SCMD_PLAYAUDIO10        0x45            ///< play data at logical block 
00049 #define SCMD_READ_HEADER        0x44            ///< read TOC header            
00050 
00051 /**
00052 *
00053 
00054  * Group 5
00055 
00056 
00057 */
00058 
00059 #define SCMD_PLAYAUDIO12        0xA5            ///< play data at logical block 
00060 #define SCMD_PLAYTRACK_REL12    0xA9            ///< play track at relative offset
00061 
00062 /**
00063 *
00064 
00065  * Group 6 Commands
00066 
00067 
00068 */
00069 
00070 #define SCMD_CD_PLAYBACK_CONTROL 0xC9           ///< Sony vendor-specific audio 
00071 #define SCMD_CD_PLAYBACK_STATUS 0xC4            ///< control opcodes. info please!
00072 
00073 /**
00074 *
00075 
00076  * CD-ROM capacity structure.
00077 
00078 
00079 */
00080 
00081 struct scsi_capacity 
00082         {
00083         u_long  capacity;
00084         u_long  lbasize;
00085         };
00086 
00087 /**
00088 *
00089 
00090  * CD-ROM MODE_SENSE/MODE_SELECT parameters
00091 
00092 
00093 */
00094 
00095 #define ERR_RECOVERY_PARMS      0x01
00096 #define DISCO_RECO_PARMS        0x02
00097 #define FORMAT_PARMS            0x03
00098 #define GEOMETRY_PARMS          0x04
00099 #define CERTIFICATION_PARMS     0x06
00100 #define CACHE_PARMS             0x38
00101 
00102 /**
00103 *
00104 
00105  * standard mode-select header prepended to all mode-select commands
00106 
00107 
00108 */
00109 
00110 struct ccs_modesel_head 
00111         {
00112         u_char  _r1;                    ///< reserved                           
00113         u_char  medium;                 ///< device-specific medium type                
00114         u_char  _r2;                    ///< reserved                           
00115         u_char  block_desc_length;      ///< block descriptor length            
00116         u_char  density;                ///< device-specific density code               
00117         u_char  number_blocks_hi;       ///< number of blocks in this block desc        
00118         u_char  number_blocks_med;
00119         u_char  number_blocks_lo;
00120         u_char  _r3;
00121         u_char  block_length_hi;        ///< block length for blocks in this desc       
00122         u_short block_length;
00123         };
00124 
00125 /**
00126 *
00127 
00128  * error recovery parameters
00129 
00130 
00131 */
00132 
00133 struct ccs_err_recovery 
00134         {
00135         u_char  _r1             : 2;    ///< reserved                           
00136         u_char  page_code       : 6;    ///< page code                          
00137         u_char  page_length;            ///< page length                                
00138         u_char  awre            : 1;    ///< auto write realloc enabled                 
00139         u_char  arre            : 1;    ///< auto read realloc enabled          
00140         u_char  tb              : 1;    ///< transfer block                     
00141         u_char  rc              : 1;    ///< read continuous                    
00142         u_char  eec             : 1;    ///< enable early correction            
00143         u_char  per             : 1;    ///< post error                                 
00144         u_char  dte             : 1;    ///< disable transfer on error          
00145         u_char  dcr             : 1;    ///< disable correction                         
00146         u_char  retry_count;            ///< error retry count                  
00147         u_char  correction_span;        ///< largest recov. to be attempted, bits       
00148         u_char  head_offset_count;      ///< head offset (2's C) for each retry 
00149         u_char  strobe_offset_count;    ///< data strobe "                      
00150         u_char  recovery_time_limit;    ///< time limit on recovery attempts    
00151 };
00152 
00153 /**
00154 *
00155 
00156  * disco/reco parameters
00157 
00158 
00159 */
00160 
00161 struct ccs_disco_reco 
00162         {
00163         u_char  _r1             : 2;    ///< reserved                           
00164         u_char  page_code       : 6;    ///< page code                          
00165         u_char  page_length;            ///< page length                                
00166         u_char  buffer_full_ratio;      ///< write buffer reconnect threshold   
00167         u_char  buffer_empty_ratio;     ///< read "                             
00168         u_short bus_inactivity_limit;   ///< limit on bus inactivity time               
00169         u_short disconnect_time_limit;  ///< minimum disconnect time            
00170         u_short connect_time_limit;     ///< minimum connect time                       
00171         u_short _r2;                    ///< reserved                           
00172 };
00173 
00174 /**
00175 *
00176 
00177  * drive geometry parameters
00178 
00179 
00180 */
00181 
00182 struct ccs_geometry 
00183         {
00184         u_char  _r1             : 2;    ///< reserved                           
00185         u_char  page_code       : 6;    ///< page code                          
00186         u_char  page_length;            ///< page length                                
00187         u_char  cyl_ub;                 ///< #cyls                              
00188         u_char  cyl_mb;
00189         u_char  cyl_lb;
00190         u_char  heads;                  ///< #heads                             
00191         u_char  precomp_cyl_ub;         ///< precomp start                      
00192         u_char  precomp_cyl_mb;
00193         u_char  precomp_cyl_lb;
00194         u_char  current_cyl_ub;         ///< reduced current start              
00195         u_char  current_cyl_mb;
00196         u_char  current_cyl_lb;
00197         u_short step_rate;              ///< stepping motor rate                        
00198         u_char  landing_cyl_ub;         ///< landing zone                               
00199         u_char  landing_cyl_mb;
00200         u_char  landing_cyl_lb;
00201         u_char  _r2;
00202         u_char  _r3;
00203         u_char  _r4;
00204         };
00205 
00206 /**
00207 *
00208 
00209  * cache parameters
00210 
00211 
00212 */
00213 
00214 struct ccs_cache 
00215         {
00216         u_char  _r1             : 2;    ///< reserved                           
00217         u_char  page_code       : 6;    ///< page code                          
00218         u_char  page_length;            ///< page length                                
00219         u_char  mode;                   ///< cache control byte                 
00220         u_char  threshold;              ///< prefetch threshold                 
00221         u_char  max_prefetch;           ///< maximum prefetch size              
00222         u_char  max_multiplier;         ///< maximum prefetch multiplier                
00223         u_char  min_prefetch;           ///< minimum prefetch size              
00224         u_char  min_multiplier;         ///< minimum prefetch multiplier                
00225         u_char  _r2[8];
00226         };
00227 
00228 /**
00229 *
00230 
00231  * CDROM IOCTL structures
00232 
00233 
00234 */
00235 
00236 struct cdrom_msf 
00237         {
00238         u_char  cdmsf_min0;             ///< start minute                       
00239         u_char  cdmsf_sec0;             ///< start second                       
00240         u_char  cdmsf_frame0;           ///< start frame                        
00241         u_char  cdmsf_min1;             ///< end minute                         
00242         u_char  cdmsf_sec1;             ///< end second                         
00243         u_char  cdmsf_frame1;           ///< end frame                          
00244         };
00245 
00246 struct cdrom_ti 
00247         {
00248         u_char  cdti_trk0;              ///< start track                                
00249         u_char  cdti_ind0;              ///< start index                                
00250         u_char  cdti_trk1;              ///< end track                          
00251         u_char  cdti_ind1;              ///< end index                          
00252         };
00253 
00254 struct cdrom_tochdr     
00255         {
00256         u_char  cdth_trk0;              ///< start track                                
00257         u_char  cdth_trk1;              ///< end track                          
00258         };
00259 
00260 struct cdrom_tocentry 
00261         {
00262         u_char  cdte_track;
00263         u_char  cdte_adr        :4;
00264         u_char  cdte_ctrl       :4;
00265         u_char  cdte_format;
00266         union
00267                 {
00268                 struct
00269                         {
00270                         u_char  minute;
00271                         u_char  second;
00272                         u_char  frame;
00273                         } msf;
00274                 int     lba;
00275                 } cdte_addr;
00276         u_char  cdte_datamode;
00277         };
00278 
00279 /**
00280 *
00281 
00282  * CD-ROM address types (cdrom_tocentry.cdte_format)
00283 
00284 
00285 */
00286 
00287 #define CDROM_LBA       0x01
00288 #define CDROM_MSF       0x02
00289 
00290 /**
00291 *
00292 
00293  * bit to tell whether track is data or audio
00294 
00295 
00296 */
00297 
00298 #define CDROM_DATA_TRACK        0x04
00299 
00300 /**
00301 *
00302 
00303  * The leadout track is always 0xAA, regardless of # of tracks on disc
00304 
00305 
00306 */
00307 
00308 #define CDROM_LEADOUT   0xAA
00309 
00310 struct cdrom_subchnl 
00311         {
00312         u_char  cdsc_format;
00313         u_char  cdsc_audiostatus;
00314         u_char  cdsc_adr:       4;
00315         u_char  cdsc_ctrl:      4;
00316         u_char  cdsc_trk;
00317         u_char  cdsc_ind;
00318         union
00319                 {
00320                 struct                  
00321                         {
00322                         u_char  minute;
00323                         u_char  second;
00324                         u_char  frame;
00325                         } msf;
00326                 int     lba;
00327                 } cdsc_absaddr;
00328         union 
00329                 {
00330                 struct 
00331                         {
00332                         u_char  minute;
00333                         u_char  second;
00334                         u_char  frame;
00335                         } msf;
00336                 int     lba;
00337                 } cdsc_reladdr;
00338         };
00339 
00340 /**
00341 *
00342 
00343  * return value from READ SUBCHANNEL DATA
00344 
00345 
00346 */
00347 
00348 #define CDROM_AUDIO_INVALID     0x00    ///< audio status not supported                 
00349 #define CDROM_AUDIO_PLAY        0x11    ///< audio play operation in progress   
00350 #define CDROM_AUDIO_PAUSED      0x12    ///< audio play operation paused                
00351 #define CDROM_AUDIO_COMPLETED   0x13    ///< audio play successfully completed  
00352 #define CDROM_AUDIO_ERROR       0x14    ///< audio play stopped due to error    
00353 #define CDROM_AUDIO_NO_STATUS   0x15    ///< no current audio status to return  
00354 
00355 struct cdrom_volctrl
00356         {
00357         u_char  channel0;
00358         u_char  channel1;
00359         u_char  channel2;
00360         u_char  channel3;
00361         };
00362 
00363 struct cdrom_read      
00364         {
00365         int     cdread_lba;
00366         caddr_t cdread_bufaddr;
00367         int     cdread_buflen;
00368         };
00369 
00370 #ifdef FIVETWELVE
00371 #define CDROM_MODE1_SIZE        512
00372 #else
00373 #define CDROM_MODE1_SIZE        2048
00374 #endif FIVETWELVE
00375 #define CDROM_MODE2_SIZE        2336
00376 
00377 /**
00378 *
00379 
00380  * CD-ROM IOCTL commands
00381 
00382 
00383 */
00384 
00385 #define CDROMPAUSE              0x5301          ///< pause                      
00386 #define CDROMRESUME             0x5302          ///< resume                     
00387 
00388 #define CDROMPLAYMSF            0x5303          ///< (stuct cdrom_msf)          
00389                                                 /// SCMD_PLAY_AUDIO_MSF         
00390 
00391 #define CDROMPLAYTRKIND         0x5304          ///< (struct cdrom_ti)          
00392                                                 /// SCMD_PLAY_AUDIO_TI          
00393 
00394 #define CDROMREADTOCHDR         0x5305          ///< (struct cdrom_tochdr)      
00395                                                 /// read the TOC header         
00396 #define CDROMREADTOCENTRY       0x5306          ///< (struct cdrom_tocentry)    
00397                                                 /// read a TOC entry            
00398 
00399 #define CDROMSTOP               0x5307          ///< stop the drive motor               
00400 #define CDROMSTART              0x5308          ///< turn the motor on          
00401 
00402 #define CDROMEJECT              0x5309          ///< eject CD-ROM media         
00403 
00404 #define CDROMVOLCTRL            0x530a          ///< (struct cdrom_volctrl)     
00405                                                 /// vlume control               
00406 
00407 #define CDROMSUBCHNL            0x530b          ///< (struct cdrom_subchnl)     
00408                                                 /// read sub-channel data       
00409 
00410 #define CDROMREADMODE2          0x530c          ///< (struct cdrom_read)                
00411                                                 /// read type-2 data (not suppt)        
00412 
00413 #define CDROMREADMODE1          0x530d          ///< (struct cdrom_read)                
00414                                                 /// read type-1 data            
00415 
00416 #endif  _LINUX_CDROM_H

Generated on Mon May 1 21:47:00 2006 for KernelAPI by  doxygen 1.4.6-5