root/include/linux/cdu31a.h

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

INCLUDED FROM


   1 /*
   2  * Definitions for a Sony interface CDROM drive.
   3  *
   4  * Corey Minyard (minyard@wf-rch.cirr.com)
   5  *
   6  *  Copyright (C) 1993  Corey Minyard
   7  *
   8  *  This program is free software; you can redistribute it and/or modify
   9  *  it under the terms of the GNU General Public License as published by
  10  *  the Free Software Foundation; either version 2 of the License, or
  11  *  (at your option) any later version.
  12  *
  13  *  This program is distributed in the hope that it will be useful,
  14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  *  GNU General Public License for more details.
  17  *
  18  *  You should have received a copy of the GNU General Public License
  19  *  along with this program; if not, write to the Free Software
  20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21  *
  22  */
  23 
  24 /*
  25  * Offsets (from the base address) and bits for the various write registers
  26  * of the drive.
  27  */
  28 #define SONY_CMD_REG_OFFSET     0
  29 #define SONY_PARAM_REG_OFFSET   1
  30 #define SONY_WRITE_REG_OFFSET   2
  31 #define SONY_CONTROL_REG_OFFSET 3
  32 #       define SONY_ATTN_CLR_BIT        0x01
  33 #       define SONY_RES_RDY_CLR_BIT     0x02
  34 #       define SONY_DATA_RDY_CLR_BIT    0x04
  35 #       define SONY_ATTN_INT_EN_BIT     0x08
  36 #       define SONY_RES_RDY_INT_EN_BIT  0x10
  37 #       define SONY_DATA_RDY_INT_EN_BIT 0x20
  38 #       define SONY_PARAM_CLR_BIT       0x40
  39 #       define SONY_DRIVE_RESET_BIT     0x80
  40 
  41 /*
  42  * Offsets (from the base address) and bits for the various read registers
  43  * of the drive.
  44  */
  45 #define SONY_STATUS_REG_OFFSET  0
  46 #       define SONY_ATTN_BIT            0x01
  47 #       define SONY_RES_RDY_BIT         0x02
  48 #       define SONY_DATA_RDY_BIT        0x04
  49 #       define SONY_ATTN_INT_ST_BIT     0x08
  50 #       define SONY_RES_RDY_INT_ST_BIT  0x10
  51 #       define SONY_DATA_RDY_INT_ST_BIT 0x20
  52 #       define SONY_DATA_REQUEST_BIT    0x40
  53 #       define SONY_BUSY_BIT            0x80
  54 #define SONY_RESULT_REG_OFFSET  1
  55 #define SONY_READ_REG_OFFSET    2
  56 #define SONY_FIFOST_REG_OFFSET  3
  57 #       define SONY_PARAM_WRITE_RDY_BIT 0x01
  58 #       define SONY_PARAM_REG_EMPTY_BIT 0x02
  59 #       define SONY_RES_REG_NOT_EMP_BIT 0x04
  60 #       define SONY_RES_REG_FULL_BIT    0x08
  61 
  62 #define LOG_START_OFFSET        150     /* Offset of first logical sector */
  63 
  64 #define SONY_DETECT_TIMEOUT     80      /* Maximum amount of time
  65                                            that drive detection code
  66                                            will wait for response
  67                                            from drive (in 1/100th's
  68                                            of seconds). */
  69  
  70 #define SONY_JIFFIES_TIMEOUT    500     /* Maximum number of times the
  71                                            drive will wait/try for an
  72                                            operation */
  73 #define SONY_RESET_TIMEOUT      100     /* Maximum number of times the
  74                                            drive will wait/try a reset
  75                                            operation */
  76 #define SONY_READY_RETRIES      20000   /* How many times to retry a
  77                                            spin waiting for a register
  78                                            to come ready */
  79 
  80 #define MAX_CDU31A_RETRIES      3       /* How many times to retry an
  81                                            operation */
  82 
  83 /* Commands to request or set drive control parameters and disc information */
  84 #define SONY_REQ_DRIVE_CONFIG_CMD       0x00    /* Returns s_sony_drive_config */
  85 #define SONY_REQ_DRIVE_MODE_CMD         0x01
  86 #define SONY_REQ_DRIVE_PARAM_CMD        0x02
  87 #define SONY_REQ_MECH_STATUS_CMD        0x03
  88 #define SONY_REQ_AUDIO_STATUS_CMD       0x04
  89 #define SONY_SET_DRIVE_PARAM_CMD        0x10
  90 #define SONY_REQ_TOC_DATA_CMD           0x20    /* Returns s_sony_toc */
  91 #define SONY_REQ_SUBCODE_ADDRESS_CMD    0x21    /* Returns s_sony_subcode */
  92 #define SONY_REQ_UPC_EAN_CMD            0x22
  93 #define SONY_REQ_ISRC_CMD               0x23
  94 #define SONY_REQ_TOC_DATA_SPEC_CMD      0x24
  95 
  96 /* Commands to request information from the drive */
  97 #define SONY_READ_TOC_CMD               0x30
  98 #define SONY_SEEK_CMD                   0x31
  99 #define SONY_READ_CMD                   0x32
 100 #define SONY_READ_BLKERR_STAT_CMD       0x34
 101 #define SONY_ABORT_CMD                  0x35
 102 #define SONY_READ_TOC_SPEC_CMD          0x36
 103 
 104 /* Commands to control audio */
 105 #define SONY_AUDIO_PLAYBACK_CMD         0x40
 106 #define SONY_AUDIO_STOP_CMD             0x41
 107 #define SONY_AUDIO_SCAN_CMD             0x42
 108 
 109 /* Miscellaneous control commands */
 110 #define SONY_EJECT_CMD                  0x50
 111 #define SONY_SPIN_UP_CMD                0x51
 112 #define SONY_SPIN_DOWN_CMD              0x52
 113 
 114 /* Diagnostic commands */
 115 #define SONY_WRITE_BUFFER_CMD           0x60
 116 #define SONY_READ_BUFFER_CMD            0x61
 117 #define SONY_DIAGNOSTICS_CMD            0x62
 118 
 119 
 120 /*
 121  * The following are command paramters for the set drive parameter command
 122  */
 123 #define SONY_SD_DECODE_PARAM            0x00
 124 #define SONY_SD_INTERFACE_PARAM         0x01
 125 #define SONY_SD_BUFFERING_PARAM         0x02
 126 #define SONY_SD_AUDIO_PARAM             0x03
 127 #define SONY_SD_AUDIO_VOLUME            0x04
 128 #define SONY_SD_MECH_CONTROL            0x05
 129 #define SONY_SD_AUTO_SPIN_DOWN_TIME     0x06
 130 
 131 /*
 132  * The following extract information from the drive configuration about
 133  * the drive itself.
 134  */
 135 #define SONY_HWC_GET_LOAD_MECH(c)       (c.hw_config[0] & 0x03)
 136 #define SONY_HWC_EJECT(c)               (c.hw_config[0] & 0x04)
 137 #define SONY_HWC_LED_SUPPORT(c)         (c.hw_config[0] & 0x08)
 138 #define SONY_HWC_DOUBLE_SPEED(c)        (c.hw_config[0] & 0x10)
 139 #define SONY_HWC_GET_BUF_MEM_SIZE(c)    ((c.hw_config[0] & 0xc0) >> 6)
 140 #define SONY_HWC_AUDIO_PLAYBACK(c)      (c.hw_config[1] & 0x01)
 141 #define SONY_HWC_ELECTRIC_VOLUME(c)     (c.hw_config[1] & 0x02)
 142 #define SONY_HWC_ELECTRIC_VOLUME_CTL(c) (c.hw_config[1] & 0x04)
 143 
 144 #define SONY_HWC_CADDY_LOAD_MECH        0x00
 145 #define SONY_HWC_TRAY_LOAD_MECH         0x01
 146 #define SONY_HWC_POPUP_LOAD_MECH        0x02
 147 #define SONY_HWC_UNKWN_LOAD_MECH        0x03
 148 
 149 #define SONY_HWC_8KB_BUFFER             0x00
 150 #define SONY_HWC_32KB_BUFFER            0x01
 151 #define SONY_HWC_64KB_BUFFER            0x02
 152 #define SONY_HWC_UNKWN_BUFFER           0x03
 153 
 154 /*
 155  * This is the complete status returned from the drive configuration request
 156  * command.
 157  */
 158 struct s_sony_drive_config
 159 {
 160    unsigned char exec_status[2];
 161    char vendor_id[8];
 162    char product_id[16];
 163    char product_rev_level[8];
 164    unsigned char hw_config[2];
 165 };
 166 
 167 /* The following is returned from the request subcode address command */
 168 struct s_sony_subcode
 169 {
 170    unsigned char exec_status[2];
 171    unsigned char address        :4;
 172    unsigned char control        :4;
 173    unsigned char track_num;
 174    unsigned char index_num;
 175    unsigned char rel_msf[3];
 176    unsigned char reserved1;
 177    unsigned char abs_msf[3];
 178 };
 179 
 180 /*
 181  * The following is returned from the request TOC (Table Of Contents) command.
 182  * (last_track_num-first_track_num+1) values are valid in tracks.
 183  */
 184 struct s_sony_toc
 185 {
 186    unsigned char exec_status[2];
 187    unsigned char address0       :4;
 188    unsigned char control0       :4;
 189    unsigned char point0;
 190    unsigned char first_track_num;
 191    unsigned char disk_type;
 192    unsigned char dummy0;
 193    unsigned char address1       :4;
 194    unsigned char control1       :4;
 195    unsigned char point1;
 196    unsigned char last_track_num;
 197    unsigned char dummy1;
 198    unsigned char dummy2;
 199    unsigned char address2       :4;
 200    unsigned char control2       :4;
 201    unsigned char point2;
 202    unsigned char lead_out_start_msf[3];
 203    struct
 204    {
 205       unsigned char address     :4;
 206       unsigned char control     :4;
 207       unsigned char track;
 208       unsigned char track_start_msf[3];
 209    } tracks[100];
 210 
 211    unsigned int lead_out_start_lba;
 212 };
 213 
 214 
 215 /*
 216  * The following are errors returned from the drive.
 217  */
 218 
 219 /* Command error group */
 220 #define SONY_ILL_CMD_ERR                0x10
 221 #define SONY_ILL_PARAM_ERR              0x11
 222 
 223 /* Mechanism group */
 224 #define SONY_NOT_LOAD_ERR               0x20
 225 #define SONY_NO_DISK_ERR                0x21
 226 #define SONY_NOT_SPIN_ERR               0x22
 227 #define SONY_SPIN_ERR                   0x23
 228 #define SONY_SPINDLE_SERVO_ERR          0x25
 229 #define SONY_FOCUS_SERVO_ERR            0x26
 230 #define SONY_EJECT_MECH_ERR             0x29
 231 #define SONY_AUDIO_PLAYING_ERR          0x2a
 232 #define SONY_EMERGENCY_EJECT_ERR        0x2c
 233 
 234 /* Seek error group */
 235 #define SONY_FOCUS_ERR                  0x30
 236 #define SONY_FRAME_SYNC_ERR             0x31
 237 #define SONY_SUBCODE_ADDR_ERR           0x32
 238 #define SONY_BLOCK_SYNC_ERR             0x33
 239 #define SONY_HEADER_ADDR_ERR            0x34
 240 
 241 /* Read error group */
 242 #define SONY_ILL_TRACK_R_ERR            0x40
 243 #define SONY_MODE_0_R_ERR               0x41
 244 #define SONY_ILL_MODE_R_ERR             0x42
 245 #define SONY_ILL_BLOCK_SIZE_R_ERR       0x43
 246 #define SONY_MODE_R_ERR                 0x44
 247 #define SONY_FORM_R_ERR                 0x45
 248 #define SONY_LEAD_OUT_R_ERR             0x46
 249 #define SONY_BUFFER_OVERRUN_R_ERR       0x47
 250 
 251 /* Data error group */
 252 #define SONY_UNREC_CIRC_ERR             0x53
 253 #define SONY_UNREC_LECC_ERR             0x57
 254 
 255 /* Subcode error group */
 256 #define SONY_NO_TOC_ERR                 0x60
 257 #define SONY_SUBCODE_DATA_NVAL_ERR      0x61
 258 #define SONY_FOCUS_ON_TOC_READ_ERR      0x63
 259 #define SONY_FRAME_SYNC_ON_TOC_READ_ERR 0x64
 260 #define SONY_TOC_DATA_ERR               0x65
 261 
 262 /* Hardware failure group */
 263 #define SONY_HW_FAILURE_ERR             0x70
 264 #define SONY_LEAD_IN_A_ERR              0x91
 265 #define SONY_LEAD_OUT_A_ERR             0x92
 266 #define SONY_DATA_TRACK_A_ERR           0x93
 267 
 268 /*
 269  * The following are returned from the Read With Block Error Status command.
 270  * They are not errors but information (Errors from the 0x5x group above may
 271  * also be returned
 272  */
 273 #define SONY_NO_CIRC_ERR_BLK_STAT       0x50
 274 #define SONY_NO_LECC_ERR_BLK_STAT       0x54
 275 #define SONY_RECOV_LECC_ERR_BLK_STAT    0x55
 276 #define SONY_NO_ERR_DETECTION_STAT      0x59
 277 
 278 /* 
 279  * The following is not an error returned by the drive, but by the code
 280  * that talks to the drive.  It is returned because of a timeout.
 281  */
 282 #define SONY_TIMEOUT_OP_ERR             0x01
 283 #define SONY_SIGNAL_OP_ERR              0x02
 284 
 285 
 286 /*
 287  * The following are attention code for asyncronous events from the drive.
 288  */
 289 
 290 /* Standard attention group */
 291 #define SONY_EMER_EJECT_ATTN            0x2c
 292 #define SONY_HW_FAILURE_ATTN            0x70
 293 #define SONY_MECH_LOADED_ATTN           0x80
 294 #define SONY_EJECT_PUSHED_ATTN          0x81
 295 
 296 /* Audio attention group */
 297 #define SONY_AUDIO_PLAY_DONE_ATTN       0x90
 298 #define SONY_LEAD_IN_ERR_ATTN           0x91
 299 #define SONY_LEAD_OUT_ERR_ATTN          0x92
 300 #define SONY_DATA_TRACK_ERR_ATTN        0x93
 301 #define SONY_AUDIO_PLAYBACK_ERR_ATTN    0x94
 302 
 303 /* Auto spin up group */
 304 #define SONY_SPIN_UP_COMPLETE_ATTN      0x24
 305 #define SONY_SPINDLE_SERVO_ERR_ATTN     0x25
 306 #define SONY_FOCUS_SERVO_ERR_ATTN       0x26
 307 #define SONY_TOC_READ_DONE_ATTN         0x62
 308 #define SONY_FOCUS_ON_TOC_READ_ERR_ATTN 0x63
 309 #define SONY_SYNC_ON_TOC_READ_ERR_ATTN  0x65
 310 
 311 /* Auto eject group */
 312 #define SONY_SPIN_DOWN_COMPLETE_ATTN    0x27
 313 #define SONY_EJECT_COMPLETE_ATTN        0x28
 314 #define SONY_EJECT_MECH_ERR_ATTN        0x29

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