1/* $NetBSD: linux_cdrom.h,v 1.8 2008/04/28 20:23:43 martin Exp $ */
2
3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Eric Haszlakiewicz.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _LINUX_CDROM_H
33#define _LINUX_CDROM_H
34
35#include <machine/endian.h>
36
37#define LINUX_CDROMPAUSE 0x5301
38#define LINUX_CDROMRESUME 0x5302
39#define LINUX_CDROMPLAYMSF 0x5303 /* (struct linux_cdrom_msf) */
40#define LINUX_CDROMPLAYTRKIND 0x5304 /* (struct linux_cdrom_ti) */
41#define LINUX_CDROMREADTOCHDR 0x5305 /* (struct linux_cdrom_tochdr) */
42#define LINUX_CDROMREADTOCENTRY 0x5306 /* (struct linux_cdrom_tocentry) */
43#define LINUX_CDROMSTOP 0x5307
44#define LINUX_CDROMSTART 0x5308
45#define LINUX_CDROMEJECT 0x5309
46#define LINUX_CDROMVOLCTRL 0x530a /* (struct linux_cdrom_volctrl) */
47#define LINUX_CDROMSUBCHNL 0x530b /* (struct linux_cdrom_subchnl) */
48#define LINUX_CDROMEJECT_SW 0x530f /* arg: 0 or 1 */
49#define LINUX_CDROMMULTISESSION 0x5310 /* (struct linux_cdrom_multisession) */
50#define LINUX_CDROMRESET 0x5312
51#define LINUX_CDROMVOLREAD 0x5313 /* (struct linux_cdrom_volctrl) */
52#define LINUX_CDROMPLAYBLK 0x5317 /* (struct linux_cdrom_blk) */
53#define LINUX_CDROMCLOSETRAY 0x5319 /* */
54#define LINUX_CDROM_SET_OPTIONS 0x5320 /* int */
55#define LINUX_CDROM_CLEAR_OPTIONS 0x5321 /* int */
56#define LINUX_CDROM_SELECT_SPEED 0x5322
57#define LINUX_CDROM_SELECT_DISC 0x5323
58#define LINUX_CDROM_MEDIA_CHANGED 0x5325
59#define LINUX_CDROM_DRIVE_STATUS 0x5326
60#define LINUX_CDROM_DISC_STATUS 0x5327
61#define LINUX_CDROM_CHANGER_NSLOTS 0x5328
62#define LINUX_CDROM_LOCKDOOR 0x5329
63#define LINUX_CDROM_DEBUG 0x5330
64#define LINUX_CDROM_GET_CAPABILITY 0x5331
65
66/* DVD-ROM Specific ioctls */
67#define LINUX_DVD_READ_STRUCT 0x5390 /* Read structure */
68#define LINUX_DVD_WRITE_STRUCT 0x5391 /* Write structure */
69#define LINUX_DVD_AUTH 0x5392 /* Authentication */
70
71struct linux_cdrom_blk {
72 unsigned from;
73 unsigned short len;
74};
75
76struct linux_cdrom_msf {
77 u_char cdmsf_min0; /* start minute */
78 u_char cdmsf_sec0; /* start second */
79 u_char cdmsf_frame0; /* start frame */
80 u_char cdmsf_min1; /* end minute */
81 u_char cdmsf_sec1; /* end second */
82 u_char cdmsf_frame1; /* end frame */
83};
84
85struct linux_cdrom_ti {
86 u_char cdti_trk0; /* start track */
87 u_char cdti_ind0; /* start index */
88 u_char cdti_trk1; /* end track */
89 u_char cdti_ind1; /* end index */
90};
91
92struct linux_cdrom_tochdr {
93 u_char cdth_trk0; /* start track */
94 u_char cdth_trk1; /* end track */
95};
96
97struct linux_cdrom_msf0 {
98 u_char minute;
99 u_char second;
100 u_char frame;
101};
102
103union linux_cdrom_addr {
104 struct linux_cdrom_msf0 msf;
105 int lba;
106};
107
108struct linux_cdrom_tocentry {
109 u_char cdte_track;
110 u_char cdte_adr :4;
111 u_char cdte_ctrl :4;
112 u_char cdte_format;
113 union linux_cdrom_addr cdte_addr;
114 u_char cdte_datamode;
115};
116
117struct linux_cdrom_subchnl {
118 u_char cdsc_format;
119 u_char cdsc_audiostatus;
120 u_char cdsc_adr: 4;
121 u_char cdsc_ctrl: 4;
122 u_char cdsc_trk;
123 u_char cdsc_ind;
124 union linux_cdrom_addr cdsc_absaddr;
125 union linux_cdrom_addr cdsc_reladdr;
126};
127
128struct linux_cdrom_volctrl {
129 u_char channel0;
130 u_char channel1;
131 u_char channel2;
132 u_char channel3;
133};
134
135struct linux_cdrom_multisession {
136 union linux_cdrom_addr addr;
137 u_char xa_flag;
138 u_char addr_format;
139};
140
141struct linux_cdrom_mechstat_header {
142#if BYTE_ORDER == BIG_ENDIAN
143 u_int8_t fault : 1;
144 u_int8_t changer_state : 2;
145 u_int8_t curslot : 5;
146 u_int8_t mech_state : 3;
147 u_int8_t door_open : 1;
148 u_int8_t reserved1 : 4;
149#elif BYTE_ORDER == LITTLE_ENDIAN
150 u_int8_t curslot : 5;
151 u_int8_t changer_state : 2;
152 u_int8_t fault : 1;
153 u_int8_t reserved1 : 4;
154 u_int8_t door_open : 1;
155 u_int8_t mech_state : 3;
156#endif
157 u_int8_t curlba[3];
158 u_int8_t nslots;
159 u_int16_t slot_tablelen;
160};
161
162struct linux_cdrom_slot {
163#if BYTE_ORDER == BIG_ENDIAN
164 u_int8_t disc_present : 1;
165 u_int8_t reserved1 : 6;
166 u_int8_t change : 1;
167#elif BYTE_ORDER == LITTLE_ENDIAN
168 u_int8_t change : 1;
169 u_int8_t reserved1 : 6;
170 u_int8_t disc_present : 1;
171#endif
172 u_int8_t reserved2[3];
173};
174
175#define LINUX_CDROM_MAX_SLOTS 256
176
177struct linux_cdrom_changer_info {
178 struct linux_cdrom_mechstat_header hdr;
179 struct linux_cdrom_slot slots[LINUX_CDROM_MAX_SLOTS];
180};
181
182#endif /* !_LINUX_CDROM_H */
183