1 /* 2 * Definitions for the Mitsumi CDROM interface 3 * Copyright (C) 1995 Heiko Schlittermann <heiko@lotte.sax.de> 4 * VERSION: 1.5a 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; see the file COPYING. If not, write to 18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 19 * 20 * Thanks to 21 * The Linux Community at all and ... 22 * Martin Harris (he wrote the first Mitsumi Driver) 23 * Eberhard Moenkeberg (he gave me much support and the initial kick) 24 * Bernd Huebner, Ruediger Helsch (Unifix-Software Gmbh, they 25 * improved the original driver) 26 * Jon Tombs, Bjorn Ekwall (module support) 27 * Daniel v. Mosnenck (he sent me the Technical and Programming Reference) 28 * Gerd Knorr (he lent me his PhotoCD) 29 * Nils Faerber and Roger E. Wolff (extensivly tested the LU portion) 30 * ... somebody forgotten? 31 * 32 */ 33
34 /* 35 * The following lines are for user configuration 36 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 * 38 * {0|1} -- 1 if you want the driver detect your drive, may crash and 39 * needs a long time to seek. The higher the address the longer the 40 * seek. 41 * 42 * WARNING: AUTOPROBE doesn't work. 43 */ 44 #defineMCDX_AUTOPROBE 0
45
46 /* 47 * Drive specific settings according to the jumpers on the controller 48 * board(s). 49 * o MCDX_NDRIVES : number of used entries of the following table 50 * o MCDX_DRIVEMAP : table of {i/o base, irq} per controller 51 * 52 * NOTE: I didn't get a drive at irq 9(2) working. Not even alone. 53 */ 54 #ifMCDX_AUTOPROBE == 0
55 #defineMCDX_NDRIVES 1
56 #defineMCDX_DRIVEMAP{ \
57 {0x300, 11}, \
58 {0x304, 05}, \
59 {0x000, 00}, \
60 {0x000, 00}, \
61 {0x000, 00}, \
62 } 63 #else 64 #error Autoprobing is not implemented yet.
65 #endif 66
67 #ifndefMCDX_QUIET 68 #defineMCDX_QUIET 1
69 #endif 70
71 #ifndefMCDX_DEBUG 72 #defineMCDX_DEBUG 0
73 #endif 74
75 /* *** make the following line uncommented, if you're sure, 76 * *** all configuration is done */ 77 /* #define I_WAS_HERE */ 78
79 /* The name of the device */ 80 #defineMCDX "mcdx"
81
82 #ifMCDX_QUIET == 1
83 #defineINFO(x)
84 #else 85 #defineINFO(x) warnx 86 #endif 87
88 #defineWARN(x) warnx 89
90 #ifMCDX_DEBUG == 1
91 #defineTRACE(x) tracex 92 #defineINIT 0
93 #defineMALLOC 0
94 #defineIOCTL 0
95 #definePLAYTRK 0
96 #defineSUBCHNL 0
97 #defineTOCHDR 0
98 #defineMS 0
99 #definePLAYMSF 0
100 #defineREADTOC 0
101 #defineOPENCLOSE 0
102 #defineHW 0
103 #defineTALK 0
104 #defineIRQ 1
105 #defineTRANSFER 0
106 #defineREQUEST 0
107 #else 108 #defineTRACE(x)
109 #endif 110
111 /* The following addresses are taken from the Mitsumi Reference 112 * and describe the possible i/o range for the controller. 113 */ 114 #define MCDX_IO_BEGIN ((char*) 0x300) /* first base of i/o addr */ 115 #define MCDX_IO_END ((char*) 0x3fc) /* last base of i/o addr */ 116
117 /* Per controller 4 bytes i/o are needed. */ 118 #defineMCDX_IO_SIZE 4
119
120 /* 121 * The Ports & bits 122 */ 123
124 #defineMCDX_RBIT_OPEN 0x80
125 #defineMCDX_RBIT_DISKSET 0x40
126 #defineMCDX_RBIT_CHANGED 0x20
127 #defineMCDX_RBIT_CHECK 0x10
128 #defineMCDX_RBIT_AUDIOTR 0x08
129 #defineMCDX_RBIT_RDERR 0x04
130 #defineMCDX_RBIT_AUDIOBS 0x02
131 #defineMCDX_RBIT_CMDERR 0x01
132 #defineMCDX_RBIT_DOOR 0x10
133 #defineMCDX_RBIT_STEN 0x04
134 #defineMCDX_RBIT_DTEN 0x02
135
136
137 /* 138 * The commands. 139 */ 140
141 #define OPCODE 1 /* offset of opcode */ 142 #define MCDX_CMD_REQUEST_TOC 1, 0x10
143 #define MCDX_CMD_REQUEST_STATUS 1, 0x40
144 #define MCDX_CMD_RESET 1, 0x60
145 #define MCDX_CMD_REQUEST_DRIVE_MODE 1, 0xc2
146 #define MCDX_CMD_SET_INTERLEAVE 2, 0xc8, 0
147 #define MCDX_CMD_DATAMODE_SET 2, 0xa0, 0
148 #define MCDX_DATAMODE1 0x01
149 #define MCDX_DATAMODE2 0x02
150 #define MCDX_CMD_LOCK_DOOR 2, 0xfe, 0
151
152 #defineREAD_AHEAD 4 /* 8 Sectors (4K) */ 153
154 /* Useful macros */ 155 #define e_door(x) ((x) & MCDX_RBIT_OPEN)
156 #define e_check(x) (~(x) & MCDX_RBIT_CHECK)
157 #define e_notset(x) (~(x) & MCDX_RBIT_DISKSET)
158 #definee_changed(x) ((x) & MCDX_RBIT_CHANGED)
159 #definee_audio(x) ((x) & MCDX_RBIT_AUDIOTR)
160 #definee_audiobusy(x) ((x) & MCDX_RBIT_AUDIOBS)
161 #definee_cmderr(x) ((x) & MCDX_RBIT_CMDERR)
162 #define e_readerr(x) ((x) & MCDX_RBIT_RDERR)
163
164 /** no drive specific */ 165 #define MCDX_CDBLK 2048 /* 2048 cooked data each blk */ 166
167 #define MCDX_DATA_TIMEOUT (HZ/10) /* 0.1 second */ 168
169 /* 170 * Access to the msf array 171 */ 172 #define MSF_MIN 0 /* minute */ 173 #define MSF_SEC 1 /* second */ 174 #define MSF_FRM 2 /* frame */ 175
176 /* 177 * Errors 178 */ 179 #defineMCDX_E 1 /* unspec error */ 180 #defineMCDX_EOM 2 /* end of media */ 181
182 #ifndefI_WAS_HERE 183 #warning You have not edited mcdx.h
184 #warning Perhaps irq and i/o settings are wrong.
185 #endif