1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*-
* Copyright (c) 1995 Mikael Hybsch
*
* The Linux driver cdu31a has been used as a reference when writing this
* code, therefore bringing it under the GNU Public License. The following
* conditions of redistribution therefore apply:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: scdreg.h,v 1.2 1995/01/29 22:51:41 jkh Exp $
*
*/
#ifndef SCD_H
#define SCD_H
#ifdef __GNUC__
#if __GNUC__ >= 2
#pragma pack(1)
#endif
#endif
typedef unsigned char bcd_t;
#define M_msf(msf) msf[0]
#define S_msf(msf) msf[1]
#define F_msf(msf) msf[2]
#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0)
#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0)
#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0)
#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0)
#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0)
#define OREG_COMMAND 0
#define OREG_WPARAMS 1
#define OREG_CONTROL 3
#define CBIT_ATTENTION_CLEAR 0x01
#define CBIT_RESULT_READY_CLEAR 0x02
#define CBIT_DATA_READY_CLEAR 0x04
#define CBIT_RPARAM_CLEAR 0x40
#define CBIT_RESET_DRIVE 0x80
#define IREG_STATUS 0
#define SBIT_ATTENTION 0x01
#define SBIT_RESULT_READY 0x02
#define SBIT_DATA_READY 0x04
#define SBIT_BUSY 0x80
#define IREG_RESULT 1
#define IREG_DATA 2
#define IREG_FSTATUS 3
#define FBIT_WPARAM_READY 0x01
#define CMD_GET_DRIVE_CONFIG 0x00
#define CMD_SET_DRIVE_PARAM 0x10
#define CMD_GET_SUBCHANNEL_DATA 0x21
#define CMD_GET_TOC 0x24
#define CMD_READ_TOC 0x30
#define CMD_READ 0x34
#define CMD_PLAY_AUDIO 0x40
#define CMD_STOP_AUDIO 0x41
#define CMD_EJECT 0x50
#define CMD_SPIN_UP 0x51
#define CMD_SPIN_DOWN 0x52
#define ERR_CD_NOT_LOADED 0x20
#define ERR_NO_CD_INSIDE 0x21
#define ERR_NOT_SPINNING 0x22
#define ERR_FATAL_READ_ERROR1 0x53
#define ERR_FATAL_READ_ERROR2 0x57
#define ATTEN_DRIVE_LOADED 0x80
#define ATTEN_EJECT_PUSHED 0x81
#define ATTEN_AUDIO_DONE 0x90
#define ATTEN_SPIN_UP_DONE 0x24
#define ATTEN_SPIN_DOWN 0x27
#define ATTEN_EJECT_DONE 0x28
struct sony_drive_configuration {
char vendor[8];
char product[16];
char revision[8];
u_short config;
};
/* Almost same as cd_sub_channel_position_data */
struct sony_subchannel_position_data {
u_char control:4;
u_char addr_type:4;
u_char track_number;
u_char index_number;
u_char rel_msf[3];
u_char dummy;
u_char abs_msf[3];
};
struct sony_tracklist {
u_char adr :4; /* xcdplayer needs these two values */
u_char ctl :4;
u_char track;
u_char start_msf[3];
};
#define MAX_TRACKS 100
struct sony_toc {
u_char session_number;
u_char :8;
u_char :8;
u_char first_track;
u_char :8;
u_char :8;
u_char :8;
u_char :8;
u_char last_track;
u_char :8;
u_char :8;
u_char :8;
u_char :8;
u_char lead_out_start_msf[3];
struct sony_tracklist tracks[MAX_TRACKS];
/* The rest is just to take space in case all data is returned */
u_char dummy[6*9];
};
#endif /* SCD_H */
|