Home | History | Annotate | Line # | Download | only in scsipi
scsipi_cd.h revision 1.9
      1  1.9  reinoud /*	$NetBSD: scsipi_cd.h,v 1.9 2005/01/31 23:06:41 reinoud Exp $	*/
      2  1.2   bouyer 
      3  1.2   bouyer /*
      4  1.2   bouyer  * Written by Julian Elischer (julian (at) tfs.com)
      5  1.2   bouyer  * for TRW Financial Systems.
      6  1.2   bouyer  *
      7  1.2   bouyer  * TRW Financial Systems, in accordance with their agreement with Carnegie
      8  1.2   bouyer  * Mellon University, makes this software available to CMU to distribute
      9  1.3    enami  * or use in any manner that they see fit as long as this message is kept with
     10  1.2   bouyer  * the software. For this reason TFS also grants any other persons or
     11  1.2   bouyer  * organisations permission to use or modify this software.
     12  1.2   bouyer  *
     13  1.2   bouyer  * TFS supplies this software to be publicly redistributed
     14  1.2   bouyer  * on the understanding that TFS is not responsible for the correct
     15  1.2   bouyer  * functioning of this software in any circumstances.
     16  1.2   bouyer  *
     17  1.2   bouyer  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     18  1.2   bouyer  */
     19  1.4    enami 
     20  1.2   bouyer /*
     21  1.2   bouyer  *	Define two bits always in the same place in byte 2 (flag byte)
     22  1.2   bouyer  */
     23  1.2   bouyer #define	CD_RELADDR	0x01
     24  1.2   bouyer #define	CD_MSF		0x02
     25  1.2   bouyer 
     26  1.2   bouyer /*
     27  1.2   bouyer  * SCSI and SCSI-like command format
     28  1.2   bouyer  */
     29  1.2   bouyer 
     30  1.7  mycroft #define	LOAD_UNLOAD	0xa6
     31  1.7  mycroft struct scsipi_load_unload {
     32  1.9  reinoud 	uint8_t opcode;
     33  1.9  reinoud 	uint8_t unused1[3];
     34  1.9  reinoud 	uint8_t options;
     35  1.9  reinoud 	uint8_t unused2[3];
     36  1.9  reinoud 	uint8_t slot;
     37  1.9  reinoud 	uint8_t unused3[3];
     38  1.7  mycroft } __attribute__((packed));
     39  1.7  mycroft 
     40  1.2   bouyer #define PAUSE			0x4b	/* cdrom pause in 'play audio' mode */
     41  1.2   bouyer struct scsipi_pause {
     42  1.9  reinoud 	uint8_t opcode;
     43  1.9  reinoud 	uint8_t byte2;
     44  1.9  reinoud 	uint8_t unused[6];
     45  1.9  reinoud 	uint8_t resume;
     46  1.9  reinoud 	uint8_t control;
     47  1.7  mycroft } __attribute__((packed));
     48  1.2   bouyer #define	PA_PAUSE	0x00
     49  1.2   bouyer #define PA_RESUME	0x01
     50  1.2   bouyer 
     51  1.2   bouyer #define PLAY_MSF		0x47	/* cdrom play Min,Sec,Frames mode */
     52  1.2   bouyer struct scsipi_play_msf {
     53  1.9  reinoud 	uint8_t opcode;
     54  1.9  reinoud 	uint8_t byte2;
     55  1.9  reinoud 	uint8_t unused;
     56  1.9  reinoud 	uint8_t start_m;
     57  1.9  reinoud 	uint8_t start_s;
     58  1.9  reinoud 	uint8_t start_f;
     59  1.9  reinoud 	uint8_t end_m;
     60  1.9  reinoud 	uint8_t end_s;
     61  1.9  reinoud 	uint8_t end_f;
     62  1.9  reinoud 	uint8_t control;
     63  1.7  mycroft } __attribute__((packed));
     64  1.2   bouyer 
     65  1.2   bouyer #define PLAY			0x45	/* cdrom play  'play audio' mode */
     66  1.2   bouyer struct scsipi_play {
     67  1.9  reinoud 	uint8_t opcode;
     68  1.9  reinoud 	uint8_t byte2;
     69  1.9  reinoud 	uint8_t blk_addr[4];
     70  1.9  reinoud 	uint8_t unused;
     71  1.9  reinoud 	uint8_t xfer_len[2];
     72  1.9  reinoud 	uint8_t control;
     73  1.7  mycroft } __attribute__((packed));
     74  1.2   bouyer 
     75  1.2   bouyer #define READ_HEADER		0x44	/* cdrom read header */
     76  1.2   bouyer struct scsipi_read_header {
     77  1.9  reinoud 	uint8_t opcode;
     78  1.9  reinoud 	uint8_t byte2;
     79  1.9  reinoud 	uint8_t blk_addr[4];
     80  1.9  reinoud 	uint8_t unused;
     81  1.9  reinoud 	uint8_t data_len[2];
     82  1.9  reinoud 	uint8_t control;
     83  1.7  mycroft } __attribute__((packed));
     84  1.2   bouyer 
     85  1.2   bouyer #define READ_SUBCHANNEL		0x42	/* cdrom read Subchannel */
     86  1.2   bouyer struct scsipi_read_subchannel {
     87  1.9  reinoud 	uint8_t opcode;
     88  1.9  reinoud 	uint8_t byte2;
     89  1.9  reinoud 	uint8_t byte3;
     90  1.2   bouyer #define	SRS_SUBQ	0x40
     91  1.9  reinoud 	uint8_t subchan_format;
     92  1.9  reinoud 	uint8_t unused[2];
     93  1.9  reinoud 	uint8_t track;
     94  1.9  reinoud 	uint8_t data_len[2];
     95  1.9  reinoud 	uint8_t control;
     96  1.7  mycroft } __attribute__((packed));
     97  1.2   bouyer 
     98  1.2   bouyer #define READ_TOC		0x43	/* cdrom read TOC */
     99  1.2   bouyer struct scsipi_read_toc {
    100  1.9  reinoud 	uint8_t opcode;
    101  1.9  reinoud 	uint8_t addr_mode;
    102  1.9  reinoud 	uint8_t resp_format;
    103  1.9  reinoud 	uint8_t unused[3];
    104  1.9  reinoud 	uint8_t from_track;
    105  1.9  reinoud 	uint8_t data_len[2];
    106  1.9  reinoud 	uint8_t control;
    107  1.7  mycroft } __attribute__((packed));
    108  1.2   bouyer 
    109  1.2   bouyer #define READ_CD_CAPACITY	0x25	/* slightly different from disk */
    110  1.2   bouyer struct scsipi_read_cd_capacity {
    111  1.9  reinoud 	uint8_t opcode;
    112  1.9  reinoud 	uint8_t byte2;
    113  1.9  reinoud 	uint8_t addr[4];
    114  1.9  reinoud 	uint8_t unused[3];
    115  1.9  reinoud 	uint8_t control;
    116  1.7  mycroft } __attribute__((packed));
    117  1.2   bouyer 
    118  1.2   bouyer struct scsipi_read_cd_cap_data {
    119  1.9  reinoud 	uint8_t addr[4];
    120  1.9  reinoud 	uint8_t length[4];
    121  1.7  mycroft } __attribute__((packed));
    122  1.2   bouyer 
    123  1.2   bouyer /* mod pages common to scsi and atapi */
    124  1.2   bouyer struct cd_audio_page {
    125  1.9  reinoud 	uint8_t pg_code;
    126  1.3    enami #define		AUDIO_PAGE	0x0e
    127  1.9  reinoud 	uint8_t pg_length;
    128  1.9  reinoud 	uint8_t flags;
    129  1.2   bouyer #define		CD_PA_SOTC	0x02
    130  1.2   bouyer #define		CD_PA_IMMED	0x04
    131  1.9  reinoud 	uint8_t unused[2];
    132  1.9  reinoud 	uint8_t format_lba; /* valid only for SCSI CDs */
    133  1.3    enami #define		CD_PA_FORMAT_LBA 0x0F
    134  1.2   bouyer #define		CD_PA_APR_VALID	0x80
    135  1.9  reinoud 	uint8_t lb_per_sec[2];
    136  1.3    enami 	struct port_control {
    137  1.9  reinoud 		uint8_t channels;
    138  1.2   bouyer #define	CHANNEL 0x0F
    139  1.2   bouyer #define	CHANNEL_0 1
    140  1.2   bouyer #define	CHANNEL_1 2
    141  1.2   bouyer #define	CHANNEL_2 4
    142  1.2   bouyer #define	CHANNEL_3 8
    143  1.3    enami #define		LEFT_CHANNEL	CHANNEL_0
    144  1.3    enami #define		RIGHT_CHANNEL	CHANNEL_1
    145  1.3    enami #define		MUTE_CHANNEL	0x0
    146  1.3    enami #define		BOTH_CHANNEL	LEFT_CHANNEL | RIGHT_CHANNEL
    147  1.9  reinoud 		uint8_t volume;
    148  1.2   bouyer 	} port[4];
    149  1.2   bouyer #define	LEFT_PORT	0
    150  1.2   bouyer #define	RIGHT_PORT	1
    151  1.2   bouyer };
    152