1 /*	$OpenBSD: linux_cdrom.h,v 1.2 1997/12/10 00:01:40 provos Exp $	*/
2 /*
3  * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by Niels Provos.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 struct linux_cdrom_blk
33 {
34 	unsigned from;
35 	unsigned short len;
36 };
37 
38 
39 struct linux_cdrom_msf
40 {
41 	u_char	cdmsf_min0;	/* start */
42 	u_char	cdmsf_sec0;
43 	u_char	cdmsf_frame0;
44 	u_char	cdmsf_min1;	/* end */
45 	u_char	cdmsf_sec1;
46 	u_char	cdmsf_frame1;
47 };
48 
49 struct linux_cdrom_ti
50 {
51 	u_char	cdti_trk0;	/* start */
52 	u_char	cdti_ind0;
53 	u_char	cdti_trk1;	/* end */
54 	u_char	cdti_ind1;
55 };
56 
57 struct linux_cdrom_tochdr
58 {
59 	u_char	cdth_trk0;	/* start */
60 	u_char	cdth_trk1;	/* end */
61 };
62 
63 struct linux_cdrom_msf0
64 {
65 	u_char	minute;
66 	u_char	second;
67 	u_char	frame;
68 };
69 
70 union linux_cdrom_addr
71 {
72 	struct linux_cdrom_msf0	msf;
73 	int			lba;
74 };
75 
76 struct linux_cdrom_tocentry
77 {
78 	u_char	cdte_track;
79 	u_char	cdte_adr	:4;
80 	u_char	cdte_ctrl	:4;
81 	u_char	cdte_format;
82 	union linux_cdrom_addr cdte_addr;
83 	u_char	cdte_datamode;
84 };
85 
86 #define	LINUX_CDROM_LBA 0x01
87 #define	LINUX_CDROM_MSF 0x02
88 
89 #define	LINUX_CDROM_DATA_TRACK	0x04
90 
91 #define	LINUX_CDROM_LEADOUT	0xAA
92 
93 struct linux_cdrom_subchnl
94 {
95 	u_char	cdsc_format;
96 	u_char	cdsc_audiostatus;
97 	u_char	cdsc_adr:	4;
98 	u_char	cdsc_ctrl:	4;
99 	u_char	cdsc_trk;
100 	u_char	cdsc_ind;
101 	union linux_cdrom_addr cdsc_absaddr;
102 	union linux_cdrom_addr cdsc_reladdr;
103 };
104 
105 struct linux_cdrom_mcn {
106   u_char medium_catalog_number[14];
107 };
108 
109 
110 struct linux_cdrom_volctrl
111 {
112 	u_char	channel0;
113 	u_char	channel1;
114 	u_char	channel2;
115 	u_char	channel3;
116 };
117 
118 struct linux_cdrom_read
119 {
120 	int	cdread_lba;
121 	caddr_t	cdread_bufaddr;
122 	int	cdread_buflen;
123 };
124 
125 #define LINUX_CDROMPAUSE		0x5301
126 #define LINUX_CDROMRESUME		0x5302
127 #define LINUX_CDROMPLAYMSF		0x5303
128 #define LINUX_CDROMPLAYTRKIND		0x5304
129 
130 #define LINUX_CDROMREADTOCHDR		0x5305
131 #define LINUX_CDROMREADTOCENTRY	        0x5306
132 
133 #define LINUX_CDROMSTOP		        0x5307
134 #define LINUX_CDROMSTART		0x5308
135 
136 #define LINUX_CDROMEJECT		0x5309
137 
138 #define LINUX_CDROMVOLCTRL		0x530a
139 
140 #define LINUX_CDROMSUBCHNL		0x530b
141 
142 #define LINUX_CDROMREADMODE2		0x530c
143 #define LINUX_CDROMREADMODE1		0x530d
144 #define LINUX_CDROMREADAUDIO		0x530e
145 
146 #define LINUX_CDROMEJECT_SW		0x530f
147 
148 #define LINUX_CDROMMULTISESSION	        0x5310
149 
150 #define LINUX_CDROM_GET_UPC		0x5311
151 
152 #define LINUX_CDROMRESET		0x5312
153 #define LINUX_CDROMVOLREAD		0x5313
154 
155 #define LINUX_CDROMPLAYBLK		0x5317
156