]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/scsi/scsi_cd.h
This is the Linux generic soundcard driver, version 1.0c. Supports
[FreeBSD/FreeBSD.git] / sys / scsi / scsi_cd.h
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  *      $Id$
18  */
19
20 /*
21  *      Define two bits always in the same place in byte 2 (flag byte)
22  */
23 #define CD_RELADDR      0x01
24 #define CD_MSF          0x02
25
26 /*
27  * SCSI command format
28  */
29
30 struct scsi_read_capacity_cd
31 {
32         u_char  op_code;
33         u_char  byte2;
34         u_char  addr_3; /* Most Significant */
35         u_char  addr_2;
36         u_char  addr_1;
37         u_char  addr_0; /* Least Significant */
38         u_char  unused[3];
39         u_char  control;
40 };
41
42 struct scsi_pause
43 {
44         u_char  op_code;
45         u_char  byte2;
46         u_char  unused[6];
47         u_char  resume;
48         u_char  control;
49 };
50 #define PA_PAUSE        1
51 #define PA_RESUME       0
52
53 struct scsi_play_msf
54 {
55         u_char  op_code;
56         u_char  byte2;
57         u_char  unused;
58         u_char  start_m;
59         u_char  start_s;
60         u_char  start_f;
61         u_char  end_m;
62         u_char  end_s;
63         u_char  end_f;
64         u_char  control;
65 };
66
67 struct scsi_play_track
68 {
69         u_char  op_code;
70         u_char  byte2;
71         u_char  unused[2];
72         u_char  start_track;
73         u_char  start_index;
74         u_char  unused1;
75         u_char  end_track;
76         u_char  end_index;
77         u_char  control;
78 };
79
80 struct scsi_play
81 {
82         u_char  op_code;
83         u_char  byte2;
84         u_char  blk_addr[4];
85         u_char  unused;
86         u_char  xfer_len[2];
87         u_char  control;
88 };
89
90 struct scsi_play_big    
91 {
92         u_char  op_code;
93         u_char  byte2;  /* same as above */
94         u_char  blk_addr[4];
95         u_char  xfer_len[4];
96         u_char  unused;
97         u_char  control;
98 };
99
100 struct scsi_play_rel_big
101 {
102         u_char  op_code;
103         u_char  byte2;  /* same as above */
104         u_char  blk_addr[4];
105         u_char  xfer_len[4];
106         u_char  track;
107         u_char  control;
108 };
109
110 struct scsi_read_header
111 {
112         u_char  op_code;
113         u_char  byte2;
114         u_char  blk_addr[4];
115         u_char  unused;
116         u_char  data_len[2];
117         u_char  control;
118 };
119
120 struct scsi_read_subchannel
121 {
122         u_char  op_code;
123         u_char  byte2;
124         u_char  byte3;
125 #define SRS_SUBQ        0x40
126         u_char  subchan_format;
127         u_char  unused[2];
128         u_char  track;
129         u_char  data_len[2];
130         u_char  control;
131 };
132
133 struct scsi_read_toc
134 {
135         u_char  op_code;
136         u_char  byte2;
137         u_char  unused[4];
138         u_char  from_track;
139         u_char  data_len[2];
140         u_char  control;
141 };
142 ;
143
144 struct scsi_read_cd_capacity
145 {
146         u_char  op_code;
147         u_char  byte2;
148         u_char  addr_3; /* Most Significant */
149         u_char  addr_2;
150         u_char  addr_1;
151         u_char  addr_0; /* Least Significant */
152         u_char  unused[3];
153         u_char  control;
154 };
155
156 /*
157  * Opcodes
158  */
159
160 #define READ_CD_CAPACITY        0x25    /* slightly different from disk */
161 #define READ_SUBCHANNEL         0x42    /* cdrom read Subchannel */
162 #define READ_TOC                0x43    /* cdrom read TOC */
163 #define READ_HEADER             0x44    /* cdrom read header */
164 #define PLAY                    0x45    /* cdrom play  'play audio' mode */
165 #define PLAY_MSF                0x47    /* cdrom play Min,Sec,Frames mode */
166 #define PLAY_TRACK              0x48    /* cdrom play track/index mode */
167 #define PLAY_TRACK_REL          0x49    /* cdrom play track/index mode */
168 #define PAUSE                   0x4b    /* cdrom pause in 'play audio' mode */
169 #define PLAY_BIG                0xa5    /* cdrom pause in 'play audio' mode */
170 #define PLAY_TRACK_REL_BIG      0xa9    /* cdrom play track/index mode */
171
172
173
174 struct scsi_read_cd_cap_data
175 {
176         u_char  addr_3; /* Most significant */
177         u_char  addr_2;
178         u_char  addr_1;
179         u_char  addr_0; /* Least significant */
180         u_char  length_3;       /* Most significant */
181         u_char  length_2;
182         u_char  length_1;
183         u_char  length_0;       /* Least significant */
184 };
185
186 union   cd_pages
187 {
188         struct  audio_page
189         {
190                 u_char  page_code;
191 #define CD_PAGE_CODE    0x3F
192 #define AUDIO_PAGE      0x0e
193 #define CD_PAGE_PS      0x80
194                 u_char  param_len;
195                 u_char  flags;
196 #define         CD_PA_SOTC      0x02
197 #define         CD_PA_IMMED     0x04
198                 u_char  unused[2];
199                 u_char  format_lba;
200 #define         CD_PA_FORMAT_LBA        0x0F
201 #define         CD_PA_APR_VALID 0x80
202                 u_char  lb_per_sec[2];
203                 struct  port_control
204                 {
205                         u_char  channels;
206 #define CHANNEL 0x0F
207 #define CHANNEL_0 1
208 #define CHANNEL_1 2
209 #define CHANNEL_2 4
210 #define CHANNEL_3 8
211 #define LEFT_CHANNEL    CHANNEL_0
212 #define RIGHT_CHANNEL   CHANNEL_1
213                         u_char  volume;
214                 } port[4];
215 #define LEFT_PORT       0
216 #define RIGHT_PORT      1
217         }audio;
218 };
219
220 struct cd_mode_data
221 {
222         struct scsi_mode_header header;
223         struct blk_desc blk_desc;
224         union cd_pages page;
225 };
226