added my responsibility for the `cpm' port
[unix-history] / sys / i386 / isa / mcdreg.h
CommitLineData
1153d121
RG
1/*
2 * Copyright 1993 by Holger Veit (data part)
3 * Copyright 1993 by Brian Moore (audio part)
d89aadd5 4 * Changes Copyright 1993 by Gary Clark II
1153d121
RG
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This software was developed by Holger Veit and Brian Moore
28287abb 18 * for use with "386BSD" and similar operating systems.
1153d121
RG
19 * "Similar operating systems" includes mainly non-profit oriented
20 * systems for research and education, including but not restricted to
21 * "NetBSD", "FreeBSD", "Mach" (by CMU).
22 * 4. Neither the name of the developer(s) nor the name "386BSD"
23 * may be used to endorse or promote products derived from this
24 * software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER(S) ``AS IS'' AND ANY
27 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER(S) BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
32 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * This file contains definitions for some cdrom control commands
39 * and status codes. This info was "inherited" from the DOS MTMCDE.SYS
40 * driver, and is thus not complete (and may even be wrong). Some day
41 * the manufacturer or anyone else might provide better documentation,
42 * so this file (and the driver) will then have a better quality.
43 *
28287abb 44 * $Id: mcdreg.h,v 1.2 1994/01/16 23:34:17 jkh Exp $
1153d121
RG
45 */
46
47#ifndef MCD_H
48#define MCD_H
49
50#ifdef __GNUC__
51#if __GNUC__ >= 2
52#pragma pack(1)
53#endif
54#endif
55
56typedef unsigned char bcd_t;
57#define M_msf(msf) msf[0]
58#define S_msf(msf) msf[1]
59#define F_msf(msf) msf[2]
60
61/* io lines used */
62#define MCD_IO_BASE 0x300
63
64#define mcd_command 0
65#define mcd_status 0
66#define mcd_rdata 0
67
68#define mcd_reset 1
69#define mcd_xfer 1
70#define mcd_ctl2 2 /* XXX Is this right? */
1153d121 71#define mcd_config 3
d89aadd5 72
1153d121
RG
73#define MCD_MASK_DMA 0x07 /* bits 2-0 = DMA channel */
74#define MCD_MASK_IRQ 0x70 /* bits 6-4 = INT number */
75 /* 001 = int 2,9 */
76 /* 010 = int 3 */
77 /* 011 = int 5 */
78 /* 100 = int 10 */
79 /* 101 = int 11 */
80/* flags */
d89aadd5
JH
81#define STATUS_AVAIL 0xB
82#define DATA_AVAIL 0xF
83
84/* New Flags */
28287abb
RG
85#define M_STATUS_AVAIL 0xFB
86#define M_DATA_AVAIL 0xFD
d89aadd5
JH
87
88/* New Commands */
89#define M_RESET 0x00
28287abb 90#define M_PICKLE 0x04
1153d121
RG
91
92/* ports */
93#define MCD_DATA 0
94#define MCD_FLAGS 1
28287abb
RG
95#define MCD_CTRL 2
96#define CHANNEL 3 /* XXX ??? */
1153d121
RG
97
98/* Status bits */
99#define MCD_ST_DOOROPEN 0x80
100#define MCD_ST_DSKIN 0x40
101#define MCD_ST_DSKCHNG 0x20
102#define MCD_ST_BUSY 0x04
103#define MCD_ST_AUDIOBSY 0x02
104
105/* commands known by the controller */
106#define MCD_CMDRESET 0x00
107#define MCD_CMDGETVOLINFO 0x10 /* gets mcd_volinfo */
108#define MCD_CMDGETQCHN 0x20 /* gets mcd_qchninfo */
109#define MCD_CMDGETSTAT 0x40 /* gets a byte of status */
110#define MCD_CMDSETMODE 0x50 /* set transmission mode, needs byte */
111#define MCD_MD_RAW 0x60
112#define MCD_MD_COOKED 0x01
113#define MCD_MD_TOC 0x05
114#define MCD_CMDSTOPAUDIO 0x70
115#define MCD_CMDGETVOLUME 0x8E /* gets mcd_volume */
116#define MCD_CMDSETVOLUME 0xAE /* sets mcd_volume */
117#define MCD_CMDREAD1 0xB0 /* read n sectors */
118#define MCD_CMDREAD2 0xC0 /* read from-to */
119#define MCD_CMDCONTINFO 0xDC /* Get controller info */
120#define MCD_CMDEJECTDISK 0xF6
121#define MCD_CMDCLOSETRAY 0xF8
122#define MCD_CMDLOCKDRV 0xFE /* needs byte */
123#define MCD_LK_UNLOCK 0x00
124#define MCD_LK_LOCK 0x01
125#define MCD_LK_TEST 0x02
126
127struct mcd_volinfo {
128 bcd_t trk_low;
129 bcd_t trk_high;
130 bcd_t vol_msf[3];
131 bcd_t trk1_msf[3];
132};
133
134struct mcd_qchninfo {
135 u_char ctrl_adr;
136 u_char trk_no;
137 u_char idx_no;
138 bcd_t trk_size_msf[3];
139 u_char :8;
140 bcd_t hd_pos_msf[3];
141};
142
143struct mcd_volume {
144 u_char v0l;
145 u_char v0rs;
146 u_char v0r;
147 u_char v0ls;
148};
149
150struct mcd_read1 {
151 bcd_t start_msf[3];
152 u_char nsec[3];
153};
154
155struct mcd_read2 {
156 bcd_t start_msf[3];
157 bcd_t end_msf[3];
158};
159#endif /* MCD_H */