]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/cdio.h
This commit was generated by cvs2svn to compensate for changes in r92289,
[FreeBSD/FreeBSD.git] / sys / sys / cdio.h
1 /*
2  * 16 Feb 93    Julian Elischer (julian@dialix.oz.au)
3  *
4  * $FreeBSD$
5  */
6
7 /*
8 <1>     Fixed a conflict with ioctl usage.  There were two different
9         functions using code #25.  Made file formatting consistent.
10         Added two new ioctl codes: door closing and audio pitch playback.
11         Added a STEREO union called STEREO.
12         5-Mar-95  Frank Durda IV        bsdmail@nemesis.lonestar.org
13
14 <2>     Added a new ioctl that allows you to find out what capabilities
15         a drive has and what commands it will accept.  This allows a
16         user application to only offer controls (buttons, sliders, etc)
17         for functions that drive can actually do.   Things it can't do
18         can disappear or be greyed-out (like some other system).
19         If the driver doesn't respond to this call, well, handle it the
20         way you used to do it.
21         2-Apr-95  Frank Durda IV        bsdmail@nemesis.lonestar.org
22 */
23
24 /* Shared between kernel & process */
25
26 #ifndef _SYS_CDIO_H_
27 #define _SYS_CDIO_H_
28
29 #ifndef _KERNEL
30 #include <sys/types.h>
31 #endif
32 #include <sys/ioccom.h>
33
34 union msf_lba {
35         struct {
36                 unsigned char   unused;
37                 unsigned char   minute;
38                 unsigned char   second;
39                 unsigned char   frame;
40         } msf;
41         int     lba;    /* network byte order */
42         u_char  addr[4];
43 };
44
45 struct cd_toc_entry {
46         u_int   :8;
47         u_int   control:4;
48         u_int   addr_type:4;
49         u_char  track;
50         u_int   :8;
51         union msf_lba  addr;
52 };
53
54 struct cd_sub_channel_header {
55         u_int   :8;
56         u_char  audio_status;
57 #define CD_AS_AUDIO_INVALID        0x00
58 #define CD_AS_PLAY_IN_PROGRESS     0x11
59 #define CD_AS_PLAY_PAUSED          0x12
60 #define CD_AS_PLAY_COMPLETED       0x13
61 #define CD_AS_PLAY_ERROR           0x14
62 #define CD_AS_NO_STATUS            0x15
63         u_char  data_len[2];
64 };
65
66 struct cd_sub_channel_position_data {
67         u_char  data_format;
68         u_int   control:4;
69         u_int   addr_type:4;
70         u_char  track_number;
71         u_char  index_number;
72         union msf_lba  absaddr;
73         union msf_lba  reladdr;
74 };
75
76 struct cd_sub_channel_media_catalog {
77         u_char  data_format;
78         u_int   :8;
79         u_int   :8;
80         u_int   :8;
81         u_int   :7;
82         u_int   mc_valid:1;
83         u_char  mc_number[15];
84 };
85
86 struct cd_sub_channel_track_info {
87         u_char  data_format;
88         u_int   :8;
89         u_char  track_number;
90         u_int   :8;
91         u_int   :7;
92         u_int   ti_valid:1;
93         u_char  ti_number[15];
94 };
95
96 struct cd_sub_channel_info {
97         struct cd_sub_channel_header header;
98         union {
99                 struct cd_sub_channel_position_data position;
100                 struct cd_sub_channel_media_catalog media_catalog;
101                 struct cd_sub_channel_track_info track_info;
102         } what;
103 };
104
105
106 /***************************************************************\
107 * Ioctls for the CD drive                                       *
108 \***************************************************************/
109
110 struct ioc_play_track {
111         u_char  start_track;
112         u_char  start_index;
113         u_char  end_track;
114         u_char  end_index;
115 };
116 #define CDIOCPLAYTRACKS _IOW('c',1,struct ioc_play_track)
117
118
119 struct ioc_play_blocks {
120         int     blk;
121         int     len;
122 };
123 #define CDIOCPLAYBLOCKS _IOW('c',2,struct ioc_play_blocks)
124
125
126 struct ioc_read_subchannel {
127         u_char address_format;
128 #define CD_LBA_FORMAT   1
129 #define CD_MSF_FORMAT   2
130         u_char data_format;
131 #define CD_SUBQ_DATA            0
132 #define CD_CURRENT_POSITION     1
133 #define CD_MEDIA_CATALOG        2
134 #define CD_TRACK_INFO           3
135         u_char track;
136         int     data_len;
137         struct  cd_sub_channel_info *data;
138 };
139 #define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel )
140
141
142 struct ioc_toc_header {
143         u_short len;
144         u_char  starting_track;
145         u_char  ending_track;
146 };
147 #define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header)
148
149
150 struct ioc_read_toc_entry {
151         u_char  address_format;
152         u_char  starting_track;
153         u_short data_len;
154         struct  cd_toc_entry *data;
155 };
156 #define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry)
157
158
159 struct ioc_read_toc_single_entry {
160         u_char  address_format;
161         u_char  track;
162         struct  cd_toc_entry entry;
163 };
164 #define CDIOREADTOCENTRY _IOWR('c',6,struct ioc_read_toc_single_entry)
165
166
167 struct ioc_patch {
168         u_char  patch[4];       /* one for each channel */
169 };
170 #define CDIOCSETPATCH   _IOW('c',9,struct ioc_patch)
171
172
173 struct ioc_vol {
174         u_char  vol[4]; /* one for each channel */
175 };
176 #define CDIOCGETVOL     _IOR('c',10,struct ioc_vol)
177
178 #define CDIOCSETVOL     _IOW('c',11,struct ioc_vol)
179
180 #define CDIOCSETMONO    _IO('c',12)
181
182 #define CDIOCSETSTERIO  _IO('c',13)
183 #define CDIOCSETSTEREO  _IO('c',13)
184
185 #define CDIOCSETMUTE    _IO('c',14)
186
187 #define CDIOCSETLEFT    _IO('c',15)
188
189 #define CDIOCSETRIGHT   _IO('c',16)
190
191 #define CDIOCSETDEBUG   _IO('c',17)
192
193 #define CDIOCCLRDEBUG   _IO('c',18)
194
195 #define CDIOCPAUSE      _IO('c',19)
196
197 #define CDIOCRESUME     _IO('c',20)
198
199 #define CDIOCRESET      _IO('c',21)
200
201 #define CDIOCSTART      _IO('c',22)
202
203 #define CDIOCSTOP       _IO('c',23)
204
205 #define CDIOCEJECT      _IO('c',24)
206
207
208 struct ioc_play_msf {
209         u_char  start_m;
210         u_char  start_s;
211         u_char  start_f;
212         u_char  end_m;
213         u_char  end_s;
214         u_char  end_f;
215 };
216 #define CDIOCPLAYMSF    _IOW('c',25,struct ioc_play_msf)
217
218 #define CDIOCALLOW      _IO('c',26)
219
220 #define CDIOCPREVENT    _IO('c',27)
221
222                                 /*<1>For drives that support it, this*/
223                                 /*<1>causes the drive to close its door*/
224                                 /*<1>and make the media (if any) ready*/
225 #define CDIOCCLOSE      _IO('c',28)     /*<1>*/
226
227
228 struct ioc_pitch {              /*<1>For drives that support it, this*/
229                                 /*<1>call instructs the drive to play the*/
230         short   speed;          /*<1>audio at a faster or slower-than-normal*/
231 };                              /*<1>rate. -32767 to -1 is slower, 0==normal,*/
232                                 /*<1>and 1 to 32767 is faster.  LSB bits are*/
233                                 /*<1>discarded first by drives with less res.*/
234 #define CDIOCPITCH      _IOW('c',29,struct ioc_pitch)   /*<1>*/
235
236 struct ioc_capability {                 /*<2>*/
237         u_long  play_function;          /*<2>*/
238 #define CDDOPLAYTRK     0x00000001      /*<2>Can Play tracks/index*/
239 #define CDDOPLAYMSF     0x00000002      /*<2>Can Play msf to msf*/
240 #define CDDOPLAYBLOCKS  0x00000004      /*<2>Can Play range of blocks*/
241 #define CDDOPAUSE       0x00000100      /*<2>Output can be paused*/
242 #define CDDORESUME      0x00000200      /*<2>Output can be resumed*/
243 #define CDDORESET       0x00000400      /*<2>Drive can be completely reset*/
244 #define CDDOSTART       0x00000800      /*<2>Audio can be started*/
245 #define CDDOSTOP        0x00001000      /*<2>Audio can be stopped*/
246 #define CDDOPITCH       0x00002000      /*<2>Audio pitch */
247
248         u_long  routing_function;       /*<2>*/
249 #define CDREADVOLUME    0x00000001      /*<2>Volume settings can be read*/
250 #define CDSETVOLUME     0x00000002      /*<2>Volume settings can be set*/
251 #define CDSETMONO       0x00000100      /*<2>Output can be set to mono*/
252 #define CDSETSTEREO     0x00000200      /*<2>Output can be set to stereo (def)*/
253 #define CDSETLEFT       0x00000400      /*<2>Output can be set to left only*/
254 #define CDSETRIGHT      0x00000800      /*<2>Output can be set to right only*/
255 #define CDSETMUTE       0x00001000      /*<2>Output can be muted*/
256 #define CDSETPATCH      0x00008000      /*<2>Direct routing control allowed*/
257
258         u_long  special_function;       /*<2>*/
259 #define CDDOEJECT       0x00000001      /*<2>The tray can be opened*/
260 #define CDDOCLOSE       0x00000002      /*<2>The tray can be closed*/
261 #define CDDOLOCK        0x00000004      /*<2>The tray can be locked*/
262 #define CDREADHEADER    0x00000100      /*<2>Can read Table of Contents*/
263 #define CDREADENTRIES   0x00000200      /*<2>Can read TOC Entries*/
264 #define CDREADSUBQ      0x00000200      /*<2>Can read Subchannel info*/
265 #define CDREADRW        0x00000400      /*<2>Can read subcodes R-W*/
266 #define CDHASDEBUG      0x00004000      /*<2>The tray has dynamic debugging*/
267 };                                      /*<2>*/
268
269 #define CDIOCCAPABILITY _IOR('c',30,struct ioc_capability)      /*<2>*/
270
271 struct ioc_read_audio {
272         u_char address_format;
273         union msf_lba address;
274         int nframes;
275         u_char* buffer;
276 };
277
278 #define CDIOCREADAUDIO _IOWR('c',31,struct ioc_read_audio)
279
280 #endif /* !_SYS_CDIO_H_ */