FreeBSD/Linux Kernel Cross Reference
sys/sys/cdio.h
1 /* $NetBSD: cdio.h,v 1.17 1999/01/04 15:32:08 is Exp $ */
2
3 #ifndef _SYS_CDIO_H_
4 #define _SYS_CDIO_H_
5
6 /* Shared between kernel & process */
7
8 union msf_lba {
9 struct {
10 u_char unused;
11 u_char minute;
12 u_char second;
13 u_char frame;
14 } msf;
15 u_int32_t lba;
16 u_char addr[4];
17 };
18
19 struct cd_toc_entry {
20 u_char nothing1;
21 #if BYTE_ORDER == LITTLE_ENDIAN
22 u_char control:4;
23 u_char addr_type:4;
24 #endif
25 #if BYTE_ORDER == BIG_ENDIAN
26 u_char addr_type:4;
27 u_char control:4;
28 #endif
29 u_char track;
30 u_char nothing2;
31 union msf_lba addr;
32 };
33
34 struct cd_sub_channel_header {
35 u_char nothing1;
36 u_char audio_status;
37 #define CD_AS_AUDIO_INVALID 0x00
38 #define CD_AS_PLAY_IN_PROGRESS 0x11
39 #define CD_AS_PLAY_PAUSED 0x12
40 #define CD_AS_PLAY_COMPLETED 0x13
41 #define CD_AS_PLAY_ERROR 0x14
42 #define CD_AS_NO_STATUS 0x15
43 u_char data_len[2];
44 };
45
46 struct cd_sub_channel_q_data {
47 u_char data_format;
48 #if BYTE_ORDER == LITTLE_ENDIAN
49 u_char control:4;
50 u_char addr_type:4;
51 #endif
52 #if BYTE_ORDER == BIG_ENDIAN
53 u_char addr_type:4;
54 u_char control:4;
55 #endif
56 u_char track_number;
57 u_char index_number;
58 u_char absaddr[4];
59 u_char reladdr[4];
60 #if BYTE_ORDER == LITTLE_ENDIAN
61 u_char :7;
62 u_char mc_valid:1;
63 #endif
64 #if BYTE_ORDER == BIG_ENDIAN
65 u_char mc_valid:1;
66 u_char :7;
67 #endif
68 u_char mc_number[15];
69 #if BYTE_ORDER == LITTLE_ENDIAN
70 u_char :7;
71 u_char ti_valid:1;
72 #endif
73 #if BYTE_ORDER == BIG_ENDIAN
74 u_char ti_valid:1;
75 u_char :7;
76 #endif
77 u_char ti_number[15];
78 };
79
80 struct cd_sub_channel_position_data {
81 u_char data_format;
82 #if BYTE_ORDER == LITTLE_ENDIAN
83 u_char control:4;
84 u_char addr_type:4;
85 #endif
86 #if BYTE_ORDER == BIG_ENDIAN
87 u_char addr_type:4;
88 u_char control:4;
89 #endif
90 u_char track_number;
91 u_char index_number;
92 union msf_lba absaddr;
93 union msf_lba reladdr;
94 };
95
96 struct cd_sub_channel_media_catalog {
97 u_char data_format;
98 u_char nothing1;
99 u_char nothing2;
100 u_char nothing3;
101 #if BYTE_ORDER == LITTLE_ENDIAN
102 u_char :7;
103 u_char mc_valid:1;
104 #endif
105 #if BYTE_ORDER == BIG_ENDIAN
106 u_char mc_valid:1;
107 u_char :7;
108 #endif
109 u_char mc_number[15];
110 };
111
112 struct cd_sub_channel_track_info {
113 u_char data_format;
114 u_char nothing1;
115 u_char track_number;
116 u_char nothing2;
117 #if BYTE_ORDER == LITTLE_ENDIAN
118 u_char :7;
119 u_char ti_valid:1;
120 #endif
121 #if BYTE_ORDER == BIG_ENDIAN
122 u_char ti_valid:1;
123 u_char :7;
124 #endif
125 u_char ti_number[15];
126 };
127
128 struct cd_sub_channel_info {
129 struct cd_sub_channel_header header;
130 union {
131 struct cd_sub_channel_q_data q_data;
132 struct cd_sub_channel_position_data position;
133 struct cd_sub_channel_media_catalog media_catalog;
134 struct cd_sub_channel_track_info track_info;
135 } what;
136 };
137
138 /*
139 * Ioctls for the CD drive
140 */
141 struct ioc_play_track {
142 u_char start_track;
143 u_char start_index;
144 u_char end_track;
145 u_char end_index;
146 };
147
148 #define CDIOCPLAYTRACKS _IOW('c', 1, struct ioc_play_track)
149 struct ioc_play_blocks {
150 int blk;
151 int len;
152 };
153 #define CDIOCPLAYBLOCKS _IOW('c', 2, struct ioc_play_blocks)
154
155 struct ioc_read_subchannel {
156 u_char address_format;
157 #define CD_LBA_FORMAT 1
158 #define CD_MSF_FORMAT 2
159 u_char data_format;
160 #define CD_SUBQ_DATA 0
161 #define CD_CURRENT_POSITION 1
162 #define CD_MEDIA_CATALOG 2
163 #define CD_TRACK_INFO 3
164 u_char track;
165 int data_len;
166 struct cd_sub_channel_info *data;
167 };
168 #define CDIOCREADSUBCHANNEL _IOWR('c', 3, struct ioc_read_subchannel )
169
170 struct ioc_toc_header {
171 u_short len;
172 u_char starting_track;
173 u_char ending_track;
174 };
175
176 #define CDIOREADTOCHEADER _IOR('c', 4, struct ioc_toc_header)
177
178 struct ioc_read_toc_entry {
179 u_char address_format;
180 u_char starting_track;
181 u_short data_len;
182 struct cd_toc_entry *data;
183 };
184 #define CDIOREADTOCENTRIES _IOWR('c', 5, struct ioc_read_toc_entry)
185 #define CDIOREADTOCENTRYS _IOWR('c', 5, struct ioc_read_toc_entry)
186
187 /* read LBA start of a given session; 0=last, others not yet supported */
188 #define CDIOREADMSADDR _IOWR('c', 6, int)
189
190 struct ioc_patch {
191 u_char patch[4]; /* one for each channel */
192 };
193 #define CDIOCSETPATCH _IOW('c', 9, struct ioc_patch)
194
195 struct ioc_vol {
196 u_char vol[4]; /* one for each channel */
197 };
198 #define CDIOCGETVOL _IOR('c', 10, struct ioc_vol)
199 #define CDIOCSETVOL _IOW('c', 11, struct ioc_vol)
200 #define CDIOCSETMONO _IO('c', 12)
201 #define CDIOCSETSTEREO _IO('c', 13)
202 #define CDIOCSETMUTE _IO('c', 14)
203 #define CDIOCSETLEFT _IO('c', 15)
204 #define CDIOCSETRIGHT _IO('c', 16)
205 #define CDIOCSETDEBUG _IO('c', 17)
206 #define CDIOCCLRDEBUG _IO('c', 18)
207 #define CDIOCPAUSE _IO('c', 19)
208 #define CDIOCRESUME _IO('c', 20)
209 #define CDIOCRESET _IO('c', 21)
210 #define CDIOCSTART _IO('c', 22)
211 #define CDIOCSTOP _IO('c', 23)
212 #define CDIOCEJECT _IO('c', 24)
213 #define CDIOCALLOW _IO('c', 25)
214 #define CDIOCPREVENT _IO('c', 26)
215 #define CDIOCCLOSE _IO('c', 27)
216
217 struct ioc_play_msf {
218 u_char start_m;
219 u_char start_s;
220 u_char start_f;
221 u_char end_m;
222 u_char end_s;
223 u_char end_f;
224 };
225 #define CDIOCPLAYMSF _IOW('c', 25, struct ioc_play_msf)
226
227 struct ioc_load_unload {
228 u_char options;
229 #define CD_LU_ABORT 0x1 /* NOTE: These are the same as the ATAPI */
230 #define CD_LU_UNLOAD 0x2 /* op values for the LOAD_UNLOAD command */
231 #define CD_LU_LOAD 0x3
232 u_char slot;
233 };
234 #define CDIOCLOADUNLOAD _IOW('c', 26, struct ioc_load_unload)
235
236 #endif /* !_SYS_CDIO_H_ */
Cache object: cf8e9bb937f5d7a714540d7f9254b307
|