1 /* $NetBSD: scsipi_cd.h,v 1.17 2006/12/01 21:36:56 martin Exp $ */
2
3 /*
4 * Written by Julian Elischer (julian@tfs.com)
5 * for TRW Financial Systems.
6 *
7 * TRW Financial Systems, in accordance with their agreement with Carnegie
8 * Mellon University, makes this software available to CMU to distribute
9 * or use in any manner that they see fit as long as this message is kept with
10 * the software. For this reason TFS also grants any other persons or
11 * organisations permission to use or modify this software.
12 *
13 * TFS supplies this software to be publicly redistributed
14 * on the understanding that TFS is not responsible for the correct
15 * functioning of this software in any circumstances.
16 *
17 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
18 */
19
20 /*
21 * Define two bits always in the same place in byte 2 (flag byte)
22 */
23 #define CD_RELADDR 0x01
24 #define CD_MSF 0x02
25
26 /*
27 * SCSI and SCSI-like command format
28 */
29
30 #define LOAD_UNLOAD 0xa6
31 struct scsipi_load_unload {
32 u_int8_t opcode;
33 u_int8_t unused1[3];
34 u_int8_t options;
35 u_int8_t unused2[3];
36 u_int8_t slot;
37 u_int8_t unused3[3];
38 } __attribute__((__packed__));
39
40 #define PAUSE 0x4b /* cdrom pause in 'play audio' mode */
41 struct scsipi_pause {
42 u_int8_t opcode;
43 u_int8_t byte2;
44 u_int8_t unused[6];
45 u_int8_t resume;
46 u_int8_t control;
47 } __attribute__((__packed__));
48 #define PA_PAUSE 0x00
49 #define PA_RESUME 0x01
50
51 #define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */
52 struct scsipi_play_msf {
53 u_int8_t opcode;
54 u_int8_t byte2;
55 u_int8_t unused;
56 u_int8_t start_m;
57 u_int8_t start_s;
58 u_int8_t start_f;
59 u_int8_t end_m;
60 u_int8_t end_s;
61 u_int8_t end_f;
62 u_int8_t control;
63 } __attribute__((__packed__));
64
65 #define PLAY 0x45 /* cdrom play 'play audio' mode */
66 struct scsipi_play {
67 u_int8_t opcode;
68 u_int8_t byte2;
69 u_int8_t blk_addr[4];
70 u_int8_t unused;
71 u_int8_t xfer_len[2];
72 u_int8_t control;
73 } __attribute__((__packed__));
74
75 #define READ_HEADER 0x44 /* cdrom read header */
76 struct scsipi_read_header {
77 u_int8_t opcode;
78 u_int8_t byte2;
79 u_int8_t blk_addr[4];
80 u_int8_t unused;
81 u_int8_t data_len[2];
82 u_int8_t control;
83 } __attribute__((__packed__));
84
85 #define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */
86 struct scsipi_read_subchannel {
87 u_int8_t opcode;
88 u_int8_t byte2;
89 u_int8_t byte3;
90 #define SRS_SUBQ 0x40
91 u_int8_t subchan_format;
92 u_int8_t unused[2];
93 u_int8_t track;
94 u_int8_t data_len[2];
95 u_int8_t control;
96 } __attribute__((__packed__));
97
98 #define READ_TOC 0x43 /* cdrom read TOC */
99 struct scsipi_read_toc {
100 u_int8_t opcode;
101 u_int8_t addr_mode;
102 u_int8_t resp_format;
103 u_int8_t unused[3];
104 u_int8_t from_track; /* session nr in format 2 */
105 u_int8_t data_len[2];
106 u_int8_t control;
107 } __attribute__((__packed__));
108
109 struct scsipi_toc_header {
110 uint8_t length[2];
111 uint8_t first; /* track or session */
112 uint8_t last;
113 } __attribute__((__packed__));
114
115 /* read TOC form 0 result entries */
116 struct scsipi_toc_formatted {
117 uint8_t unused1;
118 uint8_t adrcontol;
119 uint8_t tracknr;
120 uint8_t unused2;
121 uint8_t msf_lba[4]; /* union msf_lba from cdio.h */
122 } __attribute__((__packed__));
123
124 /* read TOC form 1 result entries */
125 struct scsipi_toc_msinfo {
126 uint8_t unused1;
127 uint8_t adrcontol;
128 uint8_t tracknr; /* first track last compl. session */
129 uint8_t unused2;
130 uint8_t msf_lba[4]; /* union msf_lba from cdio.h */
131 } __attribute__((__packed__));
132
133 /* read TOC form 2 result entries */
134 struct scsipi_toc_rawtoc {
135 uint8_t sessionnr;
136 uint8_t adrcontrol;
137 uint8_t tno;
138 uint8_t point;
139 uint8_t min;
140 uint8_t sec;
141 uint8_t frame;
142 uint8_t zero; /* zero/unused */
143 uint8_t pmin;
144 uint8_t psec;
145 uint8_t pframe;
146 } __attribute__((__packed__));
147
148 /* read TOC form 3, 4 and 5 obmitted yet */
149
150 #define GET_CONFIGURATION 0x46 /* Get configuration */
151 #define GET_CONF_NO_FEATURES_LEN 8
152 struct scsipi_get_configuration {
153 uint8_t opcode;
154 uint8_t request_type;
155 uint8_t start_at_feature[2];
156 uint8_t unused[3];
157 uint8_t data_len[2];
158 uint8_t control;
159 } __attribute__((__packed__));
160
161 struct scsipi_get_conf_data {
162 uint8_t data_len[4];
163 uint8_t unused[2];
164 uint8_t mmc_profile[2]; /* current mmc profile for disk */
165 uint8_t feature_desc[1]; /* feature descriptors follow */
166 } __attribute__((__packed__));
167
168 struct scsipi_get_conf_feature { /* feature descriptor */
169 uint8_t featurecode[2];
170 uint8_t flags;
171 uint8_t additional_length; /* length of feature dependent */
172 uint8_t feature_dependent[256];
173 } __attribute__((__packed__));
174 #define FEATUREFLAG_CURRENT 1
175 #define FEATUREFLAG_PERSISTENT 2
176
177
178 #define READ_DISCINFO 0x51
179 struct scsipi_read_discinfo {
180 uint8_t opcode;
181 uint8_t unused[6];
182 uint8_t data_len[2];
183 uint8_t control;
184 } __attribute__((__packed__));
185
186 #define READ_DISCINFO_SMALLSIZE 12
187 #define READ_DISCINFO_BIGSIZE 34 /* + entries */
188 struct scsipi_read_discinfo_data {
189 uint8_t data_len[2];
190 uint8_t disc_state;
191 uint8_t first_track;
192 uint8_t num_sessions_lsb;
193 uint8_t first_track_last_session_lsb;
194 uint8_t last_track_last_session_lsb;
195 uint8_t disc_state2;
196 uint8_t disc_type;
197 uint8_t num_sessions_msb;
198 uint8_t first_track_last_session_msb;
199 uint8_t last_track_last_session_msb;
200 uint8_t discid[4];
201 uint8_t last_session_leadin_hmsf[4];
202 uint8_t last_possible_start_leadout_hmsf[4];
203 uint8_t disc_bar_code[8];
204 uint8_t application_code;
205 uint8_t num_opc_table_entries;
206 uint8_t opc_table_entries[1]; /* opc table entries follow */
207 } __attribute__((__packed__));
208
209
210 #define READ_TRACKINFO 0x52
211 struct scsipi_read_trackinfo {
212 uint8_t opcode;
213 uint8_t addr_type;
214 uint8_t address[4];
215 uint8_t nothing;
216 uint8_t data_len[2];
217 uint8_t control;
218 } __attribute__((__packed__));
219 #define READ_TRACKINFO_ADDR_LBA 0
220 #define READ_TRACKINFO_ADDR_TRACK 1
221 #define READ_TRACKINFO_ADDR_SESS 2
222
223 struct scsipi_read_trackinfo_data {
224 uint8_t data_len[2];
225 uint8_t track_lsb;
226 uint8_t session_lsb;
227 uint8_t unused1;
228 uint8_t track_info_1;
229 uint8_t track_info_2;
230 uint8_t data_valid;
231 uint8_t track_start[4];
232 uint8_t next_writable[4];
233 uint8_t free_blocks[4];
234 uint8_t packet_size[4];
235 uint8_t track_size[4];
236 uint8_t last_recorded[4];
237 uint8_t track_msb;
238 uint8_t session_msb;
239 uint8_t unused2[2];
240 } __attribute__((__packed__));
241 #define READ_TRACKINFO_RETURNSIZE 36
242
243
244 #define READ_CD_CAPACITY 0x25 /* slightly different from disk */
245 struct scsipi_read_cd_capacity {
246 u_int8_t opcode;
247 u_int8_t byte2;
248 u_int8_t addr[4];
249 u_int8_t unused[3];
250 u_int8_t control;
251 } __attribute__((__packed__));
252
253 struct scsipi_read_cd_cap_data {
254 u_int8_t addr[4];
255 u_int8_t length[4];
256 } __attribute__((__packed__));
257
258
259 /* mod pages common to scsi and atapi */
260 struct cd_audio_page {
261 u_int8_t pg_code;
262 #define AUDIO_PAGE 0x0e
263 u_int8_t pg_length;
264 u_int8_t flags;
265 #define CD_PA_SOTC 0x02
266 #define CD_PA_IMMED 0x04
267 u_int8_t unused[2];
268 u_int8_t format_lba; /* valid only for SCSI CDs */
269 #define CD_PA_FORMAT_LBA 0x0F
270 #define CD_PA_APR_VALID 0x80
271 u_int8_t lb_per_sec[2];
272 struct port_control {
273 u_int8_t channels;
274 #define CHANNEL 0x0F
275 #define CHANNEL_0 1
276 #define CHANNEL_1 2
277 #define CHANNEL_2 4
278 #define CHANNEL_3 8
279 #define LEFT_CHANNEL CHANNEL_0
280 #define RIGHT_CHANNEL CHANNEL_1
281 #define MUTE_CHANNEL 0x0
282 #define BOTH_CHANNEL LEFT_CHANNEL | RIGHT_CHANNEL
283 u_int8_t volume;
284 } port[4];
285 #define LEFT_PORT 0
286 #define RIGHT_PORT 1
287 };
Cache object: 69b8b5fc866293ff20281f4a06b6f844
|