1 .\" $NetBSD: cd.4,v 1.16 2001/09/12 18:19:16 wiz Exp $
4 .\" Julian Elischer <julian@freebsd.org>. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd SCSI and ATAPI CD-ROM driver
35 .Cd "cd* at scsibus? target ? lun ?"
36 .Cd "cd1 at scsibus0 target 4 lun 0"
37 .Cd "cd* at atapibus? drive ? flags 0x0000"
41 driver provides support for a Small Computer Systems Interface
43 bus and Advanced Technology Attachment Packet Interface
45 Compact Disc-Read Only Memory
48 In an attempt to look like a regular disk, the
50 driver synthesizes a partition table, with one partition covering the entire
52 It is possible to modify this partition table using
54 but it will only last until the
57 In general the interfaces are similar to those described by
64 adapter is probed during boot, the
66 bus is scanned for devices.
67 Any devices found which answer as `Read-only'
68 type devices will be `attached' to the
72 For the use of flags with ATAPI devices, see
77 may be used to read the synthesized
79 structure, which will contain correct figures for the size of the
81 should that information be required.
82 .Sh KERNEL CONFIGURATION
85 devices may be attached to the system regardless of system
86 configuration as all resources are dynamically allocated.
97 .Aq Pa sys/disklabel.h .
99 .Bl -tag -width CDIOCREADSUBCHANNEL
102 .Pq Li "struct disklabel"
103 Read or write the in-core copy of the disklabel for the
105 The disklabel is initialized with information
108 inquiry commands, and should be the same as
109 the information printed at boot.
110 This structure is defined in
112 .\".It Dv CDIOCCAPABILITY
113 .\".Pq Li "struct ioc_capability"
114 .\"Retrieve information from the drive on what features it supports.
115 .\"The information is returned in the following structure:
116 .\".Bd -literal -offset indent
117 .\"struct ioc_capability {
118 .\" u_long play_function;
119 .\"#define CDDOPLAYTRK 0x00000001
120 .\" /* Can play tracks/index */
121 .\"#define CDDOPLAYMSF 0x00000002
122 .\" /* Can play msf to msf */
123 .\"#define CDDOPLAYBLOCKS 0x00000004
124 .\" /* Can play range of blocks */
125 .\"#define CDDOPAUSE 0x00000100
126 .\" /* Output can be paused */
127 .\"#define CDDORESUME 0x00000200
128 .\" /* Output can be resumed */
129 .\"#define CDDORESET 0x00000400
130 .\" /* Drive can be completely reset */
131 .\"#define CDDOSTART 0x00000800
132 .\" /* Audio can be started */
133 .\"#define CDDOSTOP 0x00001000
134 .\" /* Audio can be stopped */
135 .\"#define CDDOPITCH 0x00002000
136 .\" /* Audio pitch can be changed */
138 .\" u_long routing_function;
139 .\"#define CDREADVOLUME 0x00000001
140 .\" /* Volume settings can be read */
141 .\"#define CDSETVOLUME 0x00000002
142 .\" /* Volume settings can be set */
143 .\"#define CDSETMONO 0x00000100
144 .\" /* Output can be set to mono */
145 .\"#define CDSETSTEREO 0x00000200
146 .\" /* Output can be set to stereo (def) */
147 .\"#define CDSETLEFT 0x00000400
148 .\" /* Output can be set to left only */
149 .\"#define CDSETRIGHT 0x00000800
150 .\" /* Output can be set to right only */
151 .\"#define CDSETMUTE 0x00001000
152 .\" /* Output can be muted */
153 .\"#define CDSETPATCH 0x00008000
154 .\" /* Direct routing control allowed */
156 .\" u_long special_function;
157 .\"#define CDDOEJECT 0x00000001
158 .\" /* The tray can be opened */
159 .\"#define CDDOCLOSE 0x00000002
160 .\" /* The tray can be closed */
161 .\"#define CDDOLOCK 0x00000004
162 .\" /* The tray can be locked */
163 .\"#define CDREADHEADER 0x00000100
164 .\" /* Can read Table of Contents */
165 .\"#define CDREADENTRIES 0x00000200
166 .\" /* Can read TOC Entries */
167 .\"#define CDREADSUBQ 0x00000200
168 .\" /* Can read Subchannel info */
169 .\"#define CDREADRW 0x00000400
170 .\" /* Can read subcodes R-W */
171 .\"#define CDHASDEBUG 0x00004000
172 .\" /* The tray has dynamic debugging */
175 .It Dv CDIOCPLAYTRACKS
176 .Pq Li "struct ioc_play_track"
177 Start audio playback given a track address and length.
178 The structure is defined as follows:
179 .Bd -literal -offset indent
180 struct ioc_play_track
188 .It Dv CDIOCPLAYBLOCKS
189 .Pq Li "struct ioc_play_blocks"
190 Start audio playback given a block address and length.
191 The structure is defined as follows:
192 .Bd -literal -offset indent
193 struct ioc_play_blocks
200 .Pq Li "struct ioc_play_msf"
201 Start audio playback given a `minutes-seconds-frames' address and length.
202 The structure is defined as follows:
203 .Bd -literal -offset indent
214 .It Dv CDIOCREADSUBCHANNEL
215 .Pq Li "struct ioc_read_subchannel"
216 Read information from the subchannel at the location specified by this
218 .Bd -literal -offset indent
219 struct ioc_read_subchannel {
220 u_char address_format;
221 #define CD_LBA_FORMAT 1
222 #define CD_MSF_FORMAT 2
224 #define CD_SUBQ_DATA 0
225 #define CD_CURRENT_POSITION 1
226 #define CD_MEDIA_CATALOG 2
227 #define CD_TRACK_INFO 3
230 struct cd_sub_channel_info *data;
233 .It Dv CDIOREADTOCHEADER
234 .Pq Li "struct ioc_toc_header"
235 Return summary information about the table of contents for the mounted
237 The information is returned into the following structure:
238 .Bd -literal -offset indent
239 struct ioc_toc_header {
241 u_char starting_track;
245 .It Dv CDIOREADTOCENTRYS
246 .Pq Li "struct ioc_read_toc_entry"
247 Return information from the table of contents entries mentioned.
248 (Yes, this command name is misspelled).
249 The argument structure is defined as follows:
250 .Bd -literal -offset indent
251 struct ioc_read_toc_entry {
252 u_char address_format;
253 u_char starting_track;
255 struct cd_toc_entry *data;
258 The requested data is written into an area of size
263 .Pq Li "struct ioc_patch"
264 Attach various audio channels to various output channels.
265 The argument structure is defined thusly:
266 .Bd -literal -offset indent
269 /* one for each channel */
274 .Pq Li "struct ioc_vol"
275 Get (set) information about the volume settings of the output channels.
276 The argument structure is as follows:
277 .Bd -literal -offset indent
281 /* one for each channel */
285 Patch all output channels to all source channels.
286 .It Dv CDIOCSETSTEREO
287 Patch left source channel to the left output channel and the right
288 source channel to the right output channel.
290 Mute output without changing the volume settings.
293 Attach both output channels to the left (right) source channel.
296 Turn on (off) debugging for the appropriate device.
299 Pause (resume) audio play, without resetting the location of the read-head.
304 Tell the drive to spin-up (-down) the
308 Tell the drive to allow (prevent) manual ejection of the
311 Not all drives support this feature.
315 .It Dv CDIOCLOADUNLOAD
316 Cause the ATAPI changer to load or unload discs.
318 Tell the drive to close its door and load the media.
319 Not all drives support this feature.
322 .\".Pq Li "struct ioc_pitch"
323 .\"For drives that support it, this command instructs the drive to play
324 .\"the audio at a faster or slower rate than normal.
327 .\"between -32767 and -1 result in slower playback; a zero value
328 .\"indicates normal speed; and values from 1 to 32767 give faster playback.
329 .\"Drives with less than 16 bits of resolution will silently
330 .\"ignore less-significant bits.
331 .\"The structure is defined thusly:
332 .\".Bd -literal -offset indent
340 In addition the general
342 ioctls may be used with the
344 driver, if used against the `whole disk' partition (i.e.
346 for the bebox and i386 port,
348 for all other ports).
352 is changed in a drive controlled by the
354 driver, then the act of changing the media will invalidate the
355 disklabel and information held within the kernel.
356 To stop corruption, all accesses to the device will be discarded
357 until there are no more open file descriptors referencing the device.
358 During this period, all new open attempts will be rejected.
359 When no more open file descriptors reference the device, the first
360 next open will load a new set of parameters (including disklabel)
363 The audio code in the
367 standard audio commands.
370 manufacturers have not followed the standard, there are many
372 drives for which audio will not work.
373 Some work is planned to support some of the more common `broken'
375 drives; however, this is not yet under way.
377 .Bl -tag -width /dev/rcd[0-9][a-h] -compact
378 .It Pa /dev/cd[0-9][a-h]
382 .It Pa /dev/rcd[0-9][a-h]
402 The names of the structures used for the third argument to
404 were poorly chosen, and a number of spelling errors have survived in