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