cdu31a.h

Go to the documentation of this file.
00001 /**
00002 *
00003 
00004  * Definitions for a Sony interface CDROM drive.
00005  *
00006  * Corey Minyard (minyard@wf-rch.cirr.com)
00007  *
00008  *  Copyright (C) 1993  Corey Minyard
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023  *
00024 
00025 
00026 */
00027 
00028 /**
00029 *
00030 
00031  * Offsets (from the base address) and bits for the various write registers
00032  * of the drive.
00033 
00034 
00035 */
00036 #define SONY_CMD_REG_OFFSET     0
00037 #define SONY_PARAM_REG_OFFSET   1
00038 #define SONY_WRITE_REG_OFFSET   2
00039 #define SONY_CONTROL_REG_OFFSET 3
00040 #       define SONY_ATTN_CLR_BIT        0x01
00041 #       define SONY_RES_RDY_CLR_BIT     0x02
00042 #       define SONY_DATA_RDY_CLR_BIT    0x04
00043 #       define SONY_ATTN_INT_EN_BIT     0x08
00044 #       define SONY_RES_RDY_INT_EN_BIT  0x10
00045 #       define SONY_DATA_RDY_INT_EN_BIT 0x20
00046 #       define SONY_PARAM_CLR_BIT       0x40
00047 #       define SONY_DRIVE_RESET_BIT     0x80
00048 
00049 /**
00050 *
00051 
00052  * Offsets (from the base address) and bits for the various read registers
00053  * of the drive.
00054 
00055 
00056 */
00057 #define SONY_STATUS_REG_OFFSET  0
00058 #       define SONY_ATTN_BIT            0x01
00059 #       define SONY_RES_RDY_BIT         0x02
00060 #       define SONY_DATA_RDY_BIT        0x04
00061 #       define SONY_ATTN_INT_ST_BIT     0x08
00062 #       define SONY_RES_RDY_INT_ST_BIT  0x10
00063 #       define SONY_DATA_RDY_INT_ST_BIT 0x20
00064 #       define SONY_DATA_REQUEST_BIT    0x40
00065 #       define SONY_BUSY_BIT            0x80
00066 #define SONY_RESULT_REG_OFFSET  1
00067 #define SONY_READ_REG_OFFSET    2
00068 #define SONY_FIFOST_REG_OFFSET  3
00069 #       define SONY_PARAM_WRITE_RDY_BIT 0x01
00070 #       define SONY_PARAM_REG_EMPTY_BIT 0x02
00071 #       define SONY_RES_REG_NOT_EMP_BIT 0x04
00072 #       define SONY_RES_REG_FULL_BIT    0x08
00073 
00074 #define LOG_START_OFFSET        150     ///< Offset of first logical sector 
00075 
00076 #define SONY_DETECT_TIMEOUT     80      /* Maximum amount of time
00077                                            that drive detection code
00078                                            will wait for response
00079                                            from drive (in 1/100th's
00080 
00081 
00082 */
00083  
00084 #define SONY_JIFFIES_TIMEOUT    500     /* Maximum number of times the
00085                                            drive will wait/try for an
00086 
00087 
00088 */
00089 #define SONY_RESET_TIMEOUT      100     /* Maximum number of times the
00090                                            drive will wait/try a reset
00091 
00092 
00093 */
00094 #define SONY_READY_RETRIES      20000   /* How many times to retry a
00095                                            spin waiting for a register
00096 
00097 
00098 */
00099 
00100 #define MAX_CDU31A_RETRIES      3       /* How many times to retry an
00101 
00102 
00103 */
00104 
00105 /// Commands to request or set drive control parameters and disc information 
00106 #define SONY_REQ_DRIVE_CONFIG_CMD       0x00    ///< Returns s_sony_drive_config 
00107 #define SONY_REQ_DRIVE_MODE_CMD         0x01
00108 #define SONY_REQ_DRIVE_PARAM_CMD        0x02
00109 #define SONY_REQ_MECH_STATUS_CMD        0x03
00110 #define SONY_REQ_AUDIO_STATUS_CMD       0x04
00111 #define SONY_SET_DRIVE_PARAM_CMD        0x10
00112 #define SONY_REQ_TOC_DATA_CMD           0x20    ///< Returns s_sony_toc 
00113 #define SONY_REQ_SUBCODE_ADDRESS_CMD    0x21    ///< Returns s_sony_subcode 
00114 #define SONY_REQ_UPC_EAN_CMD            0x22
00115 #define SONY_REQ_ISRC_CMD               0x23
00116 #define SONY_REQ_TOC_DATA_SPEC_CMD      0x24
00117 
00118 /// Commands to request information from the drive 
00119 #define SONY_READ_TOC_CMD               0x30
00120 #define SONY_SEEK_CMD                   0x31
00121 #define SONY_READ_CMD                   0x32
00122 #define SONY_READ_BLKERR_STAT_CMD       0x34
00123 #define SONY_ABORT_CMD                  0x35
00124 #define SONY_READ_TOC_SPEC_CMD          0x36
00125 
00126 /// Commands to control audio 
00127 #define SONY_AUDIO_PLAYBACK_CMD         0x40
00128 #define SONY_AUDIO_STOP_CMD             0x41
00129 #define SONY_AUDIO_SCAN_CMD             0x42
00130 
00131 /// Miscellaneous control commands 
00132 #define SONY_EJECT_CMD                  0x50
00133 #define SONY_SPIN_UP_CMD                0x51
00134 #define SONY_SPIN_DOWN_CMD              0x52
00135 
00136 /// Diagnostic commands 
00137 #define SONY_WRITE_BUFFER_CMD           0x60
00138 #define SONY_READ_BUFFER_CMD            0x61
00139 #define SONY_DIAGNOSTICS_CMD            0x62
00140 
00141 
00142 /**
00143 *
00144 
00145  * The following are command paramters for the set drive parameter command
00146 
00147 
00148 */
00149 #define SONY_SD_DECODE_PARAM            0x00
00150 #define SONY_SD_INTERFACE_PARAM         0x01
00151 #define SONY_SD_BUFFERING_PARAM         0x02
00152 #define SONY_SD_AUDIO_PARAM             0x03
00153 #define SONY_SD_AUDIO_VOLUME            0x04
00154 #define SONY_SD_MECH_CONTROL            0x05
00155 #define SONY_SD_AUTO_SPIN_DOWN_TIME     0x06
00156 
00157 /**
00158 *
00159 
00160  * The following extract information from the drive configuration about
00161  * the drive itself.
00162 
00163 
00164 */
00165 #define SONY_HWC_GET_LOAD_MECH(c)       (c.hw_config[0] & 0x03)
00166 #define SONY_HWC_EJECT(c)               (c.hw_config[0] & 0x04)
00167 #define SONY_HWC_LED_SUPPORT(c)         (c.hw_config[0] & 0x08)
00168 #define SONY_HWC_GET_BUF_MEM_SIZE(c)    ((c.hw_config[0] & 0xc0) >> 6)
00169 #define SONY_HWC_AUDIO_PLAYBACK(c)      (c.hw_config[1] & 0x01)
00170 #define SONY_HWC_ELECTRIC_VOLUME(c)     (c.hw_config[1] & 0x02)
00171 #define SONY_HWC_ELECTRIC_VOLUME_CTL(c) (c.hw_config[1] & 0x04)
00172 
00173 #define SONY_HWC_CADDY_LOAD_MECH        0x00
00174 #define SONY_HWC_TRAY_LOAD_MECH         0x01
00175 #define SONY_HWC_POPUP_LOAD_MECH        0x02
00176 #define SONY_HWC_UNKWN_LOAD_MECH        0x03
00177 
00178 #define SONY_HWC_8KB_BUFFER             0x00
00179 #define SONY_HWC_32KB_BUFFER            0x01
00180 #define SONY_HWC_64KB_BUFFER            0x02
00181 #define SONY_HWC_UNKWN_BUFFER           0x03
00182 
00183 /**
00184 *
00185 
00186  * This is the complete status returned from the drive configuration request
00187  * command.
00188 
00189 
00190 */
00191 struct s_sony_drive_config
00192 {
00193    unsigned char exec_status[2];
00194    char vendor_id[8];
00195    char product_id[16];
00196    char product_rev_level[8];
00197    unsigned char hw_config[2];
00198 };
00199 
00200 /// The following is returned from the request subcode address command 
00201 struct s_sony_subcode
00202 {
00203    unsigned char exec_status[2];
00204    unsigned char address        :4;
00205    unsigned char control        :4;
00206    unsigned char track_num;
00207    unsigned char index_num;
00208    unsigned char rel_msf[3];
00209    unsigned char reserved1;
00210    unsigned char abs_msf[3];
00211 };
00212 
00213 /**
00214 *
00215 
00216  * The following is returned from the request TOC (Table Of Contents) command.
00217  * (last_track_num-first_track_num+1) values are valid in tracks.
00218 
00219 
00220 */
00221 struct s_sony_toc
00222 {
00223    unsigned char exec_status[2];
00224    unsigned char address0       :4;
00225    unsigned char control0       :4;
00226    unsigned char point0;
00227    unsigned char first_track_num;
00228    unsigned char disk_type;
00229    unsigned char dummy0;
00230    unsigned char address1       :4;
00231    unsigned char control1       :4;
00232    unsigned char point1;
00233    unsigned char last_track_num;
00234    unsigned char dummy1;
00235    unsigned char dummy2;
00236    unsigned char address2       :4;
00237    unsigned char control2       :4;
00238    unsigned char point2;
00239    unsigned char lead_out_start_msf[3];
00240    struct
00241    {
00242       unsigned char address     :4;
00243       unsigned char control     :4;
00244       unsigned char track;
00245       unsigned char track_start_msf[3];
00246    } tracks[100];
00247 
00248    unsigned int lead_out_start_lba;
00249 };
00250 
00251 
00252 /**
00253 *
00254 
00255  * The following are errors returned from the drive.
00256 
00257 
00258 */
00259 
00260 /// Command error group 
00261 #define SONY_ILL_CMD_ERR                0x10
00262 #define SONY_ILL_PARAM_ERR              0x11
00263 
00264 /// Mechanism group 
00265 #define SONY_NOT_LOAD_ERR               0x20
00266 #define SONY_NO_DISK_ERR                0x21
00267 #define SONY_NOT_SPIN_ERR               0x22
00268 #define SONY_SPIN_ERR                   0x23
00269 #define SONY_SPINDLE_SERVO_ERR          0x25
00270 #define SONY_FOCUS_SERVO_ERR            0x26
00271 #define SONY_EJECT_MECH_ERR             0x29
00272 #define SONY_AUDIO_PLAYING_ERR          0x2a
00273 #define SONY_EMERGENCY_EJECT_ERR        0x2c
00274 
00275 /// Seek error group 
00276 #define SONY_FOCUS_ERR                  0x30
00277 #define SONY_FRAME_SYNC_ERR             0x31
00278 #define SONY_SUBCODE_ADDR_ERR           0x32
00279 #define SONY_BLOCK_SYNC_ERR             0x33
00280 #define SONY_HEADER_ADDR_ERR            0x34
00281 
00282 /// Read error group 
00283 #define SONY_ILL_TRACK_R_ERR            0x40
00284 #define SONY_MODE_0_R_ERR               0x41
00285 #define SONY_ILL_MODE_R_ERR             0x42
00286 #define SONY_ILL_BLOCK_SIZE_R_ERR       0x43
00287 #define SONY_MODE_R_ERR                 0x44
00288 #define SONY_FORM_R_ERR                 0x45
00289 #define SONY_LEAD_OUT_R_ERR             0x46
00290 #define SONY_BUFFER_OVERRUN_R_ERR       0x47
00291 
00292 /// Data error group 
00293 #define SONY_UNREC_CIRC_ERR             0x53
00294 #define SONY_UNREC_LECC_ERR             0x57
00295 
00296 /// Subcode error group 
00297 #define SONY_NO_TOC_ERR                 0x60
00298 #define SONY_SUBCODE_DATA_NVAL_ERR      0x61
00299 #define SONY_FOCUS_ON_TOC_READ_ERR      0x63
00300 #define SONY_FRAME_SYNC_ON_TOC_READ_ERR 0x64
00301 #define SONY_TOC_DATA_ERR               0x65
00302 
00303 /// Hardware failure group 
00304 #define SONY_HW_FAILURE_ERR             0x70
00305 #define SONY_LEAD_IN_A_ERR              0x91
00306 #define SONY_LEAD_OUT_A_ERR             0x92
00307 #define SONY_DATA_TRACK_A_ERR           0x93
00308 
00309 /**
00310 *
00311 
00312  * The following are returned from the Read With Block Error Status command.
00313  * They are not errors but information (Errors from the 0x5x group above may
00314  * also be returned
00315 
00316 
00317 */
00318 #define SONY_NO_CIRC_ERR_BLK_STAT       0x50
00319 #define SONY_NO_LECC_ERR_BLK_STAT       0x54
00320 #define SONY_RECOV_LECC_ERR_BLK_STAT    0x55
00321 #define SONY_NO_ERR_DETECTION_STAT      0x59
00322 
00323 /**
00324 *
00325  
00326  * The following is not an error returned by the drive, but by the code
00327  * that talks to the drive.  It is returned because of a timeout.
00328 
00329 
00330 */
00331 #define SONY_TIMEOUT_OP_ERR             0x01
00332 #define SONY_SIGNAL_OP_ERR              0x02
00333 
00334 
00335 /**
00336 *
00337 
00338  * The following are attention code for asyncronous events from the drive.
00339 
00340 
00341 */
00342 
00343 /// Standard attention group 
00344 #define SONY_EMER_EJECT_ATTN            0x2c
00345 #define SONY_HW_FAILURE_ATTN            0x70
00346 #define SONY_MECH_LOADED_ATTN           0x80
00347 #define SONY_EJECT_PUSHED_ATTN          0x81
00348 
00349 /// Audio attention group 
00350 #define SONY_AUDIO_PLAY_DONE_ATTN       0x90
00351 #define SONY_LEAD_IN_ERR_ATTN           0x91
00352 #define SONY_LEAD_OUT_ERR_ATTN          0x92
00353 #define SONY_DATA_TRACK_ERR_ATTN        0x93
00354 #define SONY_AUDIO_PLAYBACK_ERR_ATTN    0x94
00355 
00356 /// Auto spin up group 
00357 #define SONY_SPIN_UP_COMPLETE_ATTN      0x24
00358 #define SONY_SPINDLE_SERVO_ERR_ATTN     0x25
00359 #define SONY_FOCUS_SERVO_ERR_ATTN       0x26
00360 #define SONY_TOC_READ_DONE_ATTN         0x62
00361 #define SONY_FOCUS_ON_TOC_READ_ERR_ATTN 0x63
00362 #define SONY_SYNC_ON_TOC_READ_ERR_ATTN  0x65
00363 
00364 /// Auto eject group 
00365 #define SONY_SPIN_DOWN_COMPLETE_ATTN    0x27
00366 #define SONY_EJECT_COMPLETE_ATTN        0x28
00367 #define SONY_EJECT_MECH_ERR_ATTN        0x29

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