xref: /netbsd/sys/compat/linux/common/linux_cdrom.h (revision bf9ec67e)
1 /*	$NetBSD: linux_cdrom.h,v 1.5 2000/12/10 14:12:16 fvdl Exp $	*/
2 
3 /*-
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Eric Haszlakiewicz.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _LINUX_CDROM_H
40 #define _LINUX_CDROM_H
41 
42 #include <machine/endian.h>
43 
44 #define LINUX_CDROMPAUSE	0x5301
45 #define LINUX_CDROMRESUME	0x5302
46 #define LINUX_CDROMPLAYMSF	0x5303	/* (struct linux_cdrom_msf) */
47 #define LINUX_CDROMPLAYTRKIND	0x5304	/* (struct linux_cdrom_ti) */
48 #define LINUX_CDROMREADTOCHDR	0x5305	/* (struct linux_cdrom_tochdr) */
49 #define LINUX_CDROMREADTOCENTRY	0x5306	/* (struct linux_cdrom_tocentry) */
50 #define LINUX_CDROMSTOP		0x5307
51 #define LINUX_CDROMSTART	0x5308
52 #define LINUX_CDROMEJECT	0x5309
53 #define LINUX_CDROMVOLCTRL	0x530a	/* (struct linux_cdrom_volctrl) */
54 #define LINUX_CDROMSUBCHNL	0x530b	/* (struct linux_cdrom_subchnl) */
55 #define LINUX_CDROMEJECT_SW	0x530f	/* arg: 0 or 1 */
56 #define LINUX_CDROMMULTISESSION	0x5310	/* (struct linux_cdrom_multisession) */
57 #define LINUX_CDROMRESET	0x5312
58 #define LINUX_CDROMVOLREAD	0x5313	/* (struct linux_cdrom_volctrl) */
59 #define LINUX_CDROMPLAYBLK	0x5317	/* (struct linux_cdrom_blk) */
60 #define LINUX_CDROMCLOSETRAY	0x5319	/* */
61 #define LINUX_CDROM_SET_OPTIONS	0x5320	/* int */
62 #define LINUX_CDROM_CLEAR_OPTIONS	0x5321	/* int */
63 #define LINUX_CDROM_SELECT_SPEED	0x5322
64 #define LINUX_CDROM_SELECT_DISC		0x5323
65 #define LINUX_CDROM_MEDIA_CHANGED	0x5325
66 #define LINUX_CDROM_DRIVE_STATUS	0x5326
67 #define LINUX_CDROM_DISC_STATUS		0x5327
68 #define LINUX_CDROM_CHANGER_NSLOTS	0x5328
69 #define LINUX_CDROM_LOCKDOOR		0x5329
70 #define LINUX_CDROM_DEBUG		0x5330
71 #define LINUX_CDROM_GET_CAPABILITY	0x5331
72 
73 /* DVD-ROM Specific ioctls */
74 #define	LINUX_DVD_READ_STRUCT	0x5390	/* Read structure */
75 #define	LINUX_DVD_WRITE_STRUCT	0x5391	/* Write structure */
76 #define	LINUX_DVD_AUTH		0x5392	/* Authentication */
77 
78 struct linux_cdrom_blk {
79 	unsigned from;
80 	unsigned short len;
81 };
82 
83 struct linux_cdrom_msf {
84 	u_char	cdmsf_min0;	/* start minute */
85 	u_char	cdmsf_sec0;	/* start second */
86 	u_char	cdmsf_frame0;	/* start frame */
87 	u_char	cdmsf_min1;	/* end minute */
88 	u_char	cdmsf_sec1;	/* end second */
89 	u_char	cdmsf_frame1;	/* end frame */
90 };
91 
92 struct linux_cdrom_ti {
93 	u_char	cdti_trk0;	/* start track */
94 	u_char	cdti_ind0;	/* start index */
95 	u_char	cdti_trk1;	/* end track */
96 	u_char	cdti_ind1;	/* end index */
97 };
98 
99 struct linux_cdrom_tochdr {
100 	u_char	cdth_trk0;	/* start track */
101 	u_char	cdth_trk1;	/* end track */
102 };
103 
104 struct linux_cdrom_msf0 {
105 	u_char	minute;
106 	u_char	second;
107 	u_char	frame;
108 };
109 
110 union linux_cdrom_addr {
111 	struct	linux_cdrom_msf0 msf;
112 	int	lba;
113 };
114 
115 struct linux_cdrom_tocentry {
116 	u_char	cdte_track;
117 	u_char	cdte_adr	:4;
118 	u_char	cdte_ctrl	:4;
119 	u_char	cdte_format;
120 	union	linux_cdrom_addr cdte_addr;
121 	u_char	cdte_datamode;
122 };
123 
124 struct linux_cdrom_subchnl {
125 	u_char	cdsc_format;
126 	u_char	cdsc_audiostatus;
127 	u_char	cdsc_adr:	4;
128 	u_char	cdsc_ctrl:	4;
129 	u_char	cdsc_trk;
130 	u_char	cdsc_ind;
131 	union	linux_cdrom_addr cdsc_absaddr;
132 	union	linux_cdrom_addr cdsc_reladdr;
133 };
134 
135 struct linux_cdrom_volctrl {
136 	u_char	channel0;
137 	u_char	channel1;
138 	u_char	channel2;
139 	u_char	channel3;
140 };
141 
142 struct linux_cdrom_multisession {
143 	union linux_cdrom_addr addr;
144 	u_char xa_flag;
145 	u_char addr_format;
146 };
147 
148 struct linux_cdrom_mechstat_header {
149 #if BYTE_ORDER == BIG_ENDIAN
150 	u_int8_t fault		: 1;
151 	u_int8_t changer_state	: 2;
152 	u_int8_t curslot	: 5;
153 	u_int8_t mech_state	: 3;
154 	u_int8_t door_open	: 1;
155 	u_int8_t reserved1	: 4;
156 #elif BYTE_ORDER == LITTLE_ENDIAN
157 	u_int8_t curslot	: 5;
158 	u_int8_t changer_state	: 2;
159 	u_int8_t fault		: 1;
160 	u_int8_t reserved1	: 4;
161 	u_int8_t door_open	: 1;
162 	u_int8_t mech_state	: 3;
163 #endif
164 	u_int8_t curlba[3];
165 	u_int8_t nslots;
166 	u_int16_t slot_tablelen;
167 };
168 
169 struct linux_cdrom_slot {
170 #if BYTE_ORDER == BIG_ENDIAN
171 	u_int8_t disc_present	: 1;
172 	u_int8_t reserved1	: 6;
173 	u_int8_t change		: 1;
174 #elif BYTE_ORDER == LITTLE_ENDIAN
175 	u_int8_t change		: 1;
176 	u_int8_t reserved1	: 6;
177 	u_int8_t disc_present	: 1;
178 #endif
179 	u_int8_t reserved2[3];
180 };
181 
182 #define LINUX_CDROM_MAX_SLOTS   256
183 
184 struct linux_cdrom_changer_info {
185 	struct linux_cdrom_mechstat_header hdr;
186 	struct linux_cdrom_slot slots[LINUX_CDROM_MAX_SLOTS];
187 };
188 
189 #endif /* !_LINUX_CDROM_H */
190