Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Written by Julian Elischer (julian@tfs.com) | |
3 | * for TRW Financial Systems. | |
4 | * | |
5 | * TRW Financial Systems, in accordance with their agreement with Carnegie | |
6 | * Mellon University, makes this software available to CMU to distribute | |
7 | * or use in any manner that they see fit as long as this message is kept with | |
8 | * the software. For this reason TFS also grants any other persons or | |
9 | * organisations permission to use or modify this software. | |
10 | * | |
11 | * TFS supplies this software to be publicly redistributed | |
12 | * on the understanding that TFS is not responsible for the correct | |
13 | * functioning of this software in any circumstances. | |
14 | * | |
98639498 | 15 | * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 |
869c4419 | 16 | * |
519fb2b7 | 17 | * $Id: scsi_cd.h,v 1.6 93/08/26 21:09:19 julian Exp Locker: julian $ |
15637ed4 | 18 | */ |
519fb2b7 RG |
19 | #ifndef _SCSI_SCSI_CD_H |
20 | #define _SCSI_SCSI_CD_H 1 | |
bbc3f849 | 21 | |
869c4419 RG |
22 | /* |
23 | * Define two bits always in the same place in byte 2 (flag byte) | |
24 | */ | |
25 | #define CD_RELADDR 0x01 | |
26 | #define CD_MSF 0x02 | |
15637ed4 RG |
27 | |
28 | /* | |
29 | * SCSI command format | |
30 | */ | |
31 | ||
32 | struct scsi_read_capacity_cd | |
33 | { | |
34 | u_char op_code; | |
869c4419 | 35 | u_char byte2; |
15637ed4 RG |
36 | u_char addr_3; /* Most Significant */ |
37 | u_char addr_2; | |
38 | u_char addr_1; | |
39 | u_char addr_0; /* Least Significant */ | |
40 | u_char unused[3]; | |
869c4419 | 41 | u_char control; |
15637ed4 RG |
42 | }; |
43 | ||
44 | struct scsi_pause | |
45 | { | |
46 | u_char op_code; | |
869c4419 | 47 | u_char byte2; |
15637ed4 | 48 | u_char unused[6]; |
869c4419 RG |
49 | u_char resume; |
50 | u_char control; | |
15637ed4 RG |
51 | }; |
52 | #define PA_PAUSE 1 | |
53 | #define PA_RESUME 0 | |
54 | ||
55 | struct scsi_play_msf | |
56 | { | |
57 | u_char op_code; | |
869c4419 | 58 | u_char byte2; |
15637ed4 RG |
59 | u_char unused; |
60 | u_char start_m; | |
61 | u_char start_s; | |
62 | u_char start_f; | |
63 | u_char end_m; | |
64 | u_char end_s; | |
65 | u_char end_f; | |
869c4419 | 66 | u_char control; |
15637ed4 RG |
67 | }; |
68 | ||
69 | struct scsi_play_track | |
70 | { | |
71 | u_char op_code; | |
869c4419 | 72 | u_char byte2; |
15637ed4 RG |
73 | u_char unused[2]; |
74 | u_char start_track; | |
75 | u_char start_index; | |
76 | u_char unused1; | |
77 | u_char end_track; | |
78 | u_char end_index; | |
869c4419 | 79 | u_char control; |
15637ed4 RG |
80 | }; |
81 | ||
82 | struct scsi_play | |
83 | { | |
84 | u_char op_code; | |
869c4419 | 85 | u_char byte2; |
15637ed4 RG |
86 | u_char blk_addr[4]; |
87 | u_char unused; | |
88 | u_char xfer_len[2]; | |
869c4419 | 89 | u_char control; |
15637ed4 RG |
90 | }; |
91 | ||
92 | struct scsi_play_big | |
93 | { | |
94 | u_char op_code; | |
869c4419 | 95 | u_char byte2; /* same as above */ |
15637ed4 RG |
96 | u_char blk_addr[4]; |
97 | u_char xfer_len[4]; | |
98 | u_char unused; | |
869c4419 | 99 | u_char control; |
15637ed4 RG |
100 | }; |
101 | ||
102 | struct scsi_play_rel_big | |
103 | { | |
104 | u_char op_code; | |
869c4419 | 105 | u_char byte2; /* same as above */ |
15637ed4 RG |
106 | u_char blk_addr[4]; |
107 | u_char xfer_len[4]; | |
108 | u_char track; | |
869c4419 | 109 | u_char control; |
15637ed4 RG |
110 | }; |
111 | ||
112 | struct scsi_read_header | |
113 | { | |
114 | u_char op_code; | |
869c4419 | 115 | u_char byte2; |
15637ed4 RG |
116 | u_char blk_addr[4]; |
117 | u_char unused; | |
118 | u_char data_len[2]; | |
869c4419 | 119 | u_char control; |
15637ed4 RG |
120 | }; |
121 | ||
122 | struct scsi_read_subchannel | |
123 | { | |
124 | u_char op_code; | |
869c4419 RG |
125 | u_char byte2; |
126 | u_char byte3; | |
127 | #define SRS_SUBQ 0x40 | |
15637ed4 RG |
128 | u_char subchan_format; |
129 | u_char unused[2]; | |
130 | u_char track; | |
131 | u_char data_len[2]; | |
869c4419 | 132 | u_char control; |
15637ed4 RG |
133 | }; |
134 | ||
135 | struct scsi_read_toc | |
136 | { | |
137 | u_char op_code; | |
869c4419 | 138 | u_char byte2; |
15637ed4 RG |
139 | u_char unused[4]; |
140 | u_char from_track; | |
141 | u_char data_len[2]; | |
869c4419 | 142 | u_char control; |
15637ed4 | 143 | }; |
519fb2b7 | 144 | ; |
15637ed4 RG |
145 | |
146 | struct scsi_read_cd_capacity | |
147 | { | |
148 | u_char op_code; | |
869c4419 | 149 | u_char byte2; |
15637ed4 RG |
150 | u_char addr_3; /* Most Significant */ |
151 | u_char addr_2; | |
152 | u_char addr_1; | |
153 | u_char addr_0; /* Least Significant */ | |
154 | u_char unused[3]; | |
869c4419 | 155 | u_char control; |
15637ed4 RG |
156 | }; |
157 | ||
158 | /* | |
159 | * Opcodes | |
160 | */ | |
161 | ||
162 | #define READ_CD_CAPACITY 0x25 /* slightly different from disk */ | |
163 | #define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */ | |
164 | #define READ_TOC 0x43 /* cdrom read TOC */ | |
165 | #define READ_HEADER 0x44 /* cdrom read header */ | |
166 | #define PLAY 0x45 /* cdrom play 'play audio' mode */ | |
167 | #define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */ | |
168 | #define PLAY_TRACK 0x48 /* cdrom play track/index mode */ | |
169 | #define PLAY_TRACK_REL 0x49 /* cdrom play track/index mode */ | |
170 | #define PAUSE 0x4b /* cdrom pause in 'play audio' mode */ | |
171 | #define PLAY_BIG 0xa5 /* cdrom pause in 'play audio' mode */ | |
172 | #define PLAY_TRACK_REL_BIG 0xa9 /* cdrom play track/index mode */ | |
173 | ||
174 | ||
15637ed4 RG |
175 | |
176 | struct scsi_read_cd_cap_data | |
177 | { | |
178 | u_char addr_3; /* Most significant */ | |
179 | u_char addr_2; | |
180 | u_char addr_1; | |
181 | u_char addr_0; /* Least significant */ | |
182 | u_char length_3; /* Most significant */ | |
183 | u_char length_2; | |
184 | u_char length_1; | |
185 | u_char length_0; /* Least significant */ | |
186 | }; | |
187 | ||
188 | union cd_pages | |
189 | { | |
15637ed4 RG |
190 | struct audio_page |
191 | { | |
869c4419 RG |
192 | u_char page_code; |
193 | #define CD_PAGE_CODE 0x3F | |
194 | #define AUDIO_PAGE 0x0e | |
195 | #define CD_PAGE_PS 0x80 | |
15637ed4 | 196 | u_char param_len; |
869c4419 RG |
197 | u_char flags; |
198 | #define CD_PA_SOTC 0x02 | |
199 | #define CD_PA_IMMED 0x04 | |
15637ed4 | 200 | u_char unused[2]; |
869c4419 RG |
201 | u_char format_lba; |
202 | #define CD_PA_FORMAT_LBA 0x0F | |
203 | #define CD_PA_APR_VALID 0x80 | |
15637ed4 RG |
204 | u_char lb_per_sec[2]; |
205 | struct port_control | |
206 | { | |
869c4419 RG |
207 | u_char channels; |
208 | #define CHANNEL 0x0F | |
15637ed4 RG |
209 | #define CHANNEL_0 1 |
210 | #define CHANNEL_1 2 | |
211 | #define CHANNEL_2 4 | |
212 | #define CHANNEL_3 8 | |
213 | #define LEFT_CHANNEL CHANNEL_0 | |
214 | #define RIGHT_CHANNEL CHANNEL_1 | |
15637ed4 RG |
215 | u_char volume; |
216 | } port[4]; | |
217 | #define LEFT_PORT 0 | |
218 | #define RIGHT_PORT 1 | |
219 | }audio; | |
220 | }; | |
221 | ||
222 | struct cd_mode_data | |
223 | { | |
224 | struct scsi_mode_header header; | |
225 | struct blk_desc blk_desc; | |
226 | union cd_pages page; | |
227 | }; | |
519fb2b7 | 228 | #endif /*_SCSI_SCSI_CD_H*/ |
15637ed4 | 229 |