1 /* $Id: aztcd.h,v 1.0 1995/03/25 08:27:19 root Exp $
2 * Definitions for a AztechCD268 CD-ROM interface
3 * Copyright (C) 1994, 1995 Werner Zimmermann
4 *
5 * based on Mitsumi CDROM driver by Martin Harriss
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * History: W.Zimmermann adaption to Aztech CD268-01A Version 1.3
22 * October 1994 Email: zimmerma@rz.fht-esslingen.de
23 */
24
25 /* *** change this to set the I/O port address */
26 #define AZT_BASE_ADDR 0x320
27
28 /* Comment this out to prevent tray from locking */
29 #define AZT_ALLOW_TRAY_LOCK 1
30
31 /* use incompatible ioctls for reading in raw and cooked mode */
32 #define AZT_PRIVATE_IOCTLS
33
34 /* Increase this if you get lots of timeouts; if you get kernel panic, replace
35 STEN_LOW_WAIT by STEN_LOW in the source code */
36 #define AZT_STATUS_DELAY 400 /*for timer wait, STEN_LOW_WAIT*/
37 #define AZT_TIMEOUT 8000000 /*for busy wait STEN_LOW, DTEN_LOW*/
38 #define AZT_FAST_TIMEOUT 10000 /*for reading the version string*/
39
40 /* number of times to retry a command before giving up */
41 #define AZT_RETRY_ATTEMPTS 3
42
43 /* port access macros */
44 #define CMD_PORT azt_port
45 #define DATA_PORT azt_port
46 #define STATUS_PORT azt_port+1
47 #define MODE_PORT azt_port+2
48
49 /* status bits */
50 #define AST_CMD_CHECK 0x80 /* command error */
51 #define AST_DSK_CHG 0x20 /* disk removed or changed */
52 #define AST_NOT_READY 0x02 /* no disk in the drive */
53 #define AST_DOOR_OPEN 0x40 /* door is open */
54 #define AST_MODE_BITS 0x1C /* Mode Bits */
55 #define AST_INITIAL 0x0C /* initial, only valid ... */
56 #define AST_BUSY 0x04 /* now playing, only valid
57 in combination with mode
58 bits */
59 /* flag bits */
60 #define AFL_DATA 0x02 /* data available if low */
61 #define AFL_STATUS 0x04 /* status available if low */
62 #define AFL_OP_OK 0x01 /* OP_OK command correct*/
63 #define AFL_PA_OK 0x02 /* PA_OK parameter correct*/
64 #define AFL_OP_ERR 0x05 /* error in command*/
65 #define AFL_PA_ERR 0x06 /* error in parameters*/
66 #define POLLED 0x04 /* polled mode */
67
68 /* commands */
69 #define ACMD_SOFT_RESET 0x10 /* reset drive */
70 #define ACMD_PLAY_READ 0x20 /* read data track in cooked mode */
71 #define ACMD_DATA_READ_RAW 0x21 /* reading in raw mode*/
72 #define ACMD_SEEK_TO_LEADIN 0x31 /* seek to leadin track*/
73 #define ACMD_GET_ERROR 0x40 /* get error code */
74 #define ACMD_GET_STATUS 0x41 /* get status */
75 #define ACMD_GET_Q_CHANNEL 0x50 /* read info from q channel */
76 #define ACMD_EJECT 0x60 /* eject/open tray */
77 #define ACMD_CLOSE 0x61 /* close tray */
78 #define ACMD_LOCK 0x71 /* lock tray closed */
79 #define ACMD_UNLOCK 0x72 /* unlock tray */
80 #define ACMD_PAUSE 0x80 /* pause */
81 #define ACMD_STOP 0x81 /* stop play */
82 #define ACMD_PLAY_AUDIO 0x90 /* play audio track */
83 #define ACMD_SET_VOLUME 0x93 /* set audio level */
84 #define ACMD_GET_VERSION 0xA0 /* get firmware version */
85 #define ACMD_SET_MODE 0xA1 /* set drive mode */
86
87 #define SET_TIMER(func, jifs) \
88 delay_timer.expires = jifs; \
89 delay_timer.function = (void *) func; \
90 add_timer(&delay_timer);
91
92 #define CLEAR_TIMER del_timer(&delay_timer)
93
94 #define MAX_TRACKS 104
95
96 struct msf {
97 unsigned char min;
98 unsigned char sec;
99 unsigned char frame;
100 };
101
102 struct azt_Play_msf {
103 struct msf start;
104 struct msf end;
105 };
106
107 struct azt_DiskInfo {
108 unsigned char first;
109 unsigned char last;
110 struct msf diskLength;
111 struct msf firstTrack;
112 };
113
114 struct azt_Toc {
115 unsigned char ctrl_addr;
116 unsigned char track;
117 unsigned char pointIndex;
118 struct msf trackTime;
119 struct msf diskTime;
120 };