1 /* $NetBSD: scsipi_cd.h,v 1.6 2001/09/02 19:35:21 thorpej Exp $ */ 2 3 /* 4 * Written by Julian Elischer (julian@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@tfs.com) Sept 1992 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 and SCSI-like command format 28 */ 29 30 #define PAUSE 0x4b /* cdrom pause in 'play audio' mode */ 31 struct scsipi_pause { 32 u_int8_t opcode; 33 u_int8_t byte2; 34 u_int8_t unused[6]; 35 u_int8_t resume; 36 u_int8_t control; 37 }; 38 #define PA_PAUSE 0x00 39 #define PA_RESUME 0x01 40 41 #define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */ 42 struct scsipi_play_msf { 43 u_int8_t opcode; 44 u_int8_t byte2; 45 u_int8_t unused; 46 u_int8_t start_m; 47 u_int8_t start_s; 48 u_int8_t start_f; 49 u_int8_t end_m; 50 u_int8_t end_s; 51 u_int8_t end_f; 52 u_int8_t control; 53 }; 54 55 #define PLAY 0x45 /* cdrom play 'play audio' mode */ 56 struct scsipi_play { 57 u_int8_t opcode; 58 u_int8_t byte2; 59 u_int8_t blk_addr[4]; 60 u_int8_t unused; 61 u_int8_t xfer_len[2]; 62 u_int8_t control; 63 }; 64 65 #define READ_HEADER 0x44 /* cdrom read header */ 66 struct scsipi_read_header { 67 u_int8_t opcode; 68 u_int8_t byte2; 69 u_int8_t blk_addr[4]; 70 u_int8_t unused; 71 u_int8_t data_len[2]; 72 u_int8_t control; 73 }; 74 75 #define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */ 76 struct scsipi_read_subchannel { 77 u_int8_t opcode; 78 u_int8_t byte2; 79 u_int8_t byte3; 80 #define SRS_SUBQ 0x40 81 u_int8_t subchan_format; 82 u_int8_t unused[2]; 83 u_int8_t track; 84 u_int8_t data_len[2]; 85 u_int8_t control; 86 }; 87 88 #define READ_TOC 0x43 /* cdrom read TOC */ 89 struct scsipi_read_toc { 90 u_int8_t opcode; 91 u_int8_t byte2; 92 u_int8_t unused[4]; 93 u_int8_t from_track; 94 u_int8_t data_len[2]; 95 u_int8_t control; 96 }; 97 ; 98 99 #define READ_CD_CAPACITY 0x25 /* slightly different from disk */ 100 struct scsipi_read_cd_capacity { 101 u_int8_t opcode; 102 u_int8_t byte2; 103 u_int8_t addr[4]; 104 u_int8_t unused[3]; 105 u_int8_t control; 106 }; 107 108 struct scsipi_read_cd_cap_data { 109 u_int8_t addr[4]; 110 u_int8_t length[4]; 111 }; 112 113 /* mod pages common to scsi and atapi */ 114 struct cd_audio_page { 115 u_int8_t page_code; 116 #define AUDIO_PAGE 0x0e 117 u_int8_t param_len; 118 u_int8_t flags; 119 #define CD_PA_SOTC 0x02 120 #define CD_PA_IMMED 0x04 121 u_int8_t unused[2]; 122 u_int8_t format_lba; /* valid only for SCSI CDs */ 123 #define CD_PA_FORMAT_LBA 0x0F 124 #define CD_PA_APR_VALID 0x80 125 u_int8_t lb_per_sec[2]; 126 struct port_control { 127 u_int8_t channels; 128 #define CHANNEL 0x0F 129 #define CHANNEL_0 1 130 #define CHANNEL_1 2 131 #define CHANNEL_2 4 132 #define CHANNEL_3 8 133 #define LEFT_CHANNEL CHANNEL_0 134 #define RIGHT_CHANNEL CHANNEL_1 135 #define MUTE_CHANNEL 0x0 136 #define BOTH_CHANNEL LEFT_CHANNEL | RIGHT_CHANNEL 137 u_int8_t volume; 138 } port[4]; 139 #define LEFT_PORT 0 140 #define RIGHT_PORT 1 141 }; 142