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