1 /* $NetBSD: mcdreg.h,v 1.8 1997/04/04 18:59:37 christos Exp $ */
4 * Copyright 1993 by Holger Veit (data part)
5 * Copyright 1993 by Brian Moore (audio part)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This software was developed by Holger Veit and Brian Moore
19 * for use with "386BSD" and similar operating systems.
20 * "Similar operating systems" includes mainly non-profit oriented
21 * systems for research and education, including but not restricted to
22 * "NetBSD", "FreeBSD", "Mach" (by CMU).
23 * 4. Neither the name of the developer(s) nor the name "386BSD"
24 * may be used to endorse or promote products derived from this
25 * software without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
28 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
32 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
33 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 * This file contains definitions for some cdrom control commands
40 * and status codes. This info was "inherited" from the DOS MTMCDE.SYS
41 * driver, and is thus not complete (and may even be wrong). Some day
42 * the manufacturer or anyone else might provide better documentation,
43 * so this file (and the driver) will then have a better quality.
50 typedef unsigned char bcd_t
;
51 #define M_msf(msf) msf[0]
52 #define S_msf(msf) msf[1]
53 #define F_msf(msf) msf[2]
60 #define MCD_CTL2 2 /* XXX Is this right? */
64 #define MCD_MASK_DMA 0x07 /* bits 2-0 = DMA channel */
65 #define MCD_MASK_IRQ 0x70 /* bits 6-4 = INT number */
73 #define MCD_ST_DOOROPEN 0x80
74 #define MCD_ST_DSKIN 0x40
75 #define MCD_ST_DSKCHNG 0x20
76 #define MCD_ST_SPINNING 0x10
77 #define MCD_ST_AUDIODISK 0x08 /* audio disk is in */
78 #define MCD_ST_READERR 0x04
79 #define MCD_ST_AUDIOBSY 0x02 /* audio disk is playing */
80 #define MCD_ST_CMDCHECK 0x01 /* command error */
83 #define MCD_XF_STATUSUNAVAIL 0x04
84 #define MCD_XF_DATAUNAVAIL 0x02
87 #define MCD_MD_TESTMODE 0x80 /* 0 = DATALENGTH is valid */
88 #define MCD_MD_DATALENGTH 0x40 /* 1 = read ECC data also */
89 #define MCD_MD_ECCMODE 0x20 /* 1 = disable secondary ECC */
90 #define MCD_MD_SPINDOWN 0x08 /* 1 = spin down */
91 #define MCD_MD_READTOC 0x04 /* 1 = read TOC on GETQCHN */
92 #define MCD_MD_PLAYAUDIO 0x01 /* 1 = play audio through headphones */
94 #define MCD_MD_RAW (MCD_MD_PLAYAUDIO|MCD_MD_ECCMODE|MCD_MD_DATALENGTH)
95 #define MCD_MD_COOKED (MCD_MD_PLAYAUDIO)
96 #define MCD_MD_TOC (MCD_MD_PLAYAUDIO|MCD_MD_READTOC)
97 #define MCD_MD_SLEEP (MCD_MD_PLAYAUDIO|MCD_MD_SPINDOWN)
99 #define MCD_BLKSIZE_RAW sizeof(struct mcd_rawsector)
100 #define MCD_BLKSIZE_COOKED 2048
103 #define MCD_LK_UNLOCK 0x00
104 #define MCD_LK_LOCK 0x01
105 #define MCD_LK_TEST 0x02
107 /* Config commands */
108 #define MCD_CF_IRQENABLE 0x10
109 #define MCD_CF_DMATIMEOUT 0x08
110 #define MCD_CF_READUPC 0x04
111 #define MCD_CF_DMAENABLE 0x02
112 #define MCD_CF_BLOCKSIZE 0x01
114 /* UPC subcommands */
115 #define MCD_UPC_DISABLE 0x00
116 #define MCD_UPC_ENABLE 0x01
118 /* commands known by the controller */
119 #define MCD_CMDRESET 0x00
120 #define MCD_CMDGETVOLINFO 0x10 /* gets mcd_volinfo */
121 #define MCD_CMDGETDISKINFO 0x11 /* gets mcd_disk */
122 #define MCD_CMDGETQCHN 0x20 /* gets mcd_qchninfo */
123 #define MCD_CMDGETSENSE 0x30 /* gets sense info */
124 #define MCD_CMDGETSTAT 0x40 /* gets a byte of status */
125 #define MCD_CMDSETMODE 0x50 /* set transmission mode, needs byte */
126 #define MCD_CMDSTOPAUDIO 0x70
127 #define MCD_CMDSTOPAUDIOTIME 0x80
128 #define MCD_CMDGETVOLUME 0x8E /* gets mcd_volume */
129 #define MCD_CMDCONFIGDRIVE 0x90
130 #define MCD_CMDSETDRIVEMODE 0xa0 /* set drive mode */
131 #define MCD_CMDSETVOLUME 0xae /* sets mcd_volume */
132 #define MCD_CMDREAD1 0xb0 /* read n sectors */
133 #define MCD_CMDREADSINGLESPEED 0xc0 /* read (single speed) */
134 #define MCD_CMDREADDOUBLESPEED 0xc1 /* read (double speed) */
135 #define MCD_CMDGETDRIVEMODE 0xc2 /* get drive mode */
136 #define MCD_CMDREAD3 0xc3 /* ? */
137 #define MCD_CMDSETINTERLEAVE 0xc8 /* set interleave for read */
138 #define MCD_CMDCONTINFO 0xdc /* get controller info */
139 #define MCD_CMDSTOP 0xf0 /* stop everything */
140 #define MCD_CMDEJECTDISK 0xf6
141 #define MCD_CMDCLOSETRAY 0xf8
142 #define MCD_CMDSETLOCK 0xfe /* needs byte */
152 bcd_t absolute_pos
[3];
159 bcd_t relative_pos
[3];
161 bcd_t absolute_pos
[3];
188 union mcd_qchninfo qchninfo
;
189 struct mcd_volinfo volinfo
;
232 struct mcd_command cmd
;
233 struct mcd_result res
;
243 struct mcd_rawsector
{
246 u_char subheader1
[4];
247 u_char subheader2
[4];
248 u_char data
[MCD_BLKSIZE_COOKED
];
249 u_char ecc_bits
[280];