1 #ifndef SONYCD535_H
2 #define SONYCD535_H
3
4
5
6
7 #define SONY535_REQUEST_DRIVE_STATUS_1 (0x80)
8 #define SONY535_REQUEST_SENSE (0x82)
9 #define SONY535_REQUEST_DRIVE_STATUS_2 (0x84)
10 #define SONY535_REQUEST_ERROR_STATUS (0x86)
11 #define SONY535_REQUEST_AUDIO_STATUS (0x88)
12 #define SONY535_INQUIRY (0x8a)
13
14 #define SONY535_SET_INACTIVITY_TIME (0x90)
15
16 #define SONY535_SEEK_AND_READ_N_BLOCKS_1 (0xa0)
17 #define SONY535_SEEK_AND_READ_N_BLOCKS_2 (0xa4)
18 #define SONY535_PLAY_AUDIO (0xa6)
19
20 #define SONY535_REQUEST_DISC_CAPACITY (0xb0)
21 #define SONY535_REQUEST_TOC_DATA (0xb2)
22 #define SONY535_REQUEST_SUB_Q_DATA (0xb4)
23 #define SONY535_REQUEST_ISRC (0xb6)
24 #define SONY535_REQUEST_UPC_EAN (0xb8)
25
26 #define SONY535_SET_DRIVE_MODE (0xc0)
27 #define SONY535_REQUEST_DRIVE_MODE (0xc2)
28 #define SONY535_SET_RETRY_COUNT (0xc4)
29
30 #define SONY535_DIAGNOSTIC_1 (0xc6)
31 #define SONY535_DIAGNOSTIC_4 (0xcc)
32 #define SONY535_DIAGNOSTIC_5 (0xce)
33
34 #define SONY535_EJECT_CADDY (0xd0)
35 #define SONY535_DISABLE_EJECT_BUTTON (0xd2)
36 #define SONY535_ENABLE_EJECT_BUTTON (0xd4)
37
38 #define SONY535_HOLD (0xe0)
39 #define SONY535_AUDIO_PAUSE_ON_OFF (0xe2)
40 #define SONY535_SET_VOLUME (0xe8)
41
42 #define SONY535_STOP (0xf0)
43 #define SONY535_SPIN_UP (0xf2)
44 #define SONY535_SPIN_DOWN (0xf4)
45
46 #define SONY535_CLEAR_PARAMETERS (0xf6)
47 #define SONY535_CLEAR_ENDING_ADDRESS (0xf8)
48
49
50
51
52 #define SONY535_DATA_NOT_READY_BIT (0x1)
53 #define SONY535_RESULT_NOT_READY_BIT (0x2)
54
55
56
57
58 #define SONY535_STATUS1_COMMAND_ERROR (0x1)
59 #define SONY535_STATUS1_DATA_ERROR (0x2)
60 #define SONY535_STATUS1_SEEK_ERROR (0x4)
61 #define SONY535_STATUS1_DISC_TYPE_ERROR (0x8)
62 #define SONY535_STATUS1_NOT_SPINNING (0x10)
63 #define SONY535_STATUS1_EJECT_BUTTON_PRESSED (0x20)
64 #define SONY535_STATUS1_CADDY_NOT_INSERTED (0x40)
65 #define SONY535_STATUS1_BYTE_TWO_FOLLOWS (0x80)
66
67
68
69
70 #define SONY535_CDD_LOADING_ERROR (0x7)
71 #define SONY535_CDD_NO_DISC (0x8)
72 #define SONY535_CDD_UNLOADING_ERROR (0x9)
73 #define SONY535_CDD_CADDY_NOT_INSERTED (0xd)
74 #define SONY535_ATN_RESET_OCCURRED (0x2)
75 #define SONY535_ATN_DISC_CHANGED (0x4)
76 #define SONY535_ATN_RESET_AND_DISC_CHANGED (0x6)
77 #define SONY535_ATN_EJECT_IN_PROGRESS (0xe)
78 #define SONY535_ATN_BUSY (0xf)
79
80
81
82
83 #define SONY535_AUDIO_DRIVE_MODE (0)
84 #define SONY535_CDROM_DRIVE_MODE (0xe0)
85
86 #define SONY535_PLAY_OP_PLAYBACK (0)
87 #define SONY535_PLAY_OP_ENTER_HOLD (1)
88 #define SONY535_PLAY_OP_SET_AUDIO_ENDING_ADDR (2)
89 #define SONY535_PLAY_OP_SCAN_FORWARD (3)
90 #define SONY535_PLAY_OP_SCAN_BACKWARD (4)
91
92
93
94
95 #define SONY_BLOCK_NUMBER(m,s,f) (((m)*60L+(s))*75L+(f))
96 #define SONY_BLOCK_NUMBER_MSF(x) (((x)[0]*60L+(x)[1])*75L+(x)[2])
97
98
99
100
101 #define TIME_OUT (-1)
102 #define NO_CDROM (-2)
103 #define BAD_STATUS (-3)
104 #define CD_BUSY (-4)
105 #define NOT_DATA_CD (-5)
106 #define NO_ROOM (-6)
107
108 #define LOG_START_OFFSET 150
109
110 #define SONY_JIFFIES_TIMEOUT (5*HZ)
111
112
113 #define SONY_READY_RETRIES (50000)
114
115
116 #define SONY535_FAST_POLLS (10000)
117
118
119
120 typedef unsigned char Byte;
121
122
123
124
125
126 struct s535_sony_drive_config
127 {
128 char vendor_id[8];
129 char product_id[16];
130 char product_rev_level[4];
131 };
132
133
134 struct s535_sony_subcode
135 {
136 unsigned char address :4;
137 unsigned char control :4;
138 unsigned char track_num;
139 unsigned char index_num;
140 unsigned char rel_msf[3];
141 unsigned char abs_msf[3];
142 };
143
144 struct s535_sony_disc_capacity
145 {
146 Byte mFirstTrack, sFirstTrack, fFirstTrack;
147 Byte mLeadOut, sLeadOut, fLeadOut;
148 };
149
150
151
152
153
154 struct s535_sony_toc
155 {
156 unsigned char reserved0 :4;
157 unsigned char control0 :4;
158 unsigned char point0;
159 unsigned char first_track_num;
160 unsigned char reserved0a;
161 unsigned char reserved0b;
162 unsigned char reserved1 :4;
163 unsigned char control1 :4;
164 unsigned char point1;
165 unsigned char last_track_num;
166 unsigned char dummy1;
167 unsigned char dummy2;
168 unsigned char reserved2 :4;
169 unsigned char control2 :4;
170 unsigned char point2;
171 unsigned char lead_out_start_msf[3];
172 struct
173 {
174 unsigned char reserved :4;
175 unsigned char control :4;
176 unsigned char track;
177 unsigned char track_start_msf[3];
178 } tracks[100];
179
180 unsigned int lead_out_start_lba;
181 };
182
183 #endif