OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [mcdx.h] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * Definitions for the Mitsumi CDROM interface
3
 * Copyright (C) 1995 1996 Heiko Schlittermann <heiko@lotte.sax.de>
4
 * VERSION: @VERSION@
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 (extensively tested the LU portion)
30
 *  Andreas Kies (testing the mysterious hang up's)
31
 *  ... somebody forgotten?
32
 *  Marcin Dalecki
33
 *
34
 */
35
 
36
/*
37
 *      The following lines are for user configuration
38
 *      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39
 *
40
 *      {0|1} -- 1 if you want the driver detect your drive, may crash and
41
 *      needs a long time to seek.  The higher the address the longer the
42
 *      seek.
43
 *
44
 *  WARNING: AUTOPROBE doesn't work.
45
 */
46
#define MCDX_AUTOPROBE 0
47
 
48
/*
49
 *      Drive specific settings according to the jumpers on the controller
50
 *      board(s).
51
 *      o       MCDX_NDRIVES  :  number of used entries of the following table
52
 *      o       MCDX_DRIVEMAP :  table of {i/o base, irq} per controller
53
 *
54
 *      NOTE: I didn't get a drive at irq 9(2) working.  Not even alone.
55
 */
56
#if MCDX_AUTOPROBE == 0
57
        #define MCDX_NDRIVES 1
58
        #define MCDX_DRIVEMAP {         \
59
                        {0x300, 11},    \
60
                        {0x304, 05},    \
61
                        {0x000, 00},    \
62
                        {0x000, 00},    \
63
                        {0x000, 00},    \
64
                }
65
#else
66
        #error Autoprobing is not implemented yet.
67
#endif
68
 
69
#ifndef MCDX_QUIET
70
#define MCDX_QUIET   1
71
#endif
72
 
73
#ifndef MCDX_DEBUG
74
#define MCDX_DEBUG   0
75
#endif
76
 
77
/* *** make the following line uncommented, if you're sure,
78
 * *** all configuration is done */
79
/* #define I_WAS_HERE */
80
#define I_WAS_HERE   /* delete this line, it's for heiko only */
81
 
82
/*      The name of the device */
83
#define MCDX "mcdx"     
84
 
85
/* Flags for DEBUGGING */
86
#define INIT            0
87
#define MALLOC          0
88
#define IOCTL           0
89
#define PLAYTRK     0
90
#define SUBCHNL     0
91
#define TOCHDR      0
92
#define MS          0
93
#define PLAYMSF     0
94
#define READTOC     0
95
#define OPENCLOSE       0
96
#define HW                  0
97
#define TALK            0
98
#define IRQ             0
99
#define XFER            0
100
#define REQUEST         0
101
#define SLEEP           0
102
 
103
/*      The following addresses are taken from the Mitsumi Reference
104
 *  and describe the possible i/o range for the controller.
105
 */
106
#define MCDX_IO_BEGIN   ((char*) 0x300) /* first base of i/o addr */
107
#define MCDX_IO_END             ((char*) 0x3fc) /* last base of i/o addr */
108
 
109
/*      Per controller 4 bytes i/o are needed. */
110
#define MCDX_IO_SIZE            4
111
 
112
/*
113
 *      Bits
114
 */
115
 
116
/* The status byte, returned from every command, set if
117
 * the description is true */
118
#define MCDX_RBIT_OPEN       0x80       /* door is open */
119
#define MCDX_RBIT_DISKSET    0x40       /* disk set (recognised) */
120
#define MCDX_RBIT_CHANGED    0x20       /* disk was changed */
121
#define MCDX_RBIT_CHECK      0x10       /* disk rotates, servo is on */
122
#define MCDX_RBIT_AUDIOTR    0x08   /* current track is audio */
123
#define MCDX_RBIT_RDERR      0x04       /* read error, refer SENSE KEY */
124
#define MCDX_RBIT_AUDIOBS    0x02       /* currently playing audio */
125
#define MCDX_RBIT_CMDERR     0x01       /* command, param or format error */
126
 
127
/* The I/O Register holding the h/w status of the drive,
128
 * can be read at i/o base + 1 */
129
#define MCDX_RBIT_DOOR       0x10       /* door is open */
130
#define MCDX_RBIT_STEN       0x04       /* if 0, i/o base contains drive status */
131
#define MCDX_RBIT_DTEN       0x02       /* if 0, i/o base contains data */
132
 
133
/*
134
 *      The commands.
135
 */
136
 
137
#define OPCODE  1               /* offset of opcode */
138
#define MCDX_CMD_REQUEST_TOC            1, 0x10
139
#define MCDX_CMD_REQUEST_STATUS         1, 0x40 
140
#define MCDX_CMD_RESET                          1, 0x60
141
#define MCDX_CMD_REQUEST_DRIVE_MODE     1, 0xc2
142
#define MCDX_CMD_SET_INTERLEAVE         2, 0xc8, 0
143
#define MCDX_CMD_DATAMODE_SET           2, 0xa0, 0
144
        #define MCDX_DATAMODE1          0x01
145
        #define MCDX_DATAMODE2          0x02
146
#define MCDX_CMD_LOCK_DOOR              2, 0xfe, 0
147
 
148
#define READ_AHEAD                      4       /* 8 Sectors (4K) */
149
 
150
/*      Useful macros */
151
#define e_door(x)               ((x) & MCDX_RBIT_OPEN)
152
#define e_check(x)              (~(x) & MCDX_RBIT_CHECK)
153
#define e_notset(x)             (~(x) & MCDX_RBIT_DISKSET)
154
#define e_changed(x)    ((x) & MCDX_RBIT_CHANGED)
155
#define e_audio(x)              ((x) & MCDX_RBIT_AUDIOTR)
156
#define e_audiobusy(x)  ((x) & MCDX_RBIT_AUDIOBS)
157
#define e_cmderr(x)             ((x) & MCDX_RBIT_CMDERR)
158
#define e_readerr(x)    ((x) & MCDX_RBIT_RDERR)
159
 
160
/**     no drive specific */
161
#define MCDX_CDBLK      2048    /* 2048 cooked data each blk */
162
 
163
#define MCDX_DATA_TIMEOUT       (HZ/10) /* 0.1 second */
164
 
165
/*
166
 * Access to the msf array
167
 */
168
#define MSF_MIN         0                        /* minute */
169
#define MSF_SEC         1                       /* second */
170
#define MSF_FRM         2                       /* frame  */
171
 
172
/*
173
 * Errors
174
 */
175
#define MCDX_E          1                       /* unspec error */
176
#define MCDX_ST_EOM 0x0100              /* end of media */
177
#define MCDX_ST_DRV 0x00ff              /* mask to query the drive status */
178
 
179
#ifndef I_WAS_HERE
180
#warning You have not edited mcdx.h
181
#warning Perhaps irq and i/o settings are wrong.
182
#endif
183
 
184
/* ex:set ts=4 sw=4: */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.