7027
|
1 #ifndef _DVD_H_
|
|
2 #define _DVD_H_
|
|
3
|
|
4 #include <sys/cdefs.h>
|
|
5 #include <machine/endian.h>
|
|
6 #include <sys/ioctl.h>
|
|
7
|
|
8 __BEGIN_DECLS
|
|
9 int dvd_cdrom_ioctl(int, unsigned long, void *);
|
|
10 int cdrom_blocksize(int, int);
|
|
11 void dvd_cdrom_debug(int);
|
|
12 __END_DECLS
|
|
13
|
|
14 #define ioctl(a,b,c) dvd_cdrom_ioctl((a),(b),(c))
|
|
15
|
|
16 typedef unsigned char __u8;
|
|
17 typedef unsigned short __u16;
|
|
18 typedef unsigned int __u32;
|
|
19
|
|
20 #define DVD_READ_STRUCT 0x5390 /* Read structure */
|
|
21 #define DVD_WRITE_STRUCT 0x5391 /* Write structure */
|
|
22 #define DVD_AUTH 0x5392 /* Authentication */
|
|
23
|
|
24 #define DVD_STRUCT_PHYSICAL 0x00
|
|
25 #define DVD_STRUCT_COPYRIGHT 0x01
|
|
26 #define DVD_STRUCT_DISCKEY 0x02
|
|
27 #define DVD_STRUCT_BCA 0x03
|
|
28 #define DVD_STRUCT_MANUFACT 0x04
|
|
29
|
|
30 struct dvd_layer {
|
|
31 __u8 book_version : 4;
|
|
32 __u8 book_type : 4;
|
|
33 __u8 min_rate : 4;
|
|
34 __u8 disc_size : 4;
|
|
35 __u8 layer_type : 4;
|
|
36 __u8 track_path : 1;
|
|
37 __u8 nlayers : 2;
|
|
38 __u8 track_density : 4;
|
|
39 __u8 linear_density : 4;
|
|
40 __u8 bca : 1;
|
|
41 __u32 start_sector;
|
|
42 __u32 end_sector;
|
|
43 __u32 end_sector_l0;
|
|
44 };
|
|
45
|
|
46 struct dvd_physical {
|
|
47 __u8 type;
|
|
48 __u8 layer_num;
|
|
49 struct dvd_layer layer[4];
|
|
50 };
|
|
51
|
|
52 struct dvd_copyright {
|
|
53 __u8 type;
|
|
54
|
|
55 __u8 layer_num;
|
|
56 __u8 cpst;
|
|
57 __u8 rmi;
|
|
58 };
|
|
59
|
|
60 struct dvd_disckey {
|
|
61 __u8 type;
|
|
62
|
|
63 unsigned agid : 2;
|
|
64 __u8 value[2048];
|
|
65 };
|
|
66
|
|
67 struct dvd_bca {
|
|
68 __u8 type;
|
|
69
|
|
70 int len;
|
|
71 __u8 value[188];
|
|
72 };
|
|
73
|
|
74 struct dvd_manufact {
|
|
75 __u8 type;
|
|
76
|
|
77 __u8 layer_num;
|
|
78 int len;
|
|
79 __u8 value[2048];
|
|
80 };
|
|
81
|
|
82 typedef union {
|
|
83 __u8 type;
|
|
84
|
|
85 struct dvd_physical physical;
|
|
86 struct dvd_copyright copyright;
|
|
87 struct dvd_disckey disckey;
|
|
88 struct dvd_bca bca;
|
|
89 struct dvd_manufact manufact;
|
|
90 } dvd_struct;
|
|
91
|
|
92 /*
|
|
93 * DVD authentication ioctl
|
|
94 */
|
|
95
|
|
96 /* Authentication states */
|
|
97 #define DVD_LU_SEND_AGID 0
|
|
98 #define DVD_HOST_SEND_CHALLENGE 1
|
|
99 #define DVD_LU_SEND_KEY1 2
|
|
100 #define DVD_LU_SEND_CHALLENGE 3
|
|
101 #define DVD_HOST_SEND_KEY2 4
|
|
102
|
|
103 /* Termination states */
|
|
104 #define DVD_AUTH_ESTABLISHED 5
|
|
105 #define DVD_AUTH_FAILURE 6
|
|
106
|
|
107 /* Other functions */
|
|
108 #define DVD_LU_SEND_TITLE_KEY 7
|
|
109 #define DVD_LU_SEND_ASF 8
|
|
110 #define DVD_INVALIDATE_AGID 9
|
|
111 #define DVD_LU_SEND_RPC_STATE 10
|
|
112 #define DVD_HOST_SEND_RPC_STATE 11
|
|
113
|
|
114 /* State data */
|
|
115 typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */
|
|
116 typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */
|
|
117
|
|
118 struct dvd_lu_send_agid {
|
|
119 __u8 type;
|
|
120 unsigned agid : 2;
|
|
121 };
|
|
122
|
|
123 struct dvd_host_send_challenge {
|
|
124 __u8 type;
|
|
125 unsigned agid : 2;
|
|
126
|
|
127 dvd_challenge chal;
|
|
128 };
|
|
129
|
|
130 struct dvd_send_key {
|
|
131 __u8 type;
|
|
132 unsigned agid : 2;
|
|
133
|
|
134 dvd_key key;
|
|
135 };
|
|
136
|
|
137 struct dvd_lu_send_challenge {
|
|
138 __u8 type;
|
|
139 unsigned agid : 2;
|
|
140
|
|
141 dvd_challenge chal;
|
|
142 };
|
|
143
|
|
144 #define DVD_CPM_NO_COPYRIGHT 0
|
|
145 #define DVD_CPM_COPYRIGHTED 1
|
|
146
|
|
147 #define DVD_CP_SEC_NONE 0
|
|
148 #define DVD_CP_SEC_EXIST 1
|
|
149
|
|
150 #define DVD_CGMS_UNRESTRICTED 0
|
|
151 #define DVD_CGMS_SINGLE 2
|
|
152 #define DVD_CGMS_RESTRICTED 3
|
|
153
|
|
154 struct dvd_lu_send_title_key {
|
|
155 __u8 type;
|
|
156 unsigned agid : 2;
|
|
157
|
|
158 dvd_key title_key;
|
|
159 int lba;
|
|
160 unsigned cpm : 1;
|
|
161 unsigned cp_sec : 1;
|
|
162 unsigned cgms : 2;
|
|
163 };
|
|
164
|
|
165 struct dvd_lu_send_asf {
|
|
166 __u8 type;
|
|
167 unsigned agid : 2;
|
|
168
|
|
169 unsigned asf : 1;
|
|
170 };
|
|
171
|
|
172 struct dvd_host_send_rpcstate {
|
|
173 __u8 type;
|
|
174 __u8 pdrc;
|
|
175 };
|
|
176
|
|
177 struct dvd_lu_send_rpcstate {
|
|
178 __u8 type : 2;
|
|
179 __u8 vra : 3;
|
|
180 __u8 ucca : 3;
|
|
181 __u8 region_mask;
|
|
182 __u8 rpc_scheme;
|
|
183 };
|
|
184
|
|
185 typedef union {
|
|
186 __u8 type;
|
|
187
|
|
188 struct dvd_lu_send_agid lsa;
|
|
189 struct dvd_host_send_challenge hsc;
|
|
190 struct dvd_send_key lsk;
|
|
191 struct dvd_lu_send_challenge lsc;
|
|
192 struct dvd_send_key hsk;
|
|
193 struct dvd_lu_send_title_key lstk;
|
|
194 struct dvd_lu_send_asf lsasf;
|
|
195 struct dvd_host_send_rpcstate hrpcs;
|
|
196 struct dvd_lu_send_rpcstate lrpcs;
|
|
197 } dvd_authinfo;
|
|
198
|
|
199
|
|
200 typedef struct {
|
|
201 __u16 report_key_length;
|
|
202 __u8 reserved1;
|
|
203 __u8 reserved2;
|
|
204 #if BYTE_ORDER == BIG_ENDIAN
|
|
205 __u8 type_code : 2;
|
|
206 __u8 vra : 3;
|
|
207 __u8 ucca : 3;
|
|
208 #elif BYTE_ORDER == LITTLE_ENDIAN
|
|
209 __u8 ucca : 3;
|
|
210 __u8 vra : 3;
|
|
211 __u8 type_code : 2;
|
|
212 #endif
|
|
213 __u8 region_mask;
|
|
214 __u8 rpc_scheme;
|
|
215 __u8 reserved3;
|
|
216 } rpc_state_t;
|
|
217
|
|
218 /*
|
|
219 * Stuff for the CDROM ioctls
|
|
220 */
|
|
221
|
|
222 #define CDROMREADTOCHDR 0x5305 /* Read TOC header (cdrom_tochdr) */
|
|
223 #define CDROMREADTOCENTRY 0x5306 /* Read TOC entry (cdrom_tocentry) */
|
|
224 #define CDROMEJECT 0x5309 /* Ejects the cdrom media */
|
|
225 #define CDROMCLOSETRAY 0x5319 /* Reverse of CDROMEJECT */
|
|
226 #define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
|
|
227 #define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) */
|
|
228 #define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) */
|
|
229 #define CDROMREADRAW 0x5314 /* read data in raw mode (2352 bytes) */
|
|
230
|
|
231 #define CD_MINS 74 /* max. minutes per CD, not really a limit */
|
|
232 #define CD_SECS 60 /* seconds per minute */
|
|
233 #define CD_FRAMES 75 /* frames per second */
|
|
234 #define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
|
|
235
|
|
236 #define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
|
|
237 #define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
|
|
238 #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
|
|
239 #define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
|
|
240 #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
|
|
241 #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
|
|
242
|
|
243 /* CD-ROM address types (cdrom_tocentry.cdte_format) */
|
|
244 #define CDROM_LBA 0x01 /* logical block: first frame is #0 */
|
|
245 #define CDROM_MSF 0x02 /* minute-second-frame: binary. not bcd here!*/
|
|
246
|
|
247 /* The leadout track is always 0xAA, regardless of # of tracks on disc */
|
|
248 #define CDROM_LEADOUT 0xAA
|
|
249
|
|
250 /* drive status returned by CDROM_DRIVE_STATUS ioctl */
|
|
251 #define CDS_NO_INFO 0 /* if not implemented */
|
|
252 #define CDS_NO_DISC 1
|
|
253 #define CDS_TRAY_OPEN 2
|
|
254 #define CDS_DRIVE_NOT_READY 3
|
|
255 #define CDS_DISC_OK 4
|
|
256
|
|
257 /* For compile compatibility only - we don't support changers */
|
|
258 #define CDSL_NONE ((int) (~0U>>1)-1)
|
|
259 #define CDSL_CURRENT ((int) (~0U>>1))
|
|
260
|
|
261 struct cdrom_msf
|
|
262 {
|
|
263 __u8 cdmsf_min0; /* start minute */
|
|
264 __u8 cdmsf_sec0; /* start second */
|
|
265 __u8 cdmsf_frame0; /* start frame */
|
|
266 __u8 cdmsf_min1; /* end minute */
|
|
267 __u8 cdmsf_sec1; /* end second */
|
|
268 __u8 cdmsf_frame1; /* end frame */
|
|
269 };
|
|
270
|
|
271 struct cdrom_tochdr
|
|
272 {
|
|
273 __u8 cdth_trk0; /* start track */
|
|
274 __u8 cdth_trk1; /* end track */
|
|
275 };
|
|
276
|
|
277 struct cdrom_msf0
|
|
278 {
|
|
279 __u8 minute;
|
|
280 __u8 second;
|
|
281 __u8 frame;
|
|
282 };
|
|
283
|
|
284 union cdrom_addr
|
|
285 {
|
|
286 struct cdrom_msf0 msf;
|
|
287 int lba;
|
|
288 };
|
|
289
|
|
290 struct cdrom_tocentry
|
|
291 {
|
|
292 __u8 cdte_track;
|
|
293 __u8 cdte_adr :4;
|
|
294 __u8 cdte_ctrl :4;
|
|
295 __u8 cdte_format;
|
|
296 union cdrom_addr cdte_addr;
|
|
297 __u8 cdte_datamode;
|
|
298 };
|
|
299
|
|
300 struct modesel_head
|
|
301 {
|
|
302 __u8 reserved1;
|
|
303 __u8 medium;
|
|
304 __u8 reserved2;
|
|
305 __u8 block_desc_length;
|
|
306 __u8 density;
|
|
307 __u8 number_of_blocks_hi;
|
|
308 __u8 number_of_blocks_med;
|
|
309 __u8 number_of_blocks_lo;
|
|
310 __u8 reserved3;
|
|
311 __u8 block_length_hi;
|
|
312 __u8 block_length_med;
|
|
313 __u8 block_length_lo;
|
|
314 };
|
|
315 #endif /* _DVD_H_ */
|