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