1 /* $Id: aztcd.h,v 0.90 1995/02/02 18:14:28 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 /* use incompatible ioctls for reading in raw and cooked mode */
29 #define AZT_PRIVATE_IOCTLS
30
31 /* Increase this if you get lots of timeouts; if you get kernel panic, replace
32 STEN_LOW_WAIT by STEN_LOW in the source code */
33 #define AZT_STATUS_DELAY 400 /*for timer wait, STEN_LOW_WAIT*/
34 #define AZT_TIMEOUT 8000000 /*for busy wait STEN_LOW, DTEN_LOW*/
35 #define AZT_FAST_TIMEOUT 10000 /*for reading the version string*/
36
37 /* number of times to retry a command before giving up */
38 #define AZT_RETRY_ATTEMPTS 3
39
40 /* port access macros */
41 #define CMD_PORT azt_port
42 #define DATA_PORT azt_port
43 #define STATUS_PORT azt_port+1
44 #define MODE_PORT azt_port+2
45
46 /* status bits */
47 #define AST_CMD_CHECK 0x80 /* command error */
48 #define AST_DSK_CHG 0x20 /* disk removed or changed */
49 #define AST_NOT_READY 0x02 /* no disk in the drive */
50 #define AST_DOOR_OPEN 0x40 /* door is open */
51 #define AST_MODE_BITS 0x1C /* Mode Bits */
52 #define AST_INITIAL 0x0C /* initial, only valid ... */
53 #define AST_BUSY 0x04 /* now playing, only valid
54 in combination with mode
55 bits */
56 /* flag bits */
57 #define AFL_DATA 0x02 /* data available if low */
58 #define AFL_STATUS 0x04 /* status available if low */
59 #define AFL_OP_OK 0x01 /* OP_OK command correct*/
60 #define AFL_PA_OK 0x02 /* PA_OK parameter correct*/
61 #define AFL_OP_ERR 0x05 /* error in command*/
62 #define AFL_PA_ERR 0x06 /* error in parameters*/
63 #define POLLED 0x04 /* polled mode */
64
65 /* commands */
66 #define ACMD_SOFT_RESET 0x10 /* reset drive */
67 #define ACMD_PLAY_READ 0x20 /* read data track in cooked mode */
68 #define ACMD_DATA_READ_RAW 0x21 /* reading in raw mode*/
69 #define ACMD_SEEK_TO_LEADIN 0x31 /* seek to leadin track*/
70 #define ACMD_GET_ERROR 0x40 /* get error code */
71 #define ACMD_GET_STATUS 0x41 /* get status */
72 #define ACMD_GET_Q_CHANNEL 0x50 /* read info from q channel */
73 #define ACMD_EJECT 0x60 /* eject/open tray */
74 #define ACMD_CLOSE 0x61 /* close tray */
75 #define ACMD_PAUSE 0x80 /* pause */
76 #define ACMD_STOP 0x81 /* stop play */
77 #define ACMD_PLAY_AUDIO 0x90 /* play audio track */
78 #define ACMD_SET_VOLUME 0x93 /* set audio level */
79 #define ACMD_GET_VERSION 0xA0 /* get firmware version */
80 #define ACMD_SET_MODE 0xA1 /* set drive mode */
81
82 #define SET_TIMER(func, jifs) \
83 delay_timer.expires = jifs; \
84 delay_timer.function = (void *) func; \
85 add_timer(&delay_timer);
86
87 #define CLEAR_TIMER del_timer(&delay_timer)
88
89 #define MAX_TRACKS 104
90
91 struct msf {
92 unsigned char min;
93 unsigned char sec;
94 unsigned char frame;
95 };
96
97 struct azt_Play_msf {
98 struct msf start;
99 struct msf end;
100 };
101
102 struct azt_DiskInfo {
103 unsigned char first;
104 unsigned char last;
105 struct msf diskLength;
106 struct msf firstTrack;
107 };
108
109 struct azt_Toc {
110 unsigned char ctrl_addr;
111 unsigned char track;
112 unsigned char pointIndex;
113 struct msf trackTime;
114 struct msf diskTime;
115 };