root/include/linux/mcdx.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Definitions for the Mitsumi CDROM interface
   3  * Copyright (C) 1995 Heiko Schlittermann
   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 (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 #define MCDX_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 #if MCDX_AUTOPROBE == 0
  55         #define MCDX_NDRIVES 1
  56         #define MCDX_DRIVEMAP {         \
  57                         {0x300, 10},    \
  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 /*      The name of the device */
  68 #define MCD "mcdx"      
  69 
  70 #ifdef NOWARN
  71 #define WARN(x)
  72 #else
  73 #define WARN(x) warn x
  74 #endif
  75 
  76 #if MCDX_DEBUG
  77 #define TRACE(x) trace x
  78 #define INIT            0
  79 #define MALLOC          0
  80 #define IOCTL           0
  81 #define OPENCLOSE       0
  82 #define HW              0
  83 #define TALK            0
  84 #define IRQ             0
  85 #define TRANSFER        0
  86 #define REQUEST         0
  87 #define MCDX_DEBUG_TALK 0
  88 #else
  89 #define TRACE(x)
  90 #endif
  91 
  92 /*      The following addresses are taken from the Mitsumi Reference 
  93  *  and describe the possible i/o range for the controller.
  94  */
  95 #define MCDX_IO_BEGIN   ((char*) 0x300) /* first base of i/o addr */
  96 #define MCDX_IO_END             ((char*) 0x3fc) /* last base of i/o addr */
  97 
  98 /*      Per controller 4 bytes i/o are needed. */
  99 #define MCDX_IO_SIZE            4
 100 
 101 /*
 102  *      The Ports & bits
 103  */
 104 
 105 #define MCDX_RBIT_OPEN       0x80
 106 #define MCDX_RBIT_DISKSET    0x40
 107 #define MCDX_RBIT_CHANGED    0x20
 108 #define MCDX_RBIT_CHECK      0x10
 109 #define MCDX_RBIT_AUDIOTR    0x08
 110 #define MCDX_RBIT_RDERR      0x04
 111 #define MCDX_RBIT_AUDIOBS    0x02
 112 #define MCDX_RBIT_CMDERR     0x01
 113 #define MCDX_RBIT_DOOR       0x10
 114 #define MCDX_RBIT_STEN       0x04
 115 #define MCDX_RBIT_DTEN       0x02
 116 
 117 
 118 /*
 119  *      The commands.
 120  */
 121 
 122 #define OPCODE  1               /* offset of opcode */
 123 #define MCDX_CMD_REQUEST_TOC            1, 0x10
 124 #define MCDX_CMD_REQUEST_STATUS         1, 0x40 
 125 #define MCDX_CMD_RESET                          1, 0x60
 126 #define MCDX_CMD_REQUEST_DRIVE_MODE     1, 0xc2
 127 #define MCDX_CMD_SET_INTERLEAVE         2, 0xc8, 0
 128 #define MCDX_CMD_DATAMODE_SET           2, 0xa0, 0
 129         #define MCDX_DATAMODE1          0x01
 130         #define MCDX_DATAMODE2          0x02
 131 #define MCDX_CMD_LOCK_DOOR              2, 0xfe, 0
 132 
 133 #define READ_AHEAD                      4       /* 8 Sectors (4K) */
 134 
 135 /*      Useful macros */
 136 #define e_door(x)               ((x) & MCDX_RBIT_OPEN)
 137 #define e_check(x)              (~(x) & MCDX_RBIT_CHECK)
 138 #define e_notset(x)             (~(x) & MCDX_RBIT_DISKSET)
 139 #define e_changed(x)    ((x) & MCDX_RBIT_CHANGED)
 140 #define e_audio(x)              ((x) & MCDX_RBIT_AUDIOTR)
 141 #define e_audiobusy(x)  ((x) & MCDX_RBIT_AUDIOBS)
 142 #define e_cmderr(x)             ((x) & MCDX_RBIT_CMDERR)
 143 #define e_readerr(x)    ((x) & MCDX_RBIT_RDERR)
 144 
 145 /**     no drive specific */
 146 #define MCDX_CDBLK      2048    /* 2048 cooked data each blk */
 147 
 148 #define MCDX_DATA_TIMEOUT       10      /* jiffies */
 149 
 150 /*
 151  * Access to the msf array
 152  */
 153 #define MSF_MIN         0                       /* minute */
 154 #define MSF_SEC         1                       /* second */
 155 #define MSF_FRM         2                       /* frame  */
 156 
 157 /*
 158  * Errors
 159  */
 160 #define MCDX_E          1                       /* unspec error */
 161 #define MCDX_EOM        2                       /* end of media */

/* [previous][next][first][last][top][bottom][index][help] */