Annotation of sys/sys/cdio.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: cdio.h,v 1.16 2006/12/23 17:35:35 krw Exp $ */
2: /* $NetBSD: cdio.h,v 1.11 1996/02/19 18:29:04 scottr Exp $ */
3:
4: #ifndef _SYS_CDIO_H_
5: #define _SYS_CDIO_H_
6:
7: #include <sys/types.h>
8: #include <sys/ioccom.h>
9:
10: /* Shared between kernel & process */
11:
12: union msf_lba {
13: struct {
14: u_char unused;
15: u_char minute;
16: u_char second;
17: u_char frame;
18: } msf;
19: u_int32_t lba;
20: u_char addr[4];
21: };
22:
23: struct cd_toc_entry {
24: u_char nothing1;
25: #if _BYTE_ORDER == _LITTLE_ENDIAN
26: u_int control:4;
27: u_int addr_type:4;
28: #endif
29: #if _BYTE_ORDER == _BIG_ENDIAN
30: u_int addr_type:4;
31: u_int control:4;
32: #endif
33: u_char track;
34: u_char nothing2;
35: union msf_lba addr;
36: };
37:
38: struct cd_sub_channel_header {
39: u_char nothing1;
40: u_char audio_status;
41: #define CD_AS_AUDIO_INVALID 0x00
42: #define CD_AS_PLAY_IN_PROGRESS 0x11
43: #define CD_AS_PLAY_PAUSED 0x12
44: #define CD_AS_PLAY_COMPLETED 0x13
45: #define CD_AS_PLAY_ERROR 0x14
46: #define CD_AS_NO_STATUS 0x15
47: u_char data_len[2];
48: };
49:
50: struct cd_sub_channel_q_data {
51: u_char data_format;
52: #if _BYTE_ORDER == _LITTLE_ENDIAN
53: u_int control:4;
54: u_int addr_type:4;
55: #endif
56: #if _BYTE_ORDER == _BIG_ENDIAN
57: u_int addr_type:4;
58: u_int control:4;
59: #endif
60: u_char track_number;
61: u_char index_number;
62: u_char absaddr[4];
63: u_char reladdr[4];
64: #if _BYTE_ORDER == _LITTLE_ENDIAN
65: u_int :7;
66: u_int mc_valid:1;
67: #endif
68: #if _BYTE_ORDER == _BIG_ENDIAN
69: u_int mc_valid:1;
70: u_int :7;
71: #endif
72: u_char mc_number[15];
73: #if _BYTE_ORDER == _LITTLE_ENDIAN
74: u_int :7;
75: u_int ti_valid:1;
76: #endif
77: #if _BYTE_ORDER == _BIG_ENDIAN
78: u_int ti_valid:1;
79: u_int :7;
80: #endif
81: u_char ti_number[15];
82: };
83:
84: struct cd_sub_channel_position_data {
85: u_char data_format;
86: #if _BYTE_ORDER == _LITTLE_ENDIAN
87: u_int control:4;
88: u_int addr_type:4;
89: #endif
90: #if _BYTE_ORDER == _BIG_ENDIAN
91: u_int addr_type:4;
92: u_int control:4;
93: #endif
94: u_char track_number;
95: u_char index_number;
96: union msf_lba absaddr;
97: union msf_lba reladdr;
98: };
99:
100: struct cd_sub_channel_media_catalog {
101: u_char data_format;
102: u_char nothing1;
103: u_char nothing2;
104: u_char nothing3;
105: #if _BYTE_ORDER == _LITTLE_ENDIAN
106: u_int :7;
107: u_int mc_valid:1;
108: #endif
109: #if _BYTE_ORDER == _BIG_ENDIAN
110: u_int mc_valid:1;
111: u_int :7;
112: #endif
113: u_char mc_number[15];
114: };
115:
116: struct cd_sub_channel_track_info {
117: u_char data_format;
118: u_char nothing1;
119: u_char track_number;
120: u_char nothing2;
121: #if _BYTE_ORDER == _LITTLE_ENDIAN
122: u_int :7;
123: u_int ti_valid:1;
124: #endif
125: #if _BYTE_ORDER == _BIG_ENDIAN
126: u_int ti_valid:1;
127: u_int :7;
128: #endif
129: u_char ti_number[15];
130: };
131:
132: struct cd_sub_channel_info {
133: struct cd_sub_channel_header header;
134: union {
135: struct cd_sub_channel_q_data q_data;
136: struct cd_sub_channel_position_data position;
137: struct cd_sub_channel_media_catalog media_catalog;
138: struct cd_sub_channel_track_info track_info;
139: } what;
140: };
141:
142: /*
143: * Ioctls for the CD drive
144: */
145: struct ioc_play_track {
146: u_char start_track;
147: u_char start_index;
148: u_char end_track;
149: u_char end_index;
150: };
151:
152: #define CDIOCPLAYTRACKS _IOW('c', 1, struct ioc_play_track)
153: struct ioc_play_blocks {
154: int blk;
155: int len;
156: };
157: #define CDIOCPLAYBLOCKS _IOW('c', 2, struct ioc_play_blocks)
158:
159: struct ioc_read_subchannel {
160: u_char address_format;
161: #define CD_LBA_FORMAT 1
162: #define CD_MSF_FORMAT 2
163: u_char data_format;
164: #define CD_SUBQ_DATA 0
165: #define CD_CURRENT_POSITION 1
166: #define CD_MEDIA_CATALOG 2
167: #define CD_TRACK_INFO 3
168: u_char track;
169: int data_len;
170: struct cd_sub_channel_info *data;
171: };
172: #define CDIOCREADSUBCHANNEL _IOWR('c', 3, struct ioc_read_subchannel)
173:
174: struct ioc_toc_header {
175: u_short len;
176: u_char starting_track;
177: u_char ending_track;
178: };
179:
180: #define CDIOREADTOCHEADER _IOR('c', 4, struct ioc_toc_header)
181:
182: struct ioc_read_toc_entry {
183: u_char address_format;
184: u_char starting_track;
185: #define CD_TRACK_LEADOUT 0xaa
186: u_short data_len;
187: struct cd_toc_entry *data;
188: };
189: #define CDIOREADTOCENTRIES _IOWR('c', 5, struct ioc_read_toc_entry)
190: #define CDIOREADTOCENTRYS CDIOREADTOCENTRIES
191:
192: /* read LBA start of a given session; 0=last, others not yet supported */
193: #define CDIOREADMSADDR _IOWR('c', 6, int)
194:
195: struct ioc_patch {
196: u_char patch[4]; /* one for each channel */
197: };
198: #define CDIOCSETPATCH _IOW('c', 9, struct ioc_patch)
199:
200: struct ioc_vol {
201: u_char vol[4]; /* one for each channel */
202: };
203: #define CDIOCGETVOL _IOR('c', 10, struct ioc_vol)
204: #define CDIOCSETVOL _IOW('c', 11, struct ioc_vol)
205: #define CDIOCSETMONO _IO('c', 12)
206: #define CDIOCSETSTEREO _IO('c', 13)
207: #define CDIOCSETMUTE _IO('c', 14)
208: #define CDIOCSETLEFT _IO('c', 15)
209: #define CDIOCSETRIGHT _IO('c', 16)
210: #define CDIOCSETDEBUG _IO('c', 17)
211: #define CDIOCCLRDEBUG _IO('c', 18)
212: #define CDIOCPAUSE _IO('c', 19)
213: #define CDIOCRESUME _IO('c', 20)
214: #define CDIOCRESET _IO('c', 21)
215: #define CDIOCSTART _IO('c', 22)
216: #define CDIOCSTOP _IO('c', 23)
217: #define CDIOCEJECT _IO('c', 24)
218: #define CDIOCALLOW _IO('c', 25)
219: #define CDIOCPREVENT _IO('c', 26)
220: #define CDIOCCLOSE _IO('c', 27)
221: #define CDIOCSETCDDA _IOW('c', 28, int) /* (re)set CDDA reading mode */
222:
223: struct ioc_play_msf {
224: u_char start_m;
225: u_char start_s;
226: u_char start_f;
227: u_char end_m;
228: u_char end_s;
229: u_char end_f;
230: };
231: #define CDIOCPLAYMSF _IOW('c', 25, struct ioc_play_msf)
232:
233: struct ioc_load_unload {
234: u_char options;
235: #define CD_LU_ABORT 0x1 /* NOTE: These are the same as the ATAPI */
236: #define CD_LU_UNLOAD 0x2 /* op values for the LOAD_UNLOAD command */
237: #define CD_LU_LOAD 0x3
238: u_char slot;
239: };
240: #define CDIOCLOADUNLOAD _IOW('c', 26, struct ioc_load_unload)
241:
242: /* DVD definitions */
243:
244: /* DVD-ROM Specific ioctls */
245: #define DVD_READ_STRUCT _IOWR('d', 0, union dvd_struct)
246: #define DVD_WRITE_STRUCT _IOWR('d', 1, union dvd_struct)
247: #define DVD_AUTH _IOWR('d', 2, union dvd_authinfo)
248:
249: #define GPCMD_READ_DVD_STRUCTURE 0xad
250: #define GPCMD_SEND_DVD_STRUCTURE 0xad
251: #define GPCMD_REPORT_KEY 0xa4
252: #define GPCMD_SEND_KEY 0xa3
253:
254: /* DVD struct types */
255: #define DVD_STRUCT_PHYSICAL 0x00
256: #define DVD_STRUCT_COPYRIGHT 0x01
257: #define DVD_STRUCT_DISCKEY 0x02
258: #define DVD_STRUCT_BCA 0x03
259: #define DVD_STRUCT_MANUFACT 0x04
260:
261: struct dvd_layer {
262: u_int8_t book_version;
263: u_int8_t book_type;
264: u_int8_t min_rate;
265: u_int8_t disc_size;
266: u_int8_t layer_type;
267: u_int8_t track_path;
268: u_int8_t nlayers;
269: u_int8_t track_density;
270: u_int8_t linear_density;
271: u_int8_t bca;
272: u_int32_t start_sector;
273: u_int32_t end_sector;
274: u_int32_t end_sector_l0;
275: };
276:
277: struct dvd_physical {
278: u_int8_t type;
279:
280: u_int8_t layer_num;
281: struct dvd_layer layer[4];
282: };
283:
284: struct dvd_copyright {
285: u_int8_t type;
286:
287: u_int8_t layer_num;
288: u_int8_t cpst;
289: u_int8_t rmi;
290: };
291:
292: struct dvd_disckey {
293: u_int8_t type;
294:
295: u_int8_t agid;
296: u_int8_t value[2048];
297: };
298:
299: struct dvd_bca {
300: u_int8_t type;
301:
302: int len;
303: u_int8_t value[188];
304: };
305:
306: struct dvd_manufact {
307: u_int8_t type;
308:
309: u_int8_t layer_num;
310: int len;
311: u_int8_t value[2048];
312: };
313:
314: union dvd_struct {
315: u_int8_t type;
316:
317: struct dvd_physical physical;
318: struct dvd_copyright copyright;
319: struct dvd_disckey disckey;
320: struct dvd_bca bca;
321: struct dvd_manufact manufact;
322: };
323:
324: /*
325: * DVD authentication ioctl
326: */
327:
328: /* Authentication states */
329: #define DVD_LU_SEND_AGID 0
330: #define DVD_HOST_SEND_CHALLENGE 1
331: #define DVD_LU_SEND_KEY1 2
332: #define DVD_LU_SEND_CHALLENGE 3
333: #define DVD_HOST_SEND_KEY2 4
334:
335: /* Termination states */
336: #define DVD_AUTH_ESTABLISHED 5
337: #define DVD_AUTH_FAILURE 6
338:
339: /* Other functions */
340: #define DVD_LU_SEND_TITLE_KEY 7
341: #define DVD_LU_SEND_ASF 8
342: #define DVD_INVALIDATE_AGID 9
343: #define DVD_LU_SEND_RPC_STATE 10
344: #define DVD_HOST_SEND_RPC_STATE 11
345:
346: #if 0
347: /* State data */
348: typedef u_int8_t dvd_key[5]; /* 40-bit value, MSB is first elem. */
349: typedef u_int8_t dvd_challenge[10]; /* 80-bit value, MSB is first elem. */
350: #endif
351:
352: #define DVD_KEY_SIZE 5
353: #define DVD_CHALLENGE_SIZE 10
354:
355: struct dvd_lu_send_agid {
356: u_int8_t type;
357:
358: u_int8_t agid;
359: };
360:
361: struct dvd_host_send_challenge {
362: u_int8_t type;
363:
364: u_int8_t agid;
365: u_int8_t chal[DVD_CHALLENGE_SIZE];
366: };
367:
368: struct dvd_send_key {
369: u_int8_t type;
370:
371: u_int8_t agid;
372: u_int8_t key[DVD_KEY_SIZE];
373: };
374:
375: struct dvd_lu_send_challenge {
376: u_int8_t type;
377:
378: u_int8_t agid;
379: u_int8_t chal[DVD_CHALLENGE_SIZE];
380: };
381:
382: #define DVD_CPM_NO_COPYRIGHT 0
383: #define DVD_CPM_COPYRIGHTED 1
384:
385: #define DVD_CP_SEC_NONE 0
386: #define DVD_CP_SEC_EXIST 1
387:
388: #define DVD_CGMS_UNRESTRICTED 0
389: #define DVD_CGMS_SINGLE 2
390: #define DVD_CGMS_RESTRICTED 3
391:
392: struct dvd_lu_send_title_key {
393: u_int8_t type;
394:
395: u_int8_t agid;
396: u_int8_t title_key[DVD_KEY_SIZE];
397: int lba;
398: u_int8_t cpm;
399: u_int8_t cp_sec;
400: u_int8_t cgms;
401: };
402:
403: struct dvd_lu_send_asf {
404: u_int8_t type;
405:
406: u_int8_t agid;
407: u_int8_t asf;
408: };
409:
410: struct dvd_host_send_rpcstate {
411: u_int8_t type;
412: u_int8_t pdrc;
413: };
414:
415: struct dvd_lu_send_rpcstate {
416: u_int8_t type;
417: u_int8_t vra;
418: u_int8_t ucca;
419: u_int8_t region_mask;
420: u_int8_t rpc_scheme;
421: };
422:
423: union dvd_authinfo {
424: u_int8_t type;
425:
426: struct dvd_lu_send_agid lsa;
427: struct dvd_host_send_challenge hsc;
428: struct dvd_send_key lsk;
429: struct dvd_lu_send_challenge lsc;
430: struct dvd_send_key hsk;
431: struct dvd_lu_send_title_key lstk;
432: struct dvd_lu_send_asf lsasf;
433: struct dvd_host_send_rpcstate hrpcs;
434: struct dvd_lu_send_rpcstate lrpcs;
435: };
436: #endif /* !_SYS_CDIO_H_ */
CVSweb