#ifndef _SYS_CDIO_H
#define _SYS_CDIO_H
#ifdef __cplusplus
extern "C" {
#endif
struct cdrom_msf {
unsigned char cdmsf_min0;
unsigned char cdmsf_sec0;
unsigned char cdmsf_frame0;
unsigned char cdmsf_min1;
unsigned char cdmsf_sec1;
unsigned char cdmsf_frame1;
};
struct cdrom_ti {
unsigned char cdti_trk0;
unsigned char cdti_ind0;
unsigned char cdti_trk1;
unsigned char cdti_ind1;
};
struct cdrom_tochdr {
unsigned char cdth_trk0;
unsigned char cdth_trk1;
};
struct cdrom_tocentry {
unsigned char cdte_track;
unsigned cdte_adr :4;
unsigned cdte_ctrl :4;
unsigned char cdte_format;
union {
struct {
unsigned char minute;
unsigned char second;
unsigned char frame;
} msf;
int lba;
} cdte_addr;
unsigned char cdte_datamode;
};
#define CDROM_LBA 0x01
#define CDROM_MSF 0x02
#define CDROM_DATA_TRACK 0x04
#define CDROM_LEADOUT 0xAA
struct cdrom_subchnl {
unsigned char cdsc_format;
unsigned char cdsc_audiostatus;
unsigned cdsc_adr: 4;
unsigned cdsc_ctrl: 4;
unsigned char cdsc_trk;
unsigned char cdsc_ind;
union {
struct {
unsigned char minute;
unsigned char second;
unsigned char frame;
} msf;
int lba;
} cdsc_absaddr;
union {
struct {
unsigned char minute;
unsigned char second;
unsigned char frame;
} msf;
int lba;
} cdsc_reladdr;
};
#define CDROM_AUDIO_INVALID 0x00
#define CDROM_AUDIO_PLAY 0x11
#define CDROM_AUDIO_PAUSED 0x12
#define CDROM_AUDIO_COMPLETED 0x13
#define CDROM_AUDIO_ERROR 0x14
#define CDROM_AUDIO_NO_STATUS 0x15
struct cdrom_volctrl {
unsigned char channel0;
unsigned char channel1;
unsigned char channel2;
unsigned char channel3;
};
struct cdrom_read {
int cdread_lba;
caddr_t cdread_bufaddr;
int cdread_buflen;
};
#if defined(_SYSCALL32)
struct cdrom_read32 {
int cdread_lba;
caddr32_t cdread_bufaddr;
int cdread_buflen;
};
#define cdrom_read32tocdrom_read(cdrd32, cdrd) \
cdrd->cdread_lba = cdrd32->cdread_lba; \
cdrd->cdread_bufaddr = (caddr_t)(uintptr_t)cdrd32->cdread_bufaddr; \
cdrd->cdread_buflen = cdrd32->cdread_buflen
#define cdrom_readtocdrom_read32(cdrd, cdrd32) \
cdrd32->cdread_lba = cdrd->cdread_lba; \
cdrd32->cdread_bufaddr = (caddr32_t)(uintptr_t)cdrd->cdread_bufaddr; \
cdrd32->cdread_buflen = cdrd->cdread_buflen
#endif
struct cdrom_cdda {
unsigned int cdda_addr;
unsigned int cdda_length;
caddr_t cdda_data;
unsigned char cdda_subcode;
};
#if defined(_SYSCALL32)
struct cdrom_cdda32 {
unsigned int cdda_addr;
unsigned int cdda_length;
caddr32_t cdda_data;
unsigned char cdda_subcode;
};
#define cdrom_cdda32tocdrom_cdda(cdda32, cdda) \
cdda->cdda_addr = cdda32->cdda_addr; \
cdda->cdda_length = cdda32->cdda_length; \
cdda->cdda_data = (caddr_t)(uintptr_t)cdda32->cdda_data; \
cdda->cdda_subcode = cdda32->cdda_subcode
#define cdrom_cddatocdrom_cdda32(cdda, cdda32) \
cdda32->cdda_addr = cdda->cdda_addr; \
cdda32->cdda_length = cdda->cdda_length; \
cdda32->cdda_data = (caddr32_t)(uintptr_t)cdda->cdda_data; \
cdda32->cdda_subcode = cdda->cdda_subcode
#endif
#define CDROM_DA_NO_SUBCODE 0x00
#define CDROM_DA_SUBQ 0x01
#define CDROM_DA_ALL_SUBCODE 0x02
#define CDROM_DA_SUBCODE_ONLY 0x03
struct cdrom_cdxa {
unsigned int cdxa_addr;
unsigned int cdxa_length;
caddr_t cdxa_data;
unsigned char cdxa_format;
};
#if defined(_SYSCALL32)
struct cdrom_cdxa32 {
unsigned int cdxa_addr;
unsigned int cdxa_length;
caddr32_t cdxa_data;
unsigned char cdxa_format;
};
#define cdrom_cdxa32tocdrom_cdxa(cdxa32, cdxa) \
cdxa->cdxa_addr = cdxa32->cdxa_addr; \
cdxa->cdxa_length = cdxa32->cdxa_length; \
cdxa->cdxa_data = (caddr_t)(uintptr_t)cdxa32->cdxa_data; \
cdxa->cdxa_format = cdxa32->cdxa_format
#define cdrom_cdxatocdrom_cdxa32(cdxa, cdxa32) \
cdxa32->cdxa_addr = cdxa->cdxa_addr; \
cdxa32->cdxa_length = cdxa->cdxa_length; \
cdxa32->cdxa_data = (caddr32_t)(uintptr_t)cdxa->cdxa_data; \
cdxa32->cdxa_format = cdxa->cdxa_format
#endif
#define CDROM_XA_DATA 0x00
#define CDROM_XA_SECTOR_DATA 0x01
#define CDROM_XA_DATA_W_ERROR 0x02
struct cdrom_subcode {
unsigned int cdsc_length;
caddr_t cdsc_addr;
};
#if defined(_SYSCALL32)
struct cdrom_subcode32 {
unsigned int cdsc_length;
caddr32_t cdsc_addr;
};
#define cdrom_subcode32tocdrom_subcode(cdsc32, cdsc) \
cdsc->cdsc_length = cdsc32->cdsc_length; \
cdsc->cdsc_addr = (caddr_t)(uintptr_t)cdsc32->cdsc_addr
#define cdrom_subcodetocdrom_subcode32(cdsc, cdsc32) \
cdsc32->cdsc_length = cdsc->cdsc_length; \
cdsc32->cdsc_addr = (caddr32_t)(uintptr_t)cdsc->cdsc_addr
#endif
#define CDROM_BLK_512 512
#define CDROM_BLK_1024 1024
#define CDROM_BLK_2048 2048
#define CDROM_BLK_2056 2056
#define CDROM_BLK_2324 2324
#define CDROM_BLK_2336 2336
#define CDROM_BLK_2340 2340
#define CDROM_BLK_2352 2352
#define CDROM_BLK_2368 2368
#define CDROM_BLK_2448 2448
#define CDROM_BLK_2646 2646
#define CDROM_BLK_2647 2647
#define CDROM_BLK_SUBCODE 96
#define CDROM_NORMAL_SPEED 0x00
#define CDROM_DOUBLE_SPEED 0x01
#define CDROM_QUAD_SPEED 0x03
#define CDROM_TWELVE_SPEED 0x0C
#define CDROM_MAXIMUM_SPEED 0xff
#define CDIOC (0x04 << 8)
#define CDROMPAUSE (CDIOC|151)
#define CDROMRESUME (CDIOC|152)
#define CDROMPLAYMSF (CDIOC|153)
#define CDROMPLAYTRKIND (CDIOC|154)
#define CDROMREADTOCHDR (CDIOC|155)
#define CDROMREADTOCENTRY (CDIOC|156)
#define CDROMSTOP (CDIOC|157)
#define CDROMSTART (CDIOC|158)
#define CDROMEJECT (CDIOC|159)
#define CDROMVOLCTRL (CDIOC|160)
#define CDROMSUBCHNL (CDIOC|161)
#define CDROMREADMODE2 (CDIOC|162)
#define CDROMREADMODE1 (CDIOC|163)
#define CDROMREADOFFSET (CDIOC|164)
#define CDROMGBLKMODE (CDIOC|165)
#define CDROMSBLKMODE (CDIOC|166)
#define CDROMCDDA (CDIOC|167)
#define CDROMCDXA (CDIOC|168)
#define CDROMSUBCODE (CDIOC|169)
#define CDROMGDRVSPEED (CDIOC|170)
#define CDROMSDRVSPEED (CDIOC|171)
#define CDROMCLOSETRAY (CDIOC|172)
#define SCMD_READ_SUBCHANNEL 0x42
#define SCMD_READ_TOC 0x43
#define SCMD_READ_HEADER 0x44
#define SCMD_PLAYAUDIO10 0x45
#define SCMD_PLAYAUDIO_MSF 0x47
#define SCMD_PLAYAUDIO_TI 0x48
#define SCMD_PLAYTRACK_REL10 0x49
#define SCMD_PAUSE_RESUME 0x4B
#define SCMD_PLAYAUDIO12 0xA5
#define SCMD_PLAYTRACK_REL12 0xA9
#define SCMD_SET_CDROM_SPEED 0xBB
#define SCMD_READ_CD 0xBE
#define READ_CD_EST_ALLTYPE 0x0
#define READ_CD_EST_CDDA 0x1
#define READ_CD_EST_MODE1 0x2
#define READ_CD_EST_MODE2 0x3
#define READ_CD_EST_MODE2FORM1 0x4
#define READ_CD_EST_MODE2FORM2 0x5
#define READ_CD_EST_RSVD1 0x6
#define READ_CD_EST_RSVD2 0x7
#define SCMD_CD_PLAYBACK_CONTROL 0xC9
#define SCMD_CD_PLAYBACK_STATUS 0xC4
#define SCMD_READ_CDDA 0xD8
#define SCMD_READ_CDXA 0xDB
#define SCMD_READ_ALL_SUBCODES 0xDF
#define CDROM_MODE2_SIZE 2336
#define SCSI_CMDS_KEY_STRINGS_CDIO \
SCMD_READ_SUBCHANNEL, "read_subchannel", \
SCMD_READ_TOC, "read_toc", \
SCMD_REPORT_DENSITIES | \
SCMD_READ_HEADER, "report_densities/read_header", \
SCMD_PLAYAUDIO10, "playaudio", \
SCMD_GET_CONFIGURATION, "get_configuration", \
SCMD_PLAYAUDIO_MSF, "playaudio_msf", \
SCMD_PLAYAUDIO_TI, "playaudio_ti", \
SCMD_PLAYTRACK_REL10, "playaudio_rel", \
SCMD_PAUSE_RESUME, "pause_resume", \
\
SCMD_PLAYAUDIO12, "playaudio(12)", \
SCMD_PLAYTRACK_REL12, "playtrack_rel", \
SCMD_SET_CDROM_SPEED, "set_cd_speed", \
SCMD_READ_CD, "read_cd", \
\
SCMD_CD_PLAYBACK_STATUS, "cd_playback_status", \
SCMD_CD_PLAYBACK_CONTROL, "cd_playback_control", \
SCMD_READ_CDDA, "read_cdda", \
SCMD_READ_CDXA, "read_cdxa", \
SCMD_READ_ALL_SUBCODES, "read_all_subcodes"
#ifdef __cplusplus
}
#endif
#endif