Linux 2.6.19-rc1
[linux-2.6/next.git] / drivers / cdrom / sonycd535.h
blob5dea1ef168d61b19b1894d84c2c59a3c6ef0534f
1 #ifndef SONYCD535_H
2 #define SONYCD535_H
4 /*
5 * define all the commands recognized by the CDU-531/5
6 */
7 #define SONY535_REQUEST_DRIVE_STATUS_1 (0x80)
8 #define SONY535_REQUEST_SENSE (0x82)
9 #define SONY535_REQUEST_DRIVE_STATUS_2 (0x84)
10 #define SONY535_REQUEST_ERROR_STATUS (0x86)
11 #define SONY535_REQUEST_AUDIO_STATUS (0x88)
12 #define SONY535_INQUIRY (0x8a)
14 #define SONY535_SET_INACTIVITY_TIME (0x90)
16 #define SONY535_SEEK_AND_READ_N_BLOCKS_1 (0xa0)
17 #define SONY535_SEEK_AND_READ_N_BLOCKS_2 (0xa4)
18 #define SONY535_PLAY_AUDIO (0xa6)
20 #define SONY535_REQUEST_DISC_CAPACITY (0xb0)
21 #define SONY535_REQUEST_TOC_DATA (0xb2)
22 #define SONY535_REQUEST_SUB_Q_DATA (0xb4)
23 #define SONY535_REQUEST_ISRC (0xb6)
24 #define SONY535_REQUEST_UPC_EAN (0xb8)
26 #define SONY535_SET_DRIVE_MODE (0xc0)
27 #define SONY535_REQUEST_DRIVE_MODE (0xc2)
28 #define SONY535_SET_RETRY_COUNT (0xc4)
30 #define SONY535_DIAGNOSTIC_1 (0xc6)
31 #define SONY535_DIAGNOSTIC_4 (0xcc)
32 #define SONY535_DIAGNOSTIC_5 (0xce)
34 #define SONY535_EJECT_CADDY (0xd0)
35 #define SONY535_DISABLE_EJECT_BUTTON (0xd2)
36 #define SONY535_ENABLE_EJECT_BUTTON (0xd4)
38 #define SONY535_HOLD (0xe0)
39 #define SONY535_AUDIO_PAUSE_ON_OFF (0xe2)
40 #define SONY535_SET_VOLUME (0xe8)
42 #define SONY535_STOP (0xf0)
43 #define SONY535_SPIN_UP (0xf2)
44 #define SONY535_SPIN_DOWN (0xf4)
46 #define SONY535_CLEAR_PARAMETERS (0xf6)
47 #define SONY535_CLEAR_ENDING_ADDRESS (0xf8)
50 * define some masks
52 #define SONY535_DATA_NOT_READY_BIT (0x1)
53 #define SONY535_RESULT_NOT_READY_BIT (0x2)
56 * drive status 1
58 #define SONY535_STATUS1_COMMAND_ERROR (0x1)
59 #define SONY535_STATUS1_DATA_ERROR (0x2)
60 #define SONY535_STATUS1_SEEK_ERROR (0x4)
61 #define SONY535_STATUS1_DISC_TYPE_ERROR (0x8)
62 #define SONY535_STATUS1_NOT_SPINNING (0x10)
63 #define SONY535_STATUS1_EJECT_BUTTON_PRESSED (0x20)
64 #define SONY535_STATUS1_CADDY_NOT_INSERTED (0x40)
65 #define SONY535_STATUS1_BYTE_TWO_FOLLOWS (0x80)
68 * drive status 2
70 #define SONY535_CDD_LOADING_ERROR (0x7)
71 #define SONY535_CDD_NO_DISC (0x8)
72 #define SONY535_CDD_UNLOADING_ERROR (0x9)
73 #define SONY535_CDD_CADDY_NOT_INSERTED (0xd)
74 #define SONY535_ATN_RESET_OCCURRED (0x2)
75 #define SONY535_ATN_DISC_CHANGED (0x4)
76 #define SONY535_ATN_RESET_AND_DISC_CHANGED (0x6)
77 #define SONY535_ATN_EJECT_IN_PROGRESS (0xe)
78 #define SONY535_ATN_BUSY (0xf)
81 * define some parameters
83 #define SONY535_AUDIO_DRIVE_MODE (0)
84 #define SONY535_CDROM_DRIVE_MODE (0xe0)
86 #define SONY535_PLAY_OP_PLAYBACK (0)
87 #define SONY535_PLAY_OP_ENTER_HOLD (1)
88 #define SONY535_PLAY_OP_SET_AUDIO_ENDING_ADDR (2)
89 #define SONY535_PLAY_OP_SCAN_FORWARD (3)
90 #define SONY535_PLAY_OP_SCAN_BACKWARD (4)
93 * convert from msf format to block number
95 #define SONY_BLOCK_NUMBER(m,s,f) (((m)*60L+(s))*75L+(f))
96 #define SONY_BLOCK_NUMBER_MSF(x) (((x)[0]*60L+(x)[1])*75L+(x)[2])
99 * error return values from the doSonyCmd() routines
101 #define TIME_OUT (-1)
102 #define NO_CDROM (-2)
103 #define BAD_STATUS (-3)
104 #define CD_BUSY (-4)
105 #define NOT_DATA_CD (-5)
106 #define NO_ROOM (-6)
108 #define LOG_START_OFFSET 150 /* Offset of first logical sector */
110 #define SONY_JIFFIES_TIMEOUT (5*HZ) /* Maximum time
111 the drive will wait/try for an
112 operation */
113 #define SONY_READY_RETRIES (50000) /* How many times to retry a
114 spin waiting for a register
115 to come ready */
116 #define SONY535_FAST_POLLS (10000) /* how many times recheck
117 status waiting for a data
118 to become ready */
120 typedef unsigned char Byte;
123 * This is the complete status returned from the drive configuration request
124 * command.
126 struct s535_sony_drive_config
128 char vendor_id[8];
129 char product_id[16];
130 char product_rev_level[4];
133 /* The following is returned from the request sub-q data command */
134 struct s535_sony_subcode
136 unsigned char address :4;
137 unsigned char control :4;
138 unsigned char track_num;
139 unsigned char index_num;
140 unsigned char rel_msf[3];
141 unsigned char abs_msf[3];
144 struct s535_sony_disc_capacity
146 Byte mFirstTrack, sFirstTrack, fFirstTrack;
147 Byte mLeadOut, sLeadOut, fLeadOut;
151 * The following is returned from the request TOC (Table Of Contents) command.
152 * (last_track_num-first_track_num+1) values are valid in tracks.
154 struct s535_sony_toc
156 unsigned char reserved0 :4;
157 unsigned char control0 :4;
158 unsigned char point0;
159 unsigned char first_track_num;
160 unsigned char reserved0a;
161 unsigned char reserved0b;
162 unsigned char reserved1 :4;
163 unsigned char control1 :4;
164 unsigned char point1;
165 unsigned char last_track_num;
166 unsigned char dummy1;
167 unsigned char dummy2;
168 unsigned char reserved2 :4;
169 unsigned char control2 :4;
170 unsigned char point2;
171 unsigned char lead_out_start_msf[3];
172 struct
174 unsigned char reserved :4;
175 unsigned char control :4;
176 unsigned char track;
177 unsigned char track_start_msf[3];
178 } tracks[100];
180 unsigned int lead_out_start_lba;
183 #endif /* SONYCD535_H */