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