rename the top-level Makefile.cfgparam to cfgparam.mk
[unleashed.git] / share / man / man7i / cdio.7i
blob5a10b12bb755f4150eb691842751063fe65272fe
1 '\" te
2 .\"  Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CDIO 7I "Oct 4, 2001"
7 .SH NAME
8 cdio \- CD-ROM control operations
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB#include <sys/cdio.h>\fR
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 The set of \fBioctl\fR(2) commands described below are used to perform audio
19 and \fBCD-ROM\fR specific operations. Basic to these \fBcdio\fR ioctl requests
20 are the definitions in \fB<sys/cdio.h>\fR\&.
21 .sp
22 .LP
23 Several \fBCD-ROM\fR specific commands can report addresses either in \fBLBA\fR
24 (Logical Block Address) format or in \fBMSF\fR (Minute, Second, Frame) format.
25 The \fBREAD HEADER\fR, \fBREAD SUBCHANNEL\fR, and \fBREAD TABLE OF CONTENTS\fR
26 commands have this feature.
27 .sp
28 .LP
29 \fBLBA\fR format represents the logical block address for the \fBCD-ROM\fR
30 absolute address field or for the offset from the beginning of the current
31 track expressed as a number of logical blocks in a \fBCD-ROM\fR track relative
32 address field. \fBMSF\fR format represents the physical address written on
33 \fBCD-ROM\fR discs, expressed as a sector count relative to either the
34 beginning of the medium or the beginning of the current track.
35 .SH IOCTLS
36 .sp
37 .LP
38 The following \fBI/O\fR controls do not have any additional data passed into or
39 received from them.
40 .sp
41 .ne 2
42 .na
43 \fB\fBCDROMSTART\fR\fR
44 .ad
45 .RS 18n
46 This \fBioctl()\fR spins up the disc and seeks to the last address requested.
47 .RE
49 .sp
50 .ne 2
51 .na
52 \fB\fBCDROMSTOP\fR\fR
53 .ad
54 .RS 18n
55 This \fBioctl()\fR spins down the disc.
56 .RE
58 .sp
59 .ne 2
60 .na
61 \fB\fBCDROMPAUSE\fR\fR
62 .ad
63 .RS 18n
64 This \fBioctl()\fR pauses the current audio play operation.
65 .RE
67 .sp
68 .ne 2
69 .na
70 \fB\fBCDROMRESUME\fR\fR
71 .ad
72 .RS 18n
73 This \fBioctl()\fR resumes the paused audio play operation.
74 .RE
76 .sp
77 .ne 2
78 .na
79 \fB\fBCDROMEJECT\fR\fR
80 .ad
81 .RS 18n
82 This \fBioctl()\fR ejects the caddy with the disc.
83 .RE
85 .sp
86 .ne 2
87 .na
88 \fB\fBCDROMCLOSETRAY\fR\fR
89 .ad
90 .RS 18n
91 This \fBioctl()\fR closes the caddy with the disc.
92 .RE
94 .sp
95 .LP
96 The following \fBI/O\fR controls require a pointer to the structure for that
97 \fBioctl()\fR, with data being passed into the \fBioctl()\fR.
98 .sp
99 .ne 2
101 \fB\fBCDROMPLAYMSF\fR\fR
103 .RS 19n
104 This \fBioctl()\fR command requests the drive to output the audio signals at
105 the specified starting address and continue the audio play until the specified
106 ending address is detected. The address is in \fBMSF\fR format. The third
107 argument of this \fBioctl()\fR call is a pointer to the type \fBstruct
108 cdrom_msf\fR.
110 .in +2
113  * definition of play audio msf structure
114  */
115 struct cdrom_msf {
116         unsigned char   cdmsf_min0;     /* starting minute*/
117         unsigned char   cdmsf_sec0;     /* starting second*/
118         unsigned char   cdmsf_frame0;   /*starting frame*/
119         unsigned char   cdmsf_min1;     /* ending minute */
120         unsigned char   cdmsf_sec1;     /* ending second */
121         unsigned char   cdmsf_frame1;   /* ending frame */
124 .in -2
126 The \fBCDROMREADTOCENTRY\fR ioctl request may be used to obtain the start time
127 for a track. An approximation of the finish time can be obtained by using the
128 \fBCDROMREADTOCENTRY\fR ioctl request to retrieve the start time of the track
129 following the current track.
131 The leadout track is the next consecutive track after the last audio track.
132 Hence, the start time of the leadout track may be used as the effective finish
133 time of the  last audio track.
137 .ne 2
139 \fB\fBCDROMPLAYTRKIND\fR\fR
141 .RS 19n
142 This \fBioctl()\fR command is similar to  \fBCDROMPLAYMSF\fR. The starting and
143 ending address is in track/index format. The third argument of the
144 \fBioctl()\fR call is a pointer to the type \fBstruct cdrom_ti\fR.
146 .in +2
149  * definition of play audio track/index structure
150  */
151 struct cdrom_ti {
152         unsigned char   cdti_trk0;      /* starting track*/
153         unsigned char   cdti_ind0;      /* starting index*/
154         unsigned char   cdti_trk1;      /* ending track */
155         unsigned char   cdti_ind1;      /* ending index */
158 .in -2
163 .ne 2
165 \fB\fBCDROMVOLCTRL\fR\fR
167 .RS 19n
168 This \fBioctl()\fR command controls the audio output level. The \fBSCSI\fR
169 command allows the control of up to four channels. The current implementation
170 of the supported \fBCD-ROM\fR drive only uses channel 0 and channel 1. The
171 valid values of volume control are between 0x00 and 0xFF, with a value of 0xFF
172 indicating maximum volume. The third argument of the \fBioctl()\fR call is a
173 pointer to \fBstruct\fR \fBcdrom_volctrl\fR which contains the output volume
174 values.
176 .in +2
179  * definition of audio volume control structure
180  */
181 struct cdrom_volctrl {
182         unsigned char   channel0;
183         unsigned char   channel1;
184         unsigned char   channel2;
185         unsigned char   channel3;
188 .in -2
194 The following \fBI/O\fR controls take a pointer that will have data returned to
195 the user program from the \fBCD-ROM\fR driver.
197 .ne 2
199 \fB\fBCDROMREADTOCHDR\fR\fR
201 .RS 21n
202 This \fBioctl()\fR command returns the header of the  table of contents (TOC).
203 The header consists of the starting tracking number and the ending track number
204 of the disc. These two numbers are returned through a pointer of  \fBstruct
205 cdrom_tochdr\fR. While the disc can start at any number, all tracks between the
206 first and last tracks are in contiguous ascending order.
208 .in +2
211  * definition of read toc header structure
212  */
213 struct cdrom_tochdr {
214         unsigned char   cdth_trk0;      /* starting track*/
215         unsigned char   cdth_trk1;      /* ending track*/
218 .in -2
223 .ne 2
225 \fB\fBCDROMREADTOCENTRY\fR\fR
227 .RS 21n
228 This \fBioctl()\fR command returns the information of a specified track. The
229 third argument of the function call is a pointer to the type \fBstruct
230 cdrom_tocentry\fR. The caller needs to supply the track number and the address
231 format. This command will return a 4-bit  \fBadr\fR field, a 4-bit \fBctrl\fR
232 field, the starting address in \fBMSF\fR format or \fBLBA\fR format, and the
233 data mode if the track is a data track. The \fBctrl\fR field specifies whether
234 the track is data or audio.
236 .in +2
239  * definition of read toc entry structure
240  */
241 struct cdrom_tocentry {
242         unsigned char  cdte_track;
243         unsigned char  cdte_adr   :4;
244         unsigned char  cdte_ctrl   :4;
245         unsigned char  cdte_format;
246         union {
247                 struct {
248                         unsigned char  minute;
249                         unsigned char  second;
250                         unsigned char  frame;
251                 } msf;
252                 int     lba;
253         } cdte_addr;
254         unsigned char  cdte_datamode;
257 .in -2
259 To get the information from the leadout track, the following value is
260 appropriate for the \fBcdte_track\fR field:
262 .ne 2
264 \fB\fBCDROM_LEADOUT\fR\fR
266 .RS 17n
267 Leadout track
270 To get the information from the data track, the following value is appropriate
271 for the \fBcdte_ctrl\fR field:
273 .ne 2
275 \fB\fBCDROM_DATA_TRACK\fR\fR
277 .RS 20n
278 Data track
281 The following values are appropriate for the  \fBcdte_format\fR field:
283 .ne 2
285 \fB\fBCDROM_LBA\fR\fR
287 .RS 13n
288 \fBLBA\fR format
292 .ne 2
294 \fB\fBCDROM_MSF\fR\fR
296 .RS 13n
297 \fBMSF\fR format
303 .ne 2
305 \fB\fBCDROMSUBCHNL\fR\fR
307 .RS 21n
308 This \fBioctl()\fR command reads the Q sub-channel data of the current block.
309 The subchannel data includes track number, index number, absolute \fBCD-ROM\fR
310 address, track relative  \fBCD-ROM\fR address, control data and audio status.
311 All information is returned through a pointer to  \fBstruct cdrom_subchnl\fR.
312 The caller needs to supply the address format for the returned address.
314 .in +2
316 struct cdrom_subchnl {
317         unsigned char   cdsc_format;
318         unsigned char   cdsc_audiostatus;
319         unsigned char   cdsc_adr:       4;
320         unsigned char   cdsc_ctrl:      4;
321         unsigned char   cdsc_trk;
322         unsigned char   cdsc_ind;
323         union {
324                 struct {
325                         unsigned char   minute;
326                         unsigned char   second;
327                         unsigned char   frame;
328                 } msf;
329                 int     lba;
330         } cdsc_absaddr;
331         union {
332                 struct {
333                         unsigned char   minute;
334                         unsigned char   second;
335                         unsigned char   frame;
336                 } msf;
337                 int     lba;
338         } cdsc_reladdr;
341 .in -2
343 The following values are valid for the audio status field returned from
344 \fBREAD\fR \fBSUBCHANNEL\fR command:
346 .ne 2
348 \fB\fBCDROM_AUDIO_INVALID\fR\fR
350 .RS 25n
351 Audio status not supported.
355 .ne 2
357 \fB\fBCDROM_AUDIO_PLAY\fR\fR
359 .RS 25n
360 Audio play operation in progress.
364 .ne 2
366 \fB\fBCDROM_AUDIO_PAUSED\fR\fR
368 .RS 25n
369 Audio play operation paused.
373 .ne 2
375 \fB\fBCDROM_AUDIO_COMPLETED\fR\fR
377 .RS 25n
378 Audio play successfully completed.
382 .ne 2
384 \fB\fBCDROM_AUDIO_ERROR\fR\fR
386 .RS 25n
387 Audio play stopped due to error.
391 .ne 2
393 \fB\fBCDROM_AUDIO_NO_STATUS\fR\fR
395 .RS 25n
396 No current audio status to return.
402 .ne 2
404 \fB\fBCDROMREADOFFSET\fR\fR
406 .RS 21n
407 This \fBioctl()\fR command returns the absolute \fBCD-ROM\fR address of the
408 first track in the last session of a Multi-Session \fBCD-ROM\fR. The third
409 argument of the \fBioctl()\fR call is a pointer to an \fBint\fR.
413 .ne 2
415 \fB\fBCDROMCDDA\fR\fR
417 .RS 21n
418 This \fBioctl()\fR command returns the \fBCD-DA\fR data or the subcode data.
419 The third argument of the \fBioctl()\fR call is a pointer to the type \fBstruct
420 cdrom_cdda\fR. In addition to allocating memory and supplying its address, the
421 caller needs to supply the starting address of the data, the transfer length in
422 terms of the number of blocks to be transferred, and the subcode options. The
423 caller also needs to issue the \fBCDROMREADTOCENTRY\fR \fBioctl()\fR to find
424 out which tracks contain \fBCD-DA\fR data before issuing this \fBioctl()\fR.
426 .in +2
429  * Definition of CD-DA structure
430  */
431 struct cdrom_cdda {
432         unsigned int    cdda_addr;
433         unsigned int    cdda_length;
434         caddr_t         cdda_data;
435         unsigned char   cdda_subcode;
438 .in -2
440 \fBcdda_addr\fR signifies the starting logical block address.
442 \fBcdda_length\fR signifies the transfer length in blocks. The length of the
443 block depends on the \fBcdda_subcode\fR selection, which is explained below.
445 To get the subcode information related to  \fBCD-DA\fR data, the following
446 values are appropriate for the  \fBcdda_subcode\fR field:
448 .ne 2
450 \fB\fBCDROM_DA_NO_SUBCODE\fR\fR
452 .RS 25n
453 \fBCD-DA\fR data with no subcode.
457 .ne 2
459 \fB\fBCDROM_DA_SUBQ\fR\fR
461 .RS 25n
462 \fBCD-DA\fR data with sub Q code.
466 .ne 2
468 \fB\fBCDROM_DA_ALL_SUBCODE\fR\fR
470 .RS 25n
471 \fBCD-DA\fR data with all subcode.
475 .ne 2
477 \fB\fBCDROM_DA_SUBCODE_ONLY\fR\fR
479 .RS 25n
480 All subcode only.
483 To allocate the memory related to  \fBCD-DA\fR and/or subcode data, the
484 following values are appropriate for each data  block transferred:
486 .ne 2
488 \fB\fBCD-DA\fR data with no subcode\fR
490 .sp .6
491 .RS 4n
492 2352 bytes
496 .ne 2
498 \fB\fBCD-DA\fR data with sub Q code\fR
500 .sp .6
501 .RS 4n
502 2368 bytes
506 .ne 2
508 \fB\fBCD-DA\fR data with all subcode\fR
510 .sp .6
511 .RS 4n
512 2448 bytes
516 .ne 2
518 \fBAll subcode only\fR
520 .sp .6
521 .RS 4n
522 96 bytes
528 .ne 2
530 \fB\fBCDROMCDXA\fR\fR
532 .RS 21n
533 This \fBioctl()\fR command returns the \fBCD-ROM\fR \fBXA\fR (CD-ROM Extended
534 Architecture) data according to  \fBCD-ROM\fR \fBXA\fR format. The third
535 argument of the \fBioctl()\fR call is a pointer to the type \fBstruct
536 cdrom_cdxa\fR. In addition to allocating memory and supplying its address, the
537 caller needs  to supply the starting address of the data, the transfer length
538 in terms of number of blocks, and the format. The caller also needs to issue
539 the \fBCDROMREADTOCENTRY\fR \fBioctl()\fR to find out which tracks contain
540 \fBCD-ROM\fR \fBXA\fR data before issuing this \fBioctl()\fR.
542 .in +2
545  * Definition of CD-ROM XA structure
546  */
547 struct cdrom_cdxa {
548         unsigned int    cdxa_addr;
549         unsigned int    cdxa_length;
550         caddr_t         cdxa_data;
551         unsigned char   cdxa_format;
554 .in -2
556 To get the proper  \fBCD-ROM\fR \fBXA\fR data, the following values are
557 appropriate for the  \fBcdxa_format\fR field:
559 .ne 2
561 \fB\fBCDROM_XA_DATA\fR\fR
563 .RS 25n
564 \fBCD-ROM\fR \fBXA\fR data only
568 .ne 2
570 \fB\fBCDROM_XA_SECTOR_DATA\fR\fR
572 .RS 25n
573 \fBCD-ROM\fR \fBXA\fR all sector data
577 .ne 2
579 \fB\fBCDROM_XA_DATA_W_ERROR\fR\fR
581 .RS 25n
582 \fBCD-ROM\fR \fBXA\fR data with error flags data
585 To allocate the memory related to  \fBCD-ROM\fR \fBXA\fR format, the following
586 values are appropriate for each data  block transferred:
588 .ne 2
590 \fB\fBCD-ROM XA\fR data only\fR
592 .sp .6
593 .RS 4n
594 2048 bytes
598 .ne 2
600 \fB\fBCD-ROM XA\fR all sector data\fR
602 .sp .6
603 .RS 4n
604 2352 bytes
608 .ne 2
610 \fB\fBCD-ROM XA\fR data with error flags data\fR
612 .sp .6
613 .RS 4n
614 2646 bytes
620 .ne 2
622 \fB\fBCDROMSUBCODE\fR\fR
624 .RS 21n
625 This  \fBioctl()\fR command returns raw subcode data (subcodes P ~ W are
626 described in  the "Red Book," see \fBSEE ALSO\fR) to the initiator while the
627 target is  playing audio. The third argument of the  \fBioctl()\fR call is a
628 pointer to the type \fBstruct cdrom_subcode\fR. The caller needs to supply the
629 transfer length in terms of number of blocks and allocate memory  for subcode
630 data. The memory allocated should be a multiple of 96  bytes depending on the
631 transfer length.
633 .in +2
636  * Definition of subcode structure
637  */
638 struct cdrom_subcode {
639         unsigned int    cdsc_length;
640         caddr_t         cdsc_addr;
643 .in -2
649 The next group of \fBI/O\fR controls get and set various \fBCD-ROM\fR drive
650 parameters.
652 .ne 2
654 \fB\fBCDROMGBLKMODE\fR\fR
656 .RS 18n
657 This  \fBioctl()\fR command returns the current block size used by the
658 \fBCD-ROM\fR drive.  The third argument of the \fBioctl()\fR call is a pointer
659 to an integer.
663 .ne 2
665 \fB\fBCDROMSBLKMODE\fR\fR
667 .RS 18n
668 This  \fBioctl()\fR command requests the \fBCD-ROM\fR drive to change from the
669 current block size to the requested block size. The third argument of the
670 \fBioctl()\fR call is an integer which contains the requested block size.
672 This \fBioctl()\fR command operates in exclusive-use mode only. The caller must
673 ensure  that no other processes can operate on the same  \fBCD-ROM\fR device
674 before issuing this  \fBioctl()\fR. \fBread\fR(2) behavior subsequent to this
675 \fBioctl()\fR remains the same: the caller is still constrained to read the raw
676 device on block boundaries and in block multiples.
678 To set the proper block size, the following values are appropriate:
680 .ne 2
682 \fB\fBCDROM_BLK_512\fR\fR
684 .RS 18n
685 512 bytes
689 .ne 2
691 \fB\fBCDROM_BLK_1024\fR\fR
693 .RS 18n
694 1024 bytes
698 .ne 2
700 \fB\fBCDROM_BLK_2048\fR\fR
702 .RS 18n
703 2048 bytes
707 .ne 2
709 \fB\fBCDROM_BLK_2056\fR\fR
711 .RS 18n
712 2056 bytes
716 .ne 2
718 \fB\fBCDROM_BLK_2336\fR\fR
720 .RS 18n
721 2336 bytes
725 .ne 2
727 \fB\fBCDROM_BLK_2340\fR\fR
729 .RS 18n
730 2340 bytes
734 .ne 2
736 \fB\fBCDROM_BLK_2352\fR\fR
738 .RS 18n
739 2352 bytes
743 .ne 2
745 \fB\fBCDROM_BLK_2368\fR\fR
747 .RS 18n
748 2368 bytes
752 .ne 2
754 \fB\fBCDROM_BLK_2448\fR\fR
756 .RS 18n
757 2448 bytes
761 .ne 2
763 \fB\fBCDROM_BLK_2646\fR\fR
765 .RS 18n
766 2646 bytes
770 .ne 2
772 \fB\fBCDROM_BLK_2647\fR\fR
774 .RS 18n
775 2647 bytes
781 .ne 2
783 \fB\fBCDROMGDRVSPEED\fR\fR
785 .RS 18n
786 This \fBioctl()\fR command returns the current \fBCD-ROM\fR drive speed. The
787 third argument of the  \fBioctl()\fR call is a pointer to an integer.
791 .ne 2
793 \fB\fBCDROMSDRVSPEED\fR\fR
795 .RS 18n
796 This  \fBioctl()\fR command requests the \fBCD-ROM\fR drive to change the
797 current drive speed to the requested drive speed. This speed setting is only
798 applicable when reading data areas. The third argument of the  \fBioctl()\fR is
799 an integer which contains the requested drive speed.
801 To set the  \fBCD-ROM\fR drive to the proper speed, the following values are
802 appropriate:
804 .ne 2
806 \fB\fBCDROM_NORMAL_SPEED\fR\fR
808 .RS 23n
809 150k/second
813 .ne 2
815 \fB\fBCDROM_DOUBLE_SPEED\fR\fR
817 .RS 23n
818 300k/second
822 .ne 2
824 \fB\fBCDROM_QUAD_SPEED\fR\fR
826 .RS 23n
827 600k/second
831 .ne 2
833 \fB\fBCDROM_MAXIMUM_SPEED\fR\fR
835 .RS 23n
836 300k/second (2x drive) 600k/second (4x drive)
839 Note that these numbers are only accurate when reading 2048 byte blocks. The
840 \fBCD-ROM\fR drive will automatically switch to normal speed when playing audio
841 tracks  and will switch back to the speed setting when accessing data.
844 .SH SEE ALSO
847 \fBioctl\fR(2), \fBread\fR(2)
850 N. V. Phillips and Sony Corporation, \fISystem Description Compact Disc Digital
851 Audio\fR, ("Red Book").
854 N. V. Phillips and Sony Corporation, \fISystem Description of Compact Disc Read
855 Only Memory\fR, ("Yellow Book").
858 N. V. Phillips, Microsoft, and Sony Corporation, \fISystem Description CD-ROM
859 XA\fR, 1991.
862 \fIVolume and File Structure of CD-ROM for Information Interchange\fR, ISO
863 9660:1988(E).
866 \fISCSI-2\fR \fIStandard,\fR \fIdocument\fR \fIX3T9.2/86-109\fR
869 \fISCSI Multimedia Commands, Version 2 (MMC-2)\fR
870 .SH NOTES
873 The  \fBCDROMCDDA\fR, \fBCDROMCDXA\fR, \fBCDROMSUBCODE\fR,
874 \fBCDROMGDRVSPEED\fR, \fBCDROMSDRVSPEED\fR, and some of the block sizes in
875 \fBCDROMSBLKMODE\fR are designed for new Sun-supported \fBCD-ROM\fR drives and
876 might not work on some of the older \fBCD-ROM\fR drives.
879 CDROMCDDA, CDROMCDXA and CDROMSUBCODE will return error if the transfer length
880 exceeds valid limits as determined appropriate. Example: for MMC-2 drives,
881 length can not exceed 3 bytes (i.e. 0xffffff).  The same restriction is
882 enforced for older, pre-MMC-2 drives, as no limit was published for these older
883 drives (and 3 bytes is reasonable for all media). Note that enforcing this
884 limit does not imply that values passed in below this limit will actually be
885 applicable for each and every piece of media.
888 The interface to this device is preliminary and subject to change in future
889 releases. Programs should be written in  a modular fashion so that future
890 changes can be easily incorporated.