2 * Copyright (c) 1995 Mikael Hybsch
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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
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.
35 typedef unsigned char bcd_t;
36 #define M_msf(msf) msf[0]
37 #define S_msf(msf) msf[1]
38 #define F_msf(msf) msf[2]
40 #define OREG_COMMAND 0
41 #define OREG_WPARAMS 1
42 #define OREG_CONTROL 3
43 #define CBIT_ATTENTION_CLEAR 0x01
44 #define CBIT_RESULT_READY_CLEAR 0x02
45 #define CBIT_DATA_READY_CLEAR 0x04
46 #define CBIT_RPARAM_CLEAR 0x40
47 #define CBIT_RESET_DRIVE 0x80
50 #define SBIT_ATTENTION 0x01
51 #define SBIT_RESULT_READY 0x02
52 #define SBIT_DATA_READY 0x04
53 #define SBIT_BUSY 0x80
57 #define IREG_FSTATUS 3
58 #define FBIT_WPARAM_READY 0x01
60 #define CMD_GET_DRIVE_CONFIG 0x00
61 #define CMD_SET_DRIVE_PARAM 0x10
62 #define CMD_GET_SUBCHANNEL_DATA 0x21
63 #define CMD_GET_TOC 0x24
64 #define CMD_READ_TOC 0x30
66 #define CMD_PLAY_AUDIO 0x40
67 #define CMD_STOP_AUDIO 0x41
68 #define CMD_EJECT 0x50
69 #define CMD_SPIN_UP 0x51
70 #define CMD_SPIN_DOWN 0x52
72 #define ERR_CD_NOT_LOADED 0x20
73 #define ERR_NO_CD_INSIDE 0x21
74 #define ERR_NOT_SPINNING 0x22
75 #define ERR_FATAL_READ_ERROR1 0x53
76 #define ERR_FATAL_READ_ERROR2 0x57
78 #define ATTEN_DRIVE_LOADED 0x80
79 #define ATTEN_EJECT_PUSHED 0x81
80 #define ATTEN_AUDIO_DONE 0x90
81 #define ATTEN_SPIN_UP_DONE 0x24
82 #define ATTEN_SPIN_DOWN 0x27
83 #define ATTEN_EJECT_DONE 0x28
86 struct sony_drive_configuration {
93 /* Almost same as cd_sub_channel_position_data */
94 struct sony_subchannel_position_data {
104 struct sony_tracklist {
105 u_char adr :4; /* xcdplayer needs these two values */
111 #define MAX_TRACKS 100
114 u_char session_number;
130 u_char lead_out_start_msf[3];
132 struct sony_tracklist tracks[MAX_TRACKS];
134 /* The rest is just to take space in case all data is returned */