xref: /freebsd/sys/cam/scsi/scsi_cd.h (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
1 /*
2  * Written by Julian Elischer (julian@tfs.com)
3  * for TRW Financial Systems.
4  *
5  * TRW Financial Systems, in accordance with their agreement with Carnegie
6  * Mellon University, makes this software available to CMU to distribute
7  * or use in any manner that they see fit as long as this message is kept with
8  * the software. For this reason TFS also grants any other persons or
9  * organisations permission to use or modify this software.
10  *
11  * TFS supplies this software to be publicly redistributed
12  * on the understanding that TFS is not responsible for the correct
13  * functioning of this software in any circumstances.
14  *
15  * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
16  *
17  *	from: scsi_cd.h,v 1.10 1997/02/22 09:44:28 peter Exp $
18  */
19 #ifndef	_SCSI_SCSI_CD_H
20 #define _SCSI_SCSI_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 command format
30  */
31 
32 struct scsi_pause
33 {
34 	u_int8_t op_code;
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	1
41 #define PA_RESUME	0
42 
43 struct scsi_play_msf
44 {
45 	u_int8_t op_code;
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 struct scsi_play_track
58 {
59 	u_int8_t op_code;
60 	u_int8_t byte2;
61 	u_int8_t unused[2];
62 	u_int8_t start_track;
63 	u_int8_t start_index;
64 	u_int8_t unused1;
65 	u_int8_t end_track;
66 	u_int8_t end_index;
67 	u_int8_t control;
68 };
69 
70 struct scsi_play_10
71 {
72 	u_int8_t op_code;
73 	u_int8_t byte2;
74 	u_int8_t blk_addr[4];
75 	u_int8_t unused;
76 	u_int8_t xfer_len[2];
77 	u_int8_t control;
78 };
79 
80 struct scsi_play_12
81 {
82 	u_int8_t op_code;
83 	u_int8_t byte2;	/* same as above */
84 	u_int8_t blk_addr[4];
85 	u_int8_t xfer_len[4];
86 	u_int8_t unused;
87 	u_int8_t control;
88 };
89 
90 struct scsi_play_rel_12
91 {
92 	u_int8_t op_code;
93 	u_int8_t byte2;	/* same as above */
94 	u_int8_t blk_addr[4];
95 	u_int8_t xfer_len[4];
96 	u_int8_t track;
97 	u_int8_t control;
98 };
99 
100 struct scsi_read_header
101 {
102 	u_int8_t op_code;
103 	u_int8_t byte2;
104 	u_int8_t blk_addr[4];
105 	u_int8_t unused;
106 	u_int8_t data_len[2];
107 	u_int8_t control;
108 };
109 
110 struct scsi_read_subchannel
111 {
112 	u_int8_t op_code;
113 	u_int8_t byte1;
114 	u_int8_t byte2;
115 #define	SRS_SUBQ	0x40
116 	u_int8_t subchan_format;
117 	u_int8_t unused[2];
118 	u_int8_t track;
119 	u_int8_t data_len[2];
120 	u_int8_t control;
121 };
122 
123 struct scsi_read_toc
124 {
125 	u_int8_t op_code;
126 	u_int8_t byte2;
127 	u_int8_t unused[4];
128 	u_int8_t from_track;
129 	u_int8_t data_len[2];
130 	u_int8_t control;
131 };
132 ;
133 
134 struct scsi_read_cd_capacity
135 {
136 	u_int8_t op_code;
137 	u_int8_t byte2;
138 	u_int8_t addr_3;	/* Most Significant */
139 	u_int8_t addr_2;
140 	u_int8_t addr_1;
141 	u_int8_t addr_0;	/* Least Significant */
142 	u_int8_t unused[3];
143 	u_int8_t control;
144 };
145 
146 /*
147  * Opcodes
148  */
149 #define READ_CD_CAPACITY	0x25	/* slightly different from disk */
150 #define READ_SUBCHANNEL		0x42	/* cdrom read Subchannel */
151 #define READ_TOC		0x43	/* cdrom read TOC */
152 #define READ_HEADER		0x44	/* cdrom read header */
153 #define PLAY_10			0x45	/* cdrom play  'play audio' mode */
154 #define PLAY_MSF		0x47	/* cdrom play Min,Sec,Frames mode */
155 #define PLAY_TRACK		0x48	/* cdrom play track/index mode */
156 #define PLAY_TRACK_REL		0x49	/* cdrom play track/index mode */
157 #define PAUSE			0x4b	/* cdrom pause in 'play audio' mode */
158 #define PLAY_12			0xa5	/* cdrom pause in 'play audio' mode */
159 #define PLAY_TRACK_REL_BIG	0xa9	/* cdrom play track/index mode */
160 
161 
162 
163 struct scsi_read_cd_cap_data
164 {
165 	u_int8_t addr_3;	/* Most significant */
166 	u_int8_t addr_2;
167 	u_int8_t addr_1;
168 	u_int8_t addr_0;	/* Least significant */
169 	u_int8_t length_3;	/* Most significant */
170 	u_int8_t length_2;
171 	u_int8_t length_1;
172 	u_int8_t length_0;	/* Least significant */
173 };
174 
175 union	cd_pages
176 {
177 	struct	audio_page
178 	{
179 		u_int8_t page_code;
180 #define	CD_PAGE_CODE	0x3F
181 #define	AUDIO_PAGE	0x0e
182 #define	CD_PAGE_PS	0x80
183 		u_int8_t param_len;
184 		u_int8_t flags;
185 #define		CD_PA_SOTC	0x02
186 #define		CD_PA_IMMED	0x04
187 		u_int8_t unused[2];
188 		u_int8_t format_lba;
189 #define		CD_PA_FORMAT_LBA	0x0F
190 #define		CD_PA_APR_VALID	0x80
191 		u_int8_t lb_per_sec[2];
192 		struct	port_control
193 		{
194 			u_int8_t channels;
195 #define	CHANNEL 0x0F
196 #define	CHANNEL_0 1
197 #define	CHANNEL_1 2
198 #define	CHANNEL_2 4
199 #define	CHANNEL_3 8
200 #define	LEFT_CHANNEL	CHANNEL_0
201 #define	RIGHT_CHANNEL	CHANNEL_1
202 			u_int8_t volume;
203 		} port[4];
204 #define	LEFT_PORT	0
205 #define	RIGHT_PORT	1
206 	}audio;
207 };
208 
209 struct cd_mode_data
210 {
211 	struct scsi_mode_header_6 header;
212 	struct scsi_mode_blk_desc blk_desc;
213 	union cd_pages page;
214 };
215 #endif /*_SCSI_SCSI_CD_H*/
216 
217