1 1.7 mycroft /* $NetBSD: scsipi_cd.h,v 1.7 2003/09/07 22:11:24 mycroft Exp $ */ 2 1.2 bouyer 3 1.2 bouyer /* 4 1.2 bouyer * Written by Julian Elischer (julian (at) tfs.com) 5 1.2 bouyer * for TRW Financial Systems. 6 1.2 bouyer * 7 1.2 bouyer * TRW Financial Systems, in accordance with their agreement with Carnegie 8 1.2 bouyer * Mellon University, makes this software available to CMU to distribute 9 1.3 enami * or use in any manner that they see fit as long as this message is kept with 10 1.2 bouyer * the software. For this reason TFS also grants any other persons or 11 1.2 bouyer * organisations permission to use or modify this software. 12 1.2 bouyer * 13 1.2 bouyer * TFS supplies this software to be publicly redistributed 14 1.2 bouyer * on the understanding that TFS is not responsible for the correct 15 1.2 bouyer * functioning of this software in any circumstances. 16 1.2 bouyer * 17 1.2 bouyer * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992 18 1.2 bouyer */ 19 1.4 enami 20 1.2 bouyer /* 21 1.2 bouyer * Define two bits always in the same place in byte 2 (flag byte) 22 1.2 bouyer */ 23 1.2 bouyer #define CD_RELADDR 0x01 24 1.2 bouyer #define CD_MSF 0x02 25 1.2 bouyer 26 1.2 bouyer /* 27 1.2 bouyer * SCSI and SCSI-like command format 28 1.2 bouyer */ 29 1.2 bouyer 30 1.7 mycroft #define LOAD_UNLOAD 0xa6 31 1.7 mycroft struct scsipi_load_unload { 32 1.7 mycroft u_int8_t opcode; 33 1.7 mycroft u_int8_t unused1[3]; 34 1.7 mycroft u_int8_t options; 35 1.7 mycroft u_int8_t unused2[3]; 36 1.7 mycroft u_int8_t slot; 37 1.7 mycroft u_int8_t unused3[3]; 38 1.7 mycroft } __attribute__((packed)); 39 1.7 mycroft 40 1.2 bouyer #define PAUSE 0x4b /* cdrom pause in 'play audio' mode */ 41 1.2 bouyer struct scsipi_pause { 42 1.2 bouyer u_int8_t opcode; 43 1.2 bouyer u_int8_t byte2; 44 1.2 bouyer u_int8_t unused[6]; 45 1.2 bouyer u_int8_t resume; 46 1.2 bouyer u_int8_t control; 47 1.7 mycroft } __attribute__((packed)); 48 1.2 bouyer #define PA_PAUSE 0x00 49 1.2 bouyer #define PA_RESUME 0x01 50 1.2 bouyer 51 1.2 bouyer #define PLAY_MSF 0x47 /* cdrom play Min,Sec,Frames mode */ 52 1.2 bouyer struct scsipi_play_msf { 53 1.2 bouyer u_int8_t opcode; 54 1.2 bouyer u_int8_t byte2; 55 1.2 bouyer u_int8_t unused; 56 1.2 bouyer u_int8_t start_m; 57 1.2 bouyer u_int8_t start_s; 58 1.2 bouyer u_int8_t start_f; 59 1.2 bouyer u_int8_t end_m; 60 1.2 bouyer u_int8_t end_s; 61 1.2 bouyer u_int8_t end_f; 62 1.2 bouyer u_int8_t control; 63 1.7 mycroft } __attribute__((packed)); 64 1.2 bouyer 65 1.2 bouyer #define PLAY 0x45 /* cdrom play 'play audio' mode */ 66 1.2 bouyer struct scsipi_play { 67 1.2 bouyer u_int8_t opcode; 68 1.2 bouyer u_int8_t byte2; 69 1.2 bouyer u_int8_t blk_addr[4]; 70 1.2 bouyer u_int8_t unused; 71 1.2 bouyer u_int8_t xfer_len[2]; 72 1.2 bouyer u_int8_t control; 73 1.7 mycroft } __attribute__((packed)); 74 1.2 bouyer 75 1.2 bouyer #define READ_HEADER 0x44 /* cdrom read header */ 76 1.2 bouyer struct scsipi_read_header { 77 1.2 bouyer u_int8_t opcode; 78 1.2 bouyer u_int8_t byte2; 79 1.2 bouyer u_int8_t blk_addr[4]; 80 1.2 bouyer u_int8_t unused; 81 1.2 bouyer u_int8_t data_len[2]; 82 1.2 bouyer u_int8_t control; 83 1.7 mycroft } __attribute__((packed)); 84 1.2 bouyer 85 1.2 bouyer #define READ_SUBCHANNEL 0x42 /* cdrom read Subchannel */ 86 1.2 bouyer struct scsipi_read_subchannel { 87 1.2 bouyer u_int8_t opcode; 88 1.2 bouyer u_int8_t byte2; 89 1.2 bouyer u_int8_t byte3; 90 1.2 bouyer #define SRS_SUBQ 0x40 91 1.2 bouyer u_int8_t subchan_format; 92 1.2 bouyer u_int8_t unused[2]; 93 1.2 bouyer u_int8_t track; 94 1.2 bouyer u_int8_t data_len[2]; 95 1.2 bouyer u_int8_t control; 96 1.7 mycroft } __attribute__((packed)); 97 1.2 bouyer 98 1.2 bouyer #define READ_TOC 0x43 /* cdrom read TOC */ 99 1.2 bouyer struct scsipi_read_toc { 100 1.2 bouyer u_int8_t opcode; 101 1.2 bouyer u_int8_t byte2; 102 1.2 bouyer u_int8_t unused[4]; 103 1.2 bouyer u_int8_t from_track; 104 1.2 bouyer u_int8_t data_len[2]; 105 1.2 bouyer u_int8_t control; 106 1.7 mycroft } __attribute__((packed)); 107 1.2 bouyer 108 1.2 bouyer #define READ_CD_CAPACITY 0x25 /* slightly different from disk */ 109 1.2 bouyer struct scsipi_read_cd_capacity { 110 1.2 bouyer u_int8_t opcode; 111 1.2 bouyer u_int8_t byte2; 112 1.2 bouyer u_int8_t addr[4]; 113 1.2 bouyer u_int8_t unused[3]; 114 1.2 bouyer u_int8_t control; 115 1.7 mycroft } __attribute__((packed)); 116 1.2 bouyer 117 1.2 bouyer struct scsipi_read_cd_cap_data { 118 1.2 bouyer u_int8_t addr[4]; 119 1.2 bouyer u_int8_t length[4]; 120 1.7 mycroft } __attribute__((packed)); 121 1.2 bouyer 122 1.2 bouyer /* mod pages common to scsi and atapi */ 123 1.2 bouyer struct cd_audio_page { 124 1.7 mycroft u_int8_t pg_code; 125 1.3 enami #define AUDIO_PAGE 0x0e 126 1.7 mycroft u_int8_t pg_length; 127 1.2 bouyer u_int8_t flags; 128 1.2 bouyer #define CD_PA_SOTC 0x02 129 1.2 bouyer #define CD_PA_IMMED 0x04 130 1.2 bouyer u_int8_t unused[2]; 131 1.2 bouyer u_int8_t format_lba; /* valid only for SCSI CDs */ 132 1.3 enami #define CD_PA_FORMAT_LBA 0x0F 133 1.2 bouyer #define CD_PA_APR_VALID 0x80 134 1.2 bouyer u_int8_t lb_per_sec[2]; 135 1.3 enami struct port_control { 136 1.3 enami u_int8_t channels; 137 1.2 bouyer #define CHANNEL 0x0F 138 1.2 bouyer #define CHANNEL_0 1 139 1.2 bouyer #define CHANNEL_1 2 140 1.2 bouyer #define CHANNEL_2 4 141 1.2 bouyer #define CHANNEL_3 8 142 1.3 enami #define LEFT_CHANNEL CHANNEL_0 143 1.3 enami #define RIGHT_CHANNEL CHANNEL_1 144 1.3 enami #define MUTE_CHANNEL 0x0 145 1.3 enami #define BOTH_CHANNEL LEFT_CHANNEL | RIGHT_CHANNEL 146 1.2 bouyer u_int8_t volume; 147 1.2 bouyer } port[4]; 148 1.2 bouyer #define LEFT_PORT 0 149 1.2 bouyer #define RIGHT_PORT 1 150 1.2 bouyer }; 151