Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctl(2)

sd(7)

cdio(7)

NAME

cdio − CDROM control operations

SYNOPSIS

#include <sys/cdio.h>

DESCRIPTION

The SCSI driver sd(7) supports a set of ioctl(2) commands for audio operations and CDROM specific operations.  Basic to these cdio ioctl() requests are the definitions in <sys/cdio.h>. 

IOCTLS

The following ioctl()s do not have any additional data passed into or received from them. 

CDROMSTART This ioctl() spins up the disc and seeks to the last address requested. 

CDROMSTOP This ioctl() spins down the disc. 

CDROMPAUSE This ioctl() pauses the current audio play operation. 

CDROMRESUME This ioctl() resumes the paused audio play operation. 

CDROMEJECT This ioctl() ejects the caddy with the disc. 

The following ioctl()s require a pointer to the structure for that ioctl, with data being passed into the ioctl. 

CDROMPLAYMSF This ioctl() requests the drive to output the audio signals at the specified starting address and continue the audio play until the specified ending address is detected.  The address is in MSF (minute, second, frame) format.  The third argument of the ioctl() call is a pointer to the type struct cdrom_msf. 

/∗
 ∗ definition of play audio msf structure
 ∗/
struct cdrom_msf {
unsigned charcdmsf_min0;/∗ starting minute ∗/
unsigned charcdmsf_sec0;/∗ starting second ∗/
unsigned charcdmsf_frame0;/∗ starting frame ∗/
unsigned charcdmsf_min1;/∗ ending minute ∗/
unsigned charcdmsf_sec1;/∗ ending second ∗/
unsigned charcdmsf_frame1;/∗ ending frame ∗/
};

CDROMPLAYTRKIND
This ioctl() command is similar to CDROMPLAYMSF.  The starting and ending address is in track/index format.  The third argument of the ioctl() call is a pointer to the type struct cdrom_ti. 

/∗
 ∗ definition of play audio track/index structure
 ∗/
struct cdrom_ti {
unsigned charcdti_trk0;/∗ starting track ∗/
unsigned charcdti_ind0;/∗ starting index ∗/
unsigned charcdti_trk1;/∗ ending track ∗/
unsigned charcdti_ind1;/∗ ending index ∗/
};

CDROMVOLCTRL ioctl() command controls the audio output level.  The SCSI command allows the control of up to 4 channels.  The current implementation of the supported CDROM drive only uses channel 0 and channel 1.  The valid values of volume control are between 0x00 and 0xFF, with a value of 0xFF indicating maximum volume.  The third argument of the function call is a pointer to struct cdrom_volctrl which contains the output volume values. 

/∗
 ∗ definition of audio volume control structure
 ∗/
struct cdrom_volctrl {
unsigned charcdvc_chnl0;
unsigned charcdvc_chnl1;
unsigned charcdvc_chnl2;
unsigned charcdvc_chnl3;
};

The next group of ioctl() calls take a pointer that will have data returned to the user program from the CDROM driver. 

CDROMREADTOCHDR
This ioctl() command returns the header of the TOC (table of contents).  The header consists of the starting tracking number and the ending track number of the disc.  These two numbers are returned through a pointer of struct cdrom_tochdr.  While the disc can start at any number, all tracks between the first and last tracks are in contiguous ascending order. 

/∗
 ∗ definition of read toc header structure
 ∗/
struct cdrom_tochdr {
unsigned charcdth_trk0;/∗ starting track ∗/
unsigned charcdth_trk1;/∗ ending track ∗/
};

R CDROMREADTOCENTRY .
This command returns the information of a specified track. The third argument of the function call is a pointer to the type struct cdrom_tocentry.  The caller need to supply the track number and the address format.  This command will return a 4-bit adr field, a 4-bit ctrl field, the starting address in MSF format or LBA format, and the data mode if the track is a data track.  The ctrl field specifies whether the track is data or audio.  To get information for the lead-out area, supply the ioctl() command with the track field set to CDROM_LEADOUT (0xAA). 

/∗
 ∗ definition of read toc entry structure
 ∗/
struct cdrom_tocentry {
unsigned charcdte_track;
unsigned charcdte_adr:4;
unsigned charcdte_ctrl:4;
unsigned charcdte_format;
union {
struct {
unsigned charminute;
unsigned charsecond;
unsigned charframe;
} msf;
intlba;
} cdte_addr;
unsigned charcdte_datamode;
};
/∗
 ∗ Bitmask for CDROM data track in the cdte_ctrl field
 ∗ A track is either data or audio.
 ∗/
#define CDROM_DATA_TRACK0x04
/∗
 ∗ CDROM address format definition, for
 ∗ use with struct cdrom_tocentry
 ∗/
#define CDROM_LBA0x01
#define CDROM_MSF0x02
/∗
 ∗ For CDROMREADTOCENTRY, set the cdte_track to
 ∗ CDROM_LEADOUT to get the information for the leadout track.
 ∗/
#define CDROM_LEADOUT0xAA

CDROMSUBCHNL This ioctl() command reads the Q sub-channel data of the current block.  The sub-channel data includes track number, index number, absolute CDROM address, track relative CDROM address, control data and audio status.  All information is returned through a pointer to struct cdrom_subchnl.  The caller needs to supply the address format for the returned address. 

struct cdrom_subchnl {
unsigned charcdsc_format;
unsigned charcdsc_audiostatus;
unsigned charcdsc_adr:4;
unsigned charcdsc_ctrl:4;
unsigned charcdsc_trk;
unsigned charcdsc_ind;
union {
struct {
unsigned charminute;
unsigned charsecond;
unsigned charframe;
} msf;
intlba;
} cdsc_absaddr;
union {
struct {
unsigned charminute;
unsigned charsecond;
unsigned charframe;
} msf;
intlba;
} cdsc_reladdr;
};
/∗
 ∗ Definition for audio status returned from Read Sub-channel
 ∗/
#define CDROM_AUDIO_INVALID     0x00
/∗ audio status not supported ∗/
#define CDROM_AUDIO_PLAY        0x11
/∗ audio play operation in progress ∗/
#define CDROM_AUDIO_PAUSED      0x12
/∗ audio play operation paused ∗/
#define CDROM_AUDIO_COMPLETED   0x13
/∗ audio play successfully completed ∗/
#define CDROM_AUDIO_ERROR       0x14
/∗ audio play stopped due to error ∗/
#define CDROM_AUDIO_NO_STATUS   0x15
/∗ no current audio status to return ∗/

SEE ALSO

ioctl(2), sd(7)

NOTES

The interface to this device is preliminary and subject to change in future releases.  You are encouraged to write your programs in a modular fashion so that you can easily incorporate future changes. 

SunOS 5.1/SPARC  —  Last change: 24 May 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026