mcdx.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  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. * The following lines are for user configuration
  37. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38. *
  39. * {0|1} -- 1 if you want the driver detect your drive, may crash and
  40. * needs a long time to seek. The higher the address the longer the
  41. * seek.
  42. *
  43. * WARNING: AUTOPROBE doesn't work.
  44. */
  45. #define MCDX_AUTOPROBE 0
  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, 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. #ifndef MCDX_QUIET
  67. #define MCDX_QUIET 1
  68. #endif
  69. #ifndef MCDX_DEBUG
  70. #define MCDX_DEBUG 0
  71. #endif
  72. /* *** make the following line uncommented, if you're sure,
  73. * *** all configuration is done */
  74. /* #define I_WAS_HERE */
  75. /* The name of the device */
  76. #define MCDX "mcdx"
  77. /* Flags for DEBUGGING */
  78. #define INIT 0
  79. #define MALLOC 0
  80. #define IOCTL 0
  81. #define PLAYTRK 0
  82. #define SUBCHNL 0
  83. #define TOCHDR 0
  84. #define MS 0
  85. #define PLAYMSF 0
  86. #define READTOC 0
  87. #define OPENCLOSE 0
  88. #define HW 0
  89. #define TALK 0
  90. #define IRQ 0
  91. #define XFER 0
  92. #define REQUEST 0
  93. #define SLEEP 0
  94. /* The following addresses are taken from the Mitsumi Reference
  95. * and describe the possible i/o range for the controller.
  96. */
  97. #define MCDX_IO_BEGIN ((char*) 0x300) /* first base of i/o addr */
  98. #define MCDX_IO_END ((char*) 0x3fc) /* last base of i/o addr */
  99. /* Per controller 4 bytes i/o are needed. */
  100. #define MCDX_IO_SIZE 4
  101. /*
  102. * Bits
  103. */
  104. /* The status byte, returned from every command, set if
  105. * the description is true */
  106. #define MCDX_RBIT_OPEN 0x80 /* door is open */
  107. #define MCDX_RBIT_DISKSET 0x40 /* disk set (recognised) */
  108. #define MCDX_RBIT_CHANGED 0x20 /* disk was changed */
  109. #define MCDX_RBIT_CHECK 0x10 /* disk rotates, servo is on */
  110. #define MCDX_RBIT_AUDIOTR 0x08 /* current track is audio */
  111. #define MCDX_RBIT_RDERR 0x04 /* read error, refer SENSE KEY */
  112. #define MCDX_RBIT_AUDIOBS 0x02 /* currently playing audio */
  113. #define MCDX_RBIT_CMDERR 0x01 /* command, param or format error */
  114. /* The I/O Register holding the h/w status of the drive,
  115. * can be read at i/o base + 1 */
  116. #define MCDX_RBIT_DOOR 0x10 /* door is open */
  117. #define MCDX_RBIT_STEN 0x04 /* if 0, i/o base contains drive status */
  118. #define MCDX_RBIT_DTEN 0x02 /* if 0, i/o base contains data */
  119. /*
  120. * The commands.
  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. #define READ_AHEAD 4 /* 8 Sectors (4K) */
  133. /* Useful macros */
  134. #define e_door(x) ((x) & MCDX_RBIT_OPEN)
  135. #define e_check(x) (~(x) & MCDX_RBIT_CHECK)
  136. #define e_notset(x) (~(x) & MCDX_RBIT_DISKSET)
  137. #define e_changed(x) ((x) & MCDX_RBIT_CHANGED)
  138. #define e_audio(x) ((x) & MCDX_RBIT_AUDIOTR)
  139. #define e_audiobusy(x) ((x) & MCDX_RBIT_AUDIOBS)
  140. #define e_cmderr(x) ((x) & MCDX_RBIT_CMDERR)
  141. #define e_readerr(x) ((x) & MCDX_RBIT_RDERR)
  142. /** no drive specific */
  143. #define MCDX_CDBLK 2048 /* 2048 cooked data each blk */
  144. #define MCDX_DATA_TIMEOUT (HZ/10) /* 0.1 second */
  145. /*
  146. * Access to the msf array
  147. */
  148. #define MSF_MIN 0 /* minute */
  149. #define MSF_SEC 1 /* second */
  150. #define MSF_FRM 2 /* frame */
  151. /*
  152. * Errors
  153. */
  154. #define MCDX_E 1 /* unspec error */
  155. #define MCDX_ST_EOM 0x0100 /* end of media */
  156. #define MCDX_ST_DRV 0x00ff /* mask to query the drive status */
  157. #ifndef I_WAS_HERE
  158. #ifndef MODULE
  159. #warning You have not edited mcdx.h
  160. #warning Perhaps irq and i/o settings are wrong.
  161. #endif
  162. #endif
  163. /* ex:set ts=4 sw=4: */