Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / dev / disk / scd / scdreg.h
1 /*-
2  * Copyright (c) 1995 Mikael Hybsch
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer
10  *    in this position and unchanged.
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. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/i386/isa/scdreg.h,v 1.5 1999/08/28 00:45:02 peter Exp $
29  * $DragonFly: src/sys/dev/disk/scd/Attic/scdreg.h,v 1.2 2003/06/17 04:28:37 dillon Exp $
30  *
31  */
32
33 #ifndef SCD_H
34 #define SCD_H
35
36 #ifdef __GNUC__
37 #if __GNUC__ >= 2
38 #pragma pack(1)
39 #endif
40 #endif
41
42 typedef unsigned char   bcd_t;
43 #define M_msf(msf)      msf[0]
44 #define S_msf(msf)      msf[1]
45 #define F_msf(msf)      msf[2]
46
47 #define IS_ATTENTION(port)      ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0)
48 #define IS_BUSY(port)           ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0)
49 #define IS_DATA_RDY(port)       ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0)
50 #define STATUS_BIT(port, bit)   ((inb(port+IREG_STATUS) & (bit)) != 0)
51 #define FSTATUS_BIT(port, bit)  ((inb(port+IREG_FSTATUS) & (bit)) != 0)
52
53 #define OREG_COMMAND    0
54 #define OREG_WPARAMS    1
55 #define OREG_CONTROL    3
56 #define CBIT_ATTENTION_CLEAR            0x01
57 #define CBIT_RESULT_READY_CLEAR         0x02
58 #define CBIT_DATA_READY_CLEAR           0x04
59 #define CBIT_RPARAM_CLEAR               0x40
60 #define CBIT_RESET_DRIVE                0x80
61
62 #define IREG_STATUS  0
63 #define SBIT_ATTENTION          0x01
64 #define SBIT_RESULT_READY       0x02
65 #define SBIT_DATA_READY         0x04
66 #define SBIT_BUSY               0x80
67
68 #define IREG_RESULT             1
69 #define IREG_DATA               2
70 #define IREG_FSTATUS            3
71 #define FBIT_WPARAM_READY       0x01
72
73 #define CMD_GET_DRIVE_CONFIG    0x00
74 #define CMD_SET_DRIVE_PARAM     0x10
75 #define CMD_GET_SUBCHANNEL_DATA 0x21
76 #define CMD_GET_TOC             0x24
77 #define CMD_READ_TOC            0x30
78 #define CMD_READ                0x34
79 #define CMD_PLAY_AUDIO          0x40
80 #define CMD_STOP_AUDIO          0x41
81 #define CMD_EJECT               0x50
82 #define CMD_SPIN_UP             0x51
83 #define CMD_SPIN_DOWN           0x52
84
85 #define ERR_CD_NOT_LOADED       0x20
86 #define ERR_NO_CD_INSIDE        0x21
87 #define ERR_NOT_SPINNING        0x22
88 #define ERR_FATAL_READ_ERROR1   0x53
89 #define ERR_FATAL_READ_ERROR2   0x57
90
91 #define ATTEN_DRIVE_LOADED      0x80
92 #define ATTEN_EJECT_PUSHED      0x81
93 #define ATTEN_AUDIO_DONE        0x90
94 #define ATTEN_SPIN_UP_DONE      0x24
95 #define ATTEN_SPIN_DOWN         0x27
96 #define ATTEN_EJECT_DONE        0x28
97
98
99 struct sony_drive_configuration {
100         char vendor[8];
101         char product[16];
102         char revision[8];
103         u_short config;
104 };
105
106 /* Almost same as cd_sub_channel_position_data */
107 struct sony_subchannel_position_data {
108         u_char  control:4;
109         u_char  addr_type:4;
110         u_char  track_number;
111         u_char  index_number;
112         u_char  rel_msf[3];
113         u_char  dummy;
114         u_char  abs_msf[3];
115 };
116
117 struct sony_tracklist {
118         u_char adr :4; /* xcdplayer needs these two values */
119         u_char ctl :4;
120         u_char track;
121         u_char start_msf[3];
122 };
123
124 #define MAX_TRACKS 100
125
126 struct sony_toc {
127         u_char session_number;
128
129         u_char :8;
130         u_char :8;
131         u_char first_track;
132         u_char :8;
133         u_char :8;
134
135         u_char :8;
136         u_char :8;
137         u_char last_track;
138         u_char :8;
139         u_char :8;
140
141         u_char :8;
142         u_char :8;
143         u_char lead_out_start_msf[3];
144
145         struct sony_tracklist tracks[MAX_TRACKS];
146
147         /* The rest is just to take space in case all data is returned */
148
149         u_char dummy[6*9];
150 };
151
152 #endif /* SCD_H */