mcdreg.h revision 1.5 1 /* $NetBSD: mcdreg.h,v 1.5 1994/10/27 04:17:59 cgd Exp $ */
2
3 /*
4 * Copyright 1993 by Holger Veit (data part)
5 * Copyright 1993 by Brian Moore (audio part)
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
26 *
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.
38 *
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.
44 */
45
46 #ifdef __GNUC__
47 #if __GNUC__ >= 2
48 #pragma pack(1)
49 #endif
50 #endif
51
52 typedef unsigned char bcd_t;
53 #define M_msf(msf) msf[0]
54 #define S_msf(msf) msf[1]
55 #define F_msf(msf) msf[2]
56
57 /* io lines used */
58 #define MCD_IO_BASE 0x300
59
60 #define mcd_command 0
61 #define mcd_status 0
62 #define mcd_rdata 0
63
64 #define mcd_reset 1
65 #define mcd_xfer 1
66 #define mcd_ctl2 2 /* XXX Is this right? */
67
68 #define mcd_config 3
69 #define MCD_MASK_DMA 0x07 /* bits 2-0 = DMA channel */
70 #define MCD_MASK_IRQ 0x70 /* bits 6-4 = INT number */
71 /* 001 = int 2,9 */
72 /* 010 = int 3 */
73 /* 011 = int 5 */
74 /* 100 = int 10 */
75 /* 101 = int 11 */
76
77 /* Status bits */
78 #define MCD_ST_DOOROPEN 0x80
79 #define MCD_ST_DSKIN 0x40
80 #define MCD_ST_DSKCHNG 0x20
81 #define MCD_ST_BUSY 0x04
82 #define MCD_ST_AUDIOBSY 0x02
83
84 /* commands known by the controller */
85 #define MCD_CMDRESET 0x00
86 #define MCD_CMDGETVOLINFO 0x10 /* gets mcd_volinfo */
87 #define MCD_CMDGETQCHN 0x20 /* gets mcd_qchninfo */
88 #define MCD_CMDGETSTAT 0x40 /* gets a byte of status */
89 #define MCD_CMDSETMODE 0x50 /* set transmission mode, needs byte */
90 #define MCD_MD_RAW 0x60
91 #define MCD_MD_COOKED 0x01
92 #define MCD_MD_TOC 0x05
93 #define MCD_CMDSTOPAUDIO 0x70
94 #define MCD_CMDGETVOLUME 0x8E /* gets mcd_volume */
95 #define MCD_CMDSETVOLUME 0xAE /* sets mcd_volume */
96 #define MCD_CMDREAD1 0xB0 /* read n sectors */
97 #define MCD_CMDREAD2 0xC0 /* read from-to */
98 #define MCD_CMDCONTINFO 0xDC /* Get controller info */
99 #define MCD_CMDEJECTDISK 0xF6
100 #define MCD_CMDCLOSETRAY 0xF8
101 #define MCD_CMDLOCKDRV 0xFE /* needs byte */
102 #define MCD_LK_UNLOCK 0x00
103 #define MCD_LK_LOCK 0x01
104 #define MCD_LK_TEST 0x02
105
106 struct mcd_volinfo {
107 bcd_t trk_low;
108 bcd_t trk_high;
109 bcd_t vol_msf[3];
110 bcd_t trk1_msf[3];
111 };
112
113 struct mcd_qchninfo {
114 u_char ctrl_adr;
115 u_char trk_no;
116 u_char idx_no;
117 bcd_t trk_size_msf[3];
118 u_char :8;
119 bcd_t hd_pos_msf[3];
120 };
121
122 struct mcd_volume {
123 u_char v0l;
124 u_char v0rs;
125 u_char v0r;
126 u_char v0ls;
127 };
128
129 struct mcd_read1 {
130 bcd_t start_msf[3];
131 u_char nsec[3];
132 };
133
134 struct mcd_read2 {
135 bcd_t start_msf[3];
136 bcd_t end_msf[3];
137 };
138