Annotation of sys/dev/isa/mcdreg.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: mcdreg.h,v 1.6 2003/11/16 20:30:06 avsm Exp $ */
2: /* $NetBSD: mcdreg.h,v 1.8 1997/04/04 18:59:37 christos Exp $ */
3:
4: /*
5: * Copyright 1993 by Holger Veit (data part)
6: * Copyright 1993 by Brian Moore (audio part)
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This software was developed by Holger Veit and Brian Moore
20: * for use with "386BSD" and similar operating systems.
21: * "Similar operating systems" includes mainly non-profit oriented
22: * systems for research and education, including but not restricted to
23: * "NetBSD", "FreeBSD", "Mach" (by CMU).
24: * 4. Neither the name of the developer(s) nor the name "386BSD"
25: * may be used to endorse or promote products derived from this
26: * software without specific prior written permission.
27: *
28: * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
29: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
32: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
33: * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
34: * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39: *
40: * This file contains definitions for some cdrom control commands
41: * and status codes. This info was "inherited" from the DOS MTMCDE.SYS
42: * driver, and is thus not complete (and may even be wrong). Some day
43: * the manufacturer or anyone else might provide better documentation,
44: * so this file (and the driver) will then have a better quality.
45: */
46:
47: typedef unsigned char bcd_t;
48: #define M_msf(msf) msf[0]
49: #define S_msf(msf) msf[1]
50: #define F_msf(msf) msf[2]
51:
52: #define MCD_COMMAND 0
53: #define MCD_STATUS 0
54: #define MCD_RDATA 0
55: #define MCD_RESET 1
56: #define MCD_XFER 1
57: #define MCD_CTL2 2 /* XXX Is this right? */
58: #define MCD_CONFIG 3
59: #define MCD_NPORT 4
60:
61: #define MCD_MASK_DMA 0x07 /* bits 2-0 = DMA channel */
62: #define MCD_MASK_IRQ 0x70 /* bits 6-4 = INT number */
63: /* 001 = int 2,9 */
64: /* 010 = int 3 */
65: /* 011 = int 5 */
66: /* 100 = int 10 */
67: /* 101 = int 11 */
68:
69: /* Status bits */
70: #define MCD_ST_DOOROPEN 0x80
71: #define MCD_ST_DSKIN 0x40
72: #define MCD_ST_DSKCHNG 0x20
73: #define MCD_ST_SPINNING 0x10
74: #define MCD_ST_AUDIODISK 0x08 /* audio disk is in */
75: #define MCD_ST_READERR 0x04
76: #define MCD_ST_AUDIOBSY 0x02 /* audio disk is playing */
77: #define MCD_ST_CMDCHECK 0x01 /* command error */
78:
79: /* Xfer bits */
80: #define MCD_XF_STATUSUNAVAIL 0x04
81: #define MCD_XF_DATAUNAVAIL 0x02
82:
83: /* Modes */
84: #define MCD_MD_TESTMODE 0x80 /* 0 = DATALENGTH is valid */
85: #define MCD_MD_DATALENGTH 0x40 /* 1 = read ECC data also */
86: #define MCD_MD_ECCMODE 0x20 /* 1 = disable secondary ECC */
87: #define MCD_MD_SPINDOWN 0x08 /* 1 = spin down */
88: #define MCD_MD_READTOC 0x04 /* 1 = read TOC on GETQCHN */
89: #define MCD_MD_PLAYAUDIO 0x01 /* 1 = play audio through headphones */
90:
91: #define MCD_MD_RAW (MCD_MD_PLAYAUDIO|MCD_MD_ECCMODE|MCD_MD_DATALENGTH)
92: #define MCD_MD_COOKED (MCD_MD_PLAYAUDIO)
93: #define MCD_MD_TOC (MCD_MD_PLAYAUDIO|MCD_MD_READTOC)
94: #define MCD_MD_SLEEP (MCD_MD_PLAYAUDIO|MCD_MD_SPINDOWN)
95:
96: #define MCD_BLKSIZE_RAW sizeof(struct mcd_rawsector)
97: #define MCD_BLKSIZE_COOKED 2048
98:
99: /* Lock states */
100: #define MCD_LK_UNLOCK 0x00
101: #define MCD_LK_LOCK 0x01
102: #define MCD_LK_TEST 0x02
103:
104: /* Config commands */
105: #define MCD_CF_IRQENABLE 0x10
106: #define MCD_CF_DMATIMEOUT 0x08
107: #define MCD_CF_READUPC 0x04
108: #define MCD_CF_DMAENABLE 0x02
109: #define MCD_CF_BLOCKSIZE 0x01
110:
111: /* UPC subcommands */
112: #define MCD_UPC_DISABLE 0x00
113: #define MCD_UPC_ENABLE 0x01
114:
115: /* commands known by the controller */
116: #define MCD_CMDRESET 0x00
117: #define MCD_CMDGETVOLINFO 0x10 /* gets mcd_volinfo */
118: #define MCD_CMDGETDISKINFO 0x11 /* gets mcd_disk */
119: #define MCD_CMDGETQCHN 0x20 /* gets mcd_qchninfo */
120: #define MCD_CMDGETSENSE 0x30 /* gets sense info */
121: #define MCD_CMDGETSTAT 0x40 /* gets a byte of status */
122: #define MCD_CMDSETMODE 0x50 /* set transmission mode, needs byte */
123: #define MCD_CMDSTOPAUDIO 0x70
124: #define MCD_CMDSTOPAUDIOTIME 0x80
125: #define MCD_CMDGETVOLUME 0x8E /* gets mcd_volume */
126: #define MCD_CMDCONFIGDRIVE 0x90
127: #define MCD_CMDSETDRIVEMODE 0xa0 /* set drive mode */
128: #define MCD_CMDSETVOLUME 0xae /* sets mcd_volume */
129: #define MCD_CMDREAD1 0xb0 /* read n sectors */
130: #define MCD_CMDREADSINGLESPEED 0xc0 /* read (single speed) */
131: #define MCD_CMDREADDOUBLESPEED 0xc1 /* read (double speed) */
132: #define MCD_CMDGETDRIVEMODE 0xc2 /* get drive mode */
133: #define MCD_CMDREAD3 0xc3 /* ? */
134: #define MCD_CMDSETINTERLEAVE 0xc8 /* set interleave for read */
135: #define MCD_CMDCONTINFO 0xdc /* get controller info */
136: #define MCD_CMDSTOP 0xf0 /* stop everything */
137: #define MCD_CMDEJECTDISK 0xf6
138: #define MCD_CMDCLOSETRAY 0xf8
139: #define MCD_CMDSETLOCK 0xfe /* needs byte */
140:
141: union mcd_qchninfo {
142: struct {
143: u_char control:4;
144: u_char addr_type:4;
145: u_char trk_no;
146: u_char idx_no;
147: bcd_t track_size[3];
148: u_char :8;
149: bcd_t absolute_pos[3];
150: } toc;
151: struct {
152: u_char control:4;
153: u_char addr_type:4;
154: u_char trk_no;
155: u_char idx_no;
156: bcd_t relative_pos[3];
157: u_char :8;
158: bcd_t absolute_pos[3];
159: } current;
160: struct {
161: u_char control:4;
162: u_char addr_type:4;
163: u_char upccode[7];
164: u_char junk[2];
165: } upc;
166: } __packed;
167:
168: struct mcd_volinfo {
169: bcd_t trk_low;
170: bcd_t trk_high;
171: bcd_t vol_msf[3];
172: bcd_t trk1_msf[3];
173: } __packed;
174:
175: struct mcd_result {
176: u_char length;
177: union {
178: struct {
179: u_char data[1];
180: } raw;
181: struct {
182: u_char code;
183: u_char version;
184: } continfo;
185: union mcd_qchninfo qchninfo;
186: struct mcd_volinfo volinfo;
187: } data;
188: } __packed;
189:
190: struct mcd_command {
191: u_char opcode;
192: u_char length;
193: union {
194: struct {
195: u_char data[1];
196: } raw;
197: struct {
198: bcd_t start_msf[3];
199: bcd_t reserved[3];
200: } seek;
201: struct {
202: bcd_t start_msf[3];
203: bcd_t length[3];
204: } read;
205: struct {
206: bcd_t start_msf[3];
207: bcd_t end_msf[3];
208: } play;
209: struct {
210: u_char mode;
211: } datamode;
212: struct {
213: u_char time;
214: } hold;
215: struct {
216: u_char mode;
217: } drivemode;
218: struct {
219: u_char mode;
220: } lockmode;
221: struct {
222: u_char subcommand;
223: u_char data1, data2;
224: } config;
225: } data;
226: } __packed;
227:
228: struct mcd_mbox {
229: struct mcd_command cmd;
230: struct mcd_result res;
231: } __packed;
232:
233: struct mcd_volume {
234: u_char v0l;
235: u_char v0rs;
236: u_char v0r;
237: u_char v0ls;
238: } __packed;
239:
240: struct mcd_rawsector {
241: u_char sync1[12];
242: u_char header[4];
243: u_char subheader1[4];
244: u_char subheader2[4];
245: u_char data[MCD_BLKSIZE_COOKED];
246: u_char ecc_bits[280];
247: } __packed;
CVSweb