brute-forced more changes from MontaVista's tree. SCSI partition table read still...
[linux-2.4.git] / drivers / cdrom / aztcd.h
1 /* $Id: aztcd.h,v 2.60 1997/11/29 09:51:22 root Exp root $
2  *
3  * Definitions for a AztechCD268 CD-ROM interface
4  *      Copyright (C) 1994-98  Werner Zimmermann
5  *
6  *      based on Mitsumi CDROM driver by Martin Harriss
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  *  History:    W.Zimmermann adaption to Aztech CD268-01A Version 1.3
23  *              October 1994 Email: Werner.Zimmermann@fht-esslingen.de
24  */
25
26 /* *** change this to set the I/O port address of your CD-ROM drive,
27        set to '-1', if you want autoprobing */
28 #define AZT_BASE_ADDR           -1
29
30 /* list of autoprobing addresses (not more than 15), last value must be 0x000
31    Note: Autoprobing is only enabled, if AZT_BASE_ADDR is set to '-1' ! */
32 #define AZT_BASE_AUTO           { 0x320, 0x300, 0x310, 0x330, 0x000 }
33
34 /* Uncomment this, if your CDROM is connected to a Soundwave32-soundcard
35    and configure AZT_BASE_ADDR and AZT_SW32_BASE_ADDR */
36 /*#define AZT_SW32 1
37 */
38
39 #ifdef AZT_SW32 
40 #define AZT_SW32_BASE_ADDR      0x220  /*I/O port base address of your soundcard*/
41 #endif
42
43 /* Set this to 1, if you want your tray to be locked, set to 0 to prevent tray 
44    from locking */
45 #define AZT_ALLOW_TRAY_LOCK     1
46
47 /*Set this to 1 to allow auto-eject when unmounting a disk, set to 0, if you 
48   don't want the auto-eject feature*/
49 #define AZT_AUTO_EJECT          0
50
51 /*Set this to 1, if you want to use incompatible ioctls for reading in raw and
52   cooked mode */
53 #define AZT_PRIVATE_IOCTLS      1
54
55 /*Set this to 1, if you want multisession support by the ISO fs. Even if you set 
56   this value to '0' you can use multisession CDs. In that case the drive's firm-
57   ware will do the appropriate redirection automatically. The CD will then look
58   like a single session CD (but nevertheless all data may be read). Please read 
59   chapter '5.1 Multisession support' in README.aztcd for details. Normally it's 
60   uncritical to leave this setting untouched */
61 #define AZT_MULTISESSION        1
62
63 /*Uncomment this, if you are using a linux kernel version prior to 2.1.0 */
64 /*#define AZT_KERNEL_PRIOR_2_1 */
65
66 /*---------------------------------------------------------------------------*/
67 /*-----nothing to be configured for normal applications below this line------*/
68
69
70 /* Increase this if you get lots of timeouts; if you get kernel panic, replace
71    STEN_LOW_WAIT by STEN_LOW in the source code */
72 #define AZT_STATUS_DELAY        400       /*for timer wait, STEN_LOW_WAIT*/
73 #define AZT_TIMEOUT             8000000   /*for busy wait STEN_LOW, DTEN_LOW*/
74 #define AZT_FAST_TIMEOUT        10000     /*for reading the version string*/
75
76 /* number of times to retry a command before giving up */
77 #define AZT_RETRY_ATTEMPTS      3
78
79 /* port access macros */
80 #define CMD_PORT                azt_port
81 #define DATA_PORT               azt_port
82 #define STATUS_PORT             azt_port+1
83 #define MODE_PORT               azt_port+2
84 #ifdef  AZT_SW32                
85  #define AZT_SW32_INIT          (unsigned int) (0xFF00 & (AZT_BASE_ADDR*16))
86  #define AZT_SW32_CONFIG_REG    AZT_SW32_BASE_ADDR+0x16  /*Soundwave32 Config. Register*/
87  #define AZT_SW32_ID_REG        AZT_SW32_BASE_ADDR+0x04  /*Soundwave32 ID Version Register*/
88 #endif
89
90 /* status bits */
91 #define AST_CMD_CHECK           0x80            /* 1 = command error */
92 #define AST_DOOR_OPEN           0x40            /* 1 = door is open */
93 #define AST_NOT_READY           0x20            /* 1 = no disk in the drive */
94 #define AST_DSK_CHG             0x02            /* 1 = disk removed or changed */
95 #define AST_MODE                0x01            /* 0=MODE1, 1=MODE2 */
96 #define AST_MODE_BITS           0x1C            /* Mode Bits */
97 #define AST_INITIAL             0x0C            /* initial, only valid ... */
98 #define AST_BUSY                0x04            /* now playing, only valid
99                                                    in combination with mode
100                                                    bits */
101 /* flag bits */
102 #define AFL_DATA                0x02            /* data available if low */
103 #define AFL_STATUS              0x04            /* status available if low */
104 #define AFL_OP_OK               0x01            /* OP_OK command correct*/
105 #define AFL_PA_OK               0x02            /* PA_OK parameter correct*/
106 #define AFL_OP_ERR              0x05            /* error in command*/
107 #define AFL_PA_ERR              0x06            /* error in parameters*/
108 #define POLLED                  0x04            /* polled mode */
109
110 /* commands */
111 #define ACMD_SOFT_RESET         0x10            /* reset drive */
112 #define ACMD_PLAY_READ          0x20            /* read data track in cooked mode */
113 #define ACMD_PLAY_READ_RAW      0x21            /* reading in raw mode*/
114 #define ACMD_SEEK               0x30            /* seek msf address*/
115 #define ACMD_SEEK_TO_LEADIN     0x31            /* seek to leadin track*/
116 #define ACMD_GET_ERROR          0x40            /* get error code */
117 #define ACMD_GET_STATUS         0x41            /* get status */
118 #define ACMD_GET_Q_CHANNEL      0x50            /* read info from q channel */
119 #define ACMD_EJECT              0x60            /* eject/open tray */
120 #define ACMD_CLOSE              0x61            /* close tray */
121 #define ACMD_LOCK               0x71            /* lock tray closed */
122 #define ACMD_UNLOCK             0x72            /* unlock tray */
123 #define ACMD_PAUSE              0x80            /* pause */
124 #define ACMD_STOP               0x81            /* stop play */
125 #define ACMD_PLAY_AUDIO         0x90            /* play audio track */
126 #define ACMD_SET_VOLUME         0x93            /* set audio level */
127 #define ACMD_GET_VERSION        0xA0            /* get firmware version */
128 #define ACMD_SET_DISK_TYPE      0xA1            /* set disk data mode */
129
130 #define MAX_TRACKS              104
131
132 struct msf {
133         unsigned char   min;
134         unsigned char   sec;
135         unsigned char   frame;
136 };
137
138 struct azt_Play_msf {
139         struct msf      start;
140         struct msf      end;
141 };
142
143 struct azt_DiskInfo {
144         unsigned char   first;
145         unsigned char   next;
146         unsigned char   last;
147         struct msf      diskLength;
148         struct msf      firstTrack;
149         unsigned char   multi;
150         struct msf      nextSession;
151         struct msf      lastSession;
152         unsigned char   xa;
153         unsigned char   audio;
154 };
155
156 struct azt_Toc {
157         unsigned char   ctrl_addr;
158         unsigned char   track;
159         unsigned char   pointIndex;
160         struct msf      trackTime;
161         struct msf      diskTime;
162 };