2 * 16 Feb 93 Julian Elischer (julian@dialix.oz.au)
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
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
24 /* Shared between kernel & process */
30 #include <sys/types.h>
32 #include <sys/ioccom.h>
41 int lba; /* network byte order */
54 struct cd_sub_channel_header {
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
66 struct cd_sub_channel_position_data {
72 union msf_lba absaddr;
73 union msf_lba reladdr;
76 struct cd_sub_channel_media_catalog {
86 struct cd_sub_channel_track_info {
96 struct cd_sub_channel_info {
97 struct cd_sub_channel_header header;
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;
106 /***************************************************************\
107 * Ioctls for the CD drive *
108 \***************************************************************/
110 struct ioc_play_track
117 #define CDIOCPLAYTRACKS _IOW('c',1,struct ioc_play_track)
120 struct ioc_play_blocks
125 #define CDIOCPLAYBLOCKS _IOW('c',2,struct ioc_play_blocks)
128 struct ioc_read_subchannel {
129 u_char address_format;
130 #define CD_LBA_FORMAT 1
131 #define CD_MSF_FORMAT 2
133 #define CD_SUBQ_DATA 0
134 #define CD_CURRENT_POSITION 1
135 #define CD_MEDIA_CATALOG 2
136 #define CD_TRACK_INFO 3
139 struct cd_sub_channel_info *data;
141 #define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel )
144 struct ioc_toc_header {
146 u_char starting_track;
149 #define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header)
152 struct ioc_read_toc_entry {
153 u_char address_format;
154 u_char starting_track;
156 struct cd_toc_entry *data;
158 #define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry)
161 struct ioc_read_toc_single_entry {
162 u_char address_format;
164 struct cd_toc_entry entry;
166 #define CDIOREADTOCENTRY _IOWR('c',6,struct ioc_read_toc_single_entry)
171 u_char patch[4]; /* one for each channel */
173 #define CDIOCSETPATCH _IOW('c',9,struct ioc_patch)
178 u_char vol[4]; /* one for each channel */
180 #define CDIOCGETVOL _IOR('c',10,struct ioc_vol)
182 #define CDIOCSETVOL _IOW('c',11,struct ioc_vol)
184 #define CDIOCSETMONO _IO('c',12)
186 #define CDIOCSETSTERIO _IO('c',13)
187 #define CDIOCSETSTEREO _IO('c',13)
189 #define CDIOCSETMUTE _IO('c',14)
191 #define CDIOCSETLEFT _IO('c',15)
193 #define CDIOCSETRIGHT _IO('c',16)
195 #define CDIOCSETDEBUG _IO('c',17)
197 #define CDIOCCLRDEBUG _IO('c',18)
199 #define CDIOCPAUSE _IO('c',19)
201 #define CDIOCRESUME _IO('c',20)
203 #define CDIOCRESET _IO('c',21)
205 #define CDIOCSTART _IO('c',22)
207 #define CDIOCSTOP _IO('c',23)
209 #define CDIOCEJECT _IO('c',24)
221 #define CDIOCPLAYMSF _IOW('c',25,struct ioc_play_msf)
223 #define CDIOCALLOW _IO('c',26)
225 #define CDIOCPREVENT _IO('c',27)
227 /*<1>For drives that support it, this*/
228 /*<1>causes the drive to close its door*/
229 /*<1>and make the media (if any) ready*/
230 #define CDIOCCLOSE _IO('c',28) /*<1>*/
233 struct ioc_pitch /*<1>For drives that support it, this*/
234 { /*<1>call instructs the drive to play the*/
235 short speed; /*<1>audio at a faster or slower-than-normal*/
236 }; /*<1>rate. -32767 to -1 is slower, 0==normal,*/
237 /*<1>and 1 to 32767 is faster. LSB bits are*/
238 /*<1>discarded first by drives with less res.*/
239 #define CDIOCPITCH _IOW('c',29,struct ioc_pitch) /*<1>*/
241 struct ioc_capability { /*<2>*/
242 u_long play_function; /*<2>*/
243 #define CDDOPLAYTRK 0x00000001 /*<2>Can Play tracks/index*/
244 #define CDDOPLAYMSF 0x00000002 /*<2>Can Play msf to msf*/
245 #define CDDOPLAYBLOCKS 0x00000004 /*<2>Can Play range of blocks*/
246 #define CDDOPAUSE 0x00000100 /*<2>Output can be paused*/
247 #define CDDORESUME 0x00000200 /*<2>Output can be resumed*/
248 #define CDDORESET 0x00000400 /*<2>Drive can be completely reset*/
249 #define CDDOSTART 0x00000800 /*<2>Audio can be started*/
250 #define CDDOSTOP 0x00001000 /*<2>Audio can be stopped*/
251 #define CDDOPITCH 0x00002000 /*<2>Audio pitch */
253 u_long routing_function; /*<2>*/
254 #define CDREADVOLUME 0x00000001 /*<2>Volume settings can be read*/
255 #define CDSETVOLUME 0x00000002 /*<2>Volume settings can be set*/
256 #define CDSETMONO 0x00000100 /*<2>Output can be set to mono*/
257 #define CDSETSTEREO 0x00000200 /*<2>Output can be set to stereo (def)*/
258 #define CDSETLEFT 0x00000400 /*<2>Output can be set to left only*/
259 #define CDSETRIGHT 0x00000800 /*<2>Output can be set to right only*/
260 #define CDSETMUTE 0x00001000 /*<2>Output can be muted*/
261 #define CDSETPATCH 0x00008000 /*<2>Direct routing control allowed*/
263 u_long special_function; /*<2>*/
264 #define CDDOEJECT 0x00000001 /*<2>The tray can be opened*/
265 #define CDDOCLOSE 0x00000002 /*<2>The tray can be closed*/
266 #define CDDOLOCK 0x00000004 /*<2>The tray can be locked*/
267 #define CDREADHEADER 0x00000100 /*<2>Can read Table of Contents*/
268 #define CDREADENTRIES 0x00000200 /*<2>Can read TOC Entries*/
269 #define CDREADSUBQ 0x00000200 /*<2>Can read Subchannel info*/
270 #define CDREADRW 0x00000400 /*<2>Can read subcodes R-W*/
271 #define CDHASDEBUG 0x00004000 /*<2>The tray has dynamic debugging*/
274 #define CDIOCCAPABILITY _IOR('c',30,struct ioc_capability) /*<2>*/
276 struct ioc_read_audio
278 u_char address_format;
279 union msf_lba address;
284 #define CDIOCREADAUDIO _IOWR('c',31,struct ioc_read_audio)
286 #endif /* !_SYS_CDIO_H_ */