1 /*
2  *   libdi - CD Audio Device Interface Library
3  *
4  *   Copyright (C) 1993-2004  Ti Kan
5  *   E-mail: xmcd@amb.org
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 #ifndef __SLIOC_H__
22 #define __SLIOC_H__
23 
24 #if defined(DI_SLIOC) && !defined(DEMO_ONLY)
25 
26 #ifndef lint
27 static char *_slioc_h_ident_ = "@(#)slioc.h	6.39 04/01/14";
28 #endif
29 
30 /*
31  * Linux specific definitions
32  */
33 #ifdef _LINUX
34 
35 #include <linux/cdrom.h>
36 
37 /* older Linux systems don't define this */
38 #ifndef CDROMCLOSETRAY
39 #define CDROMCLOSETRAY		0x5319
40 #endif
41 #ifndef CDROM_DATA_TRACK
42 #define CDROM_DATA_TRACK	0x04
43 #endif
44 
45 
46 /* CD changer support */
47 #ifdef USE_UCDROM_H
48 
49 #include <linux/ucdrom.h>
50 
51 #else
52 
53 /* ioctl services */
54 #define CDROM_SELECT_DISC	0x5323
55 #define CDROM_MEDIA_CHANGED	0x5325
56 #define CDROM_DRIVE_STATUS	0x5326
57 #define CDROM_CHANGER_NSLOTS	0x5328
58 
59 /* CDROM_DRIVE_STATUS arg: denote current disc */
60 #define CDSL_CURRENT		((int) (~0U>>1))
61 
62 /* CDROM_DRIVE_STATUS return */
63 #define CDS_NO_INFO		0
64 #define CDS_NO_DISC		1
65 #define CDS_TRAY_OPEN		2
66 #define CDS_DRIVE_NOT_READY	3
67 #define CDS_DISC_OK		4
68 
69 #endif	/* USE_UCDROM_H */
70 
71 #endif	/* _LINUX */
72 
73 
74 /*
75  * SunOS 4.x specific definitions
76  */
77 #ifdef _SUNOS4
78 
79 #include <sys/buf.h>
80 #include <sun/dkio.h>
81 #include <scsi/targets/srdef.h>
82 
83 /* This is a hack to work around a bug in SunOS 4.x's _IO macro family
84  * in <sys/ioccom.h> which makes it incompatible with ANSI compilers.
85  * If Sun ever changes the definition of these then this will have
86  * to change...
87  */
88 #undef _IO
89 #undef _IOR
90 #undef _IOW
91 #undef _IOWR
92 #undef CDROMPAUSE
93 #undef CDROMRESUME
94 #undef CDROMPLAYMSF
95 #undef CDROMPLAYTRKIND
96 #undef CDROMREADTOCHDR
97 #undef CDROMREADTOCENTRY
98 #undef CDROMSTOP
99 #undef CDROMSTART
100 #undef CDROMEJECT
101 #undef CDROMVOLCTRL
102 #undef CDROMSUBCHNL
103 
104 #define _IO(x,y)	(_IOC_VOID | ((x) << 8) | (y))
105 #define _IOR(x,y,t)	( \
106 				_IOC_OUT | \
107 				((sizeof(t) & _IOCPARM_MASK) << 16) | \
108 				((x) << 8 ) | (y) \
109 			)
110 #define _IOW(x,y,t)	( \
111 				_IOC_IN | \
112 				((sizeof(t) & _IOCPARM_MASK) << 16) | \
113 				((x) << 8) | (y) \
114 			)
115 #define _IOWR(x,y,t)	( \
116 				_IOC_INOUT | \
117 				((sizeof(t) & _IOCPARM_MASK) << 16) | \
118 				((x) << 8) | (y) \
119 			)
120 
121 #define CDROMPAUSE		_IO('c', 10)
122 #define CDROMRESUME		_IO('c', 11)
123 #define CDROMPLAYMSF		_IOW('c', 12, struct cdrom_msf)
124 #define CDROMPLAYTRKIND		_IOW('c', 13, struct cdrom_ti)
125 #define CDROMREADTOCHDR		_IOR('c', 103, struct cdrom_tochdr)
126 #define CDROMREADTOCENTRY	_IOWR('c', 104, struct cdrom_tocentry)
127 #define CDROMSTOP		_IO('c', 105)
128 #define CDROMSTART		_IO('c', 106)
129 #define CDROMEJECT		_IO('c', 107)
130 #define CDROMVOLCTRL		_IOW('c', 14, struct cdrom_volctrl)
131 #define CDROMSUBCHNL		_IOWR('c', 108, struct cdrom_subchnl)
132 
133 #endif	/* _SUNOS4 */
134 
135 
136 /*
137  * SunOS 5.x (Solaris) specific definitions
138  */
139 #ifdef _SOLARIS
140 
141 #include <sys/cdio.h>
142 
143 #ifndef SOL2_VOLMGT
144 #define SOL2_VOLMGT		/* Enable Solaris Vol Mgr support */
145 #endif
146 
147 #endif	/* _SOLARIS */
148 
149 
150 /*
151  * QNX specific definitions
152  */
153 #ifdef __QNX__
154 #include <sys/qioctl.h>
155 #include <sys/cdrom.h>
156 #endif
157 
158 
159 /* Ioctl name lookup table structure */
160 typedef struct {
161 	int	cmd;
162 	char	*name;
163 } iocname_t;
164 
165 
166 /*
167  * Public functions
168  */
169 extern void	slioc_enable(int);
170 extern void	slioc_disable(int);
171 extern bool_t	slioc_is_enabled(int);
172 extern bool_t	slioc_send(int, int, void *, size_t, bool_t, int *);
173 extern void	slioc_init(curstat_t *, di_tbl_t *);
174 extern bool_t	slioc_playmode(curstat_t *);
175 extern bool_t	slioc_check_disc(curstat_t *);
176 extern void	slioc_status_upd(curstat_t *);
177 extern void	slioc_lock(curstat_t *, bool_t);
178 extern void	slioc_repeat(curstat_t *, bool_t);
179 extern void	slioc_shuffle(curstat_t *, bool_t);
180 extern void	slioc_load_eject(curstat_t *);
181 extern void	slioc_ab(curstat_t *);
182 extern void	slioc_sample(curstat_t *);
183 extern void	slioc_level(curstat_t *, byte_t, bool_t);
184 extern void	slioc_play_pause(curstat_t *);
185 extern void	slioc_stop(curstat_t *, bool_t);
186 extern void	slioc_chgdisc(curstat_t *);
187 extern void	slioc_prevtrk(curstat_t *);
188 extern void	slioc_nexttrk(curstat_t *);
189 extern void	slioc_previdx(curstat_t *);
190 extern void	slioc_nextidx(curstat_t *);
191 extern void	slioc_rew(curstat_t *, bool_t);
192 extern void	slioc_ff(curstat_t *, bool_t);
193 extern void	slioc_warp(curstat_t *);
194 extern void	slioc_route(curstat_t *);
195 extern void	slioc_mute_on(curstat_t *);
196 extern void	slioc_mute_off(curstat_t *);
197 extern void	slioc_cddajitter(curstat_t *);
198 extern void	slioc_debug(void);
199 extern void	slioc_start(curstat_t *);
200 extern void	slioc_icon(curstat_t *, bool_t);
201 extern void	slioc_halt(curstat_t *);
202 extern char	*slioc_methodstr(void);
203 
204 #else	/* DI_SLIOC DEMO_ONLY */
205 
206 #define slioc_init	NULL
207 
208 #endif	/* DI_SLIOC DEMO_ONLY */
209 
210 #endif	/* __SLIOC_H__ */
211 
212