xref: /386bsd/usr/src/kernel/include/dev/cdio.h (revision a2142627)
1 /*
2  * 16 Feb 93	Julian Elischer	(julian@dialix.oz.au)
3  *
4  *	$Id$
5  */
6 /* Shared between kernel & process */
7 #ifndef SYS_CDIO_H
8 #define SYS_CDIO_H
9 
10 struct cd_toc_entry {
11 	u_char	:8;
12 	u_char	control:4;
13 	u_char	addr_type:4;
14 	u_char  track;
15 	u_char	:8;
16 	u_char	addr[4];
17 };
18 
19 struct cd_sub_channel_header {
20 	u_char	:8;
21 	u_char	audio_status;
22 #define CD_AS_AUDIO_INVALID        0x00
23 #define CD_AS_PLAY_IN_PROGRESS     0x11
24 #define CD_AS_PLAY_PAUSED          0x12
25 #define CD_AS_PLAY_COMPLETED       0x13
26 #define CD_AS_PLAY_ERROR           0x14
27 #define CD_AS_NO_STATUS            0x15
28 	u_char	data_len[2];
29 };
30 
31 struct cd_sub_channel_position_data {
32 	u_char	data_format;
33 	u_char	control:4;
34 	u_char	addr_type:4;
35 	u_char	track_number;
36 	u_char	index_number;
37 	u_char	absaddr[4];
38 	u_char	reladdr[4];
39 };
40 
41 struct cd_sub_channel_media_catalog {
42         u_char  data_format;
43         u_char  :8;
44         u_char  :8;
45         u_char  :8;
46         u_char  :7;
47         u_char  mc_valid:1;
48         u_char  mc_number[15];
49 };
50 
51 struct cd_sub_channel_track_info {
52         u_char  data_format;
53         u_char  :8;
54         u_char  track_number;
55         u_char  :8;
56         u_char  :7;
57         u_char  ti_valid:1;
58         u_char  ti_number[15];
59 };
60 
61 struct cd_sub_channel_info {
62 	struct cd_sub_channel_header header;
63 	union {
64 		struct cd_sub_channel_position_data position;
65 		struct cd_sub_channel_media_catalog media_catalog;
66 		struct cd_sub_channel_track_info track_info;
67 	} what;
68 };
69 
70 /***************************************************************\
71 * Ioctls for the CD drive					*
72 \***************************************************************/
73 struct ioc_play_track
74 {
75 	u_char	start_track;
76 	u_char	start_index;
77 	u_char	end_track;
78 	u_char	end_index;
79 };
80 
81 #define	CDIOCPLAYTRACKS	_IOW('c',1,struct ioc_play_track)
82 struct ioc_play_blocks
83 {
84 	int	blk;
85 	int	len;
86 };
87 #define	CDIOCPLAYBLOCKS	_IOW('c',2,struct ioc_play_blocks)
88 
89 struct ioc_read_subchannel {
90 	u_char address_format;
91 #define CD_LBA_FORMAT	1
92 #define CD_MSF_FORMAT	2
93 	u_char data_format;
94 #define CD_SUBQ_DATA		0
95 #define CD_CURRENT_POSITION	1
96 #define CD_MEDIA_CATALOG	2
97 #define CD_TRACK_INFO		3
98 	u_char track;
99 	int	data_len;
100 	struct  cd_sub_channel_info *data;
101 };
102 #define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel )
103 
104 
105 struct ioc_toc_header {
106 	u_short len;
107 	u_char  starting_track;
108 	u_char  ending_track;
109 };
110 
111 #define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header)
112 
113 struct ioc_read_toc_entry {
114 	u_char	address_format;
115 	u_char	starting_track;
116 	u_short	data_len;
117 	struct  cd_toc_entry *data;
118 };
119 #define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry)
120 
121 struct	ioc_patch
122 {
123 	u_char	patch[4];	/* one for each channel */
124 };
125 #define	CDIOCSETPATCH	_IOW('c',9,struct ioc_patch)
126 struct	ioc_vol
127 {
128 	u_char	vol[4];	/* one for each channel */
129 };
130 #define	CDIOCGETVOL	_IOR('c',10,struct ioc_vol)
131 #define	CDIOCSETVOL	_IOW('c',11,struct ioc_vol)
132 #define	CDIOCSETMONO	_IO('c',12)
133 #define	CDIOCSETSTERIO	_IO('c',13)
134 #define	CDIOCSETMUTE	_IO('c',14)
135 #define	CDIOCSETLEFT	_IO('c',15)
136 #define	CDIOCSETRIGHT	_IO('c',16)
137 #define	CDIOCSETDEBUG	_IO('c',17)
138 #define	CDIOCCLRDEBUG	_IO('c',18)
139 #define	CDIOCPAUSE	_IO('c',19)
140 #define	CDIOCRESUME	_IO('c',20)
141 #define	CDIOCRESET	_IO('c',21)
142 #define	CDIOCSTART	_IO('c',22)
143 #define	CDIOCSTOP	_IO('c',23)
144 #define	CDIOCEJECT	_IO('c',24)
145 
146 struct ioc_play_msf
147 {
148 	u_char	start_m;
149 	u_char	start_s;
150 	u_char	start_f;
151 	u_char	end_m;
152 	u_char	end_s;
153 	u_char	end_f;
154 };
155 #define	CDIOCPLAYMSF	_IOW('c',25,struct ioc_play_msf)
156 
157 
158 
159 #endif /* SYS_CDIO_H */
160