ftape.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. #ifndef _FTAPE_H
  2. #define _FTAPE_H
  3. /*
  4. * Copyright (C) 1994-1996 Bas Laarhoven,
  5. * (C) 1996-1997 Claus-Justus Heine.
  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. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; see the file COPYING. If not, write to
  16. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * $Source: /homes/cvs/ftape-stacked/include/linux/ftape.h,v $
  19. * $Revision: 1.17.6.4 $
  20. * $Date: 1997/11/25 01:52:54 $
  21. *
  22. * This file contains global definitions, typedefs and macro's
  23. * for the QIC-40/80/3010/3020 floppy-tape driver for Linux.
  24. */
  25. #define FTAPE_VERSION "ftape v3.04d 25/11/97"
  26. #ifdef __KERNEL__
  27. #include <linux/interrupt.h>
  28. #include <linux/mm.h>
  29. #endif
  30. #include <linux/types.h>
  31. #include <linux/mtio.h>
  32. #define FT_SECTOR(x) (x+1) /* sector offset into real sector */
  33. #define FT_SECTOR_SIZE 1024
  34. #define FT_SECTORS_PER_SEGMENT 32
  35. #define FT_ECC_SECTORS 3
  36. #define FT_SEGMENT_SIZE ((FT_SECTORS_PER_SEGMENT - FT_ECC_SECTORS) * FT_SECTOR_SIZE)
  37. #define FT_BUFF_SIZE (FT_SECTORS_PER_SEGMENT * FT_SECTOR_SIZE)
  38. /*
  39. * bits of the minor device number that define drive selection
  40. * methods. Could be used one day to access multiple tape
  41. * drives on the same controller.
  42. */
  43. #define FTAPE_SEL_A 0
  44. #define FTAPE_SEL_B 1
  45. #define FTAPE_SEL_C 2
  46. #define FTAPE_SEL_D 3
  47. #define FTAPE_SEL_MASK 3
  48. #define FTAPE_SEL(unit) ((unit) & FTAPE_SEL_MASK)
  49. #define FTAPE_NO_REWIND 4 /* mask for minor nr */
  50. /* the following two may be reported when MTIOCGET is requested ... */
  51. typedef union {
  52. struct {
  53. __u8 error;
  54. __u8 command;
  55. } error;
  56. long space;
  57. } ft_drive_error;
  58. typedef union {
  59. struct {
  60. __u8 drive_status;
  61. __u8 drive_config;
  62. __u8 tape_status;
  63. } status;
  64. long space;
  65. } ft_drive_status;
  66. #ifdef __KERNEL__
  67. #define FT_RQM_DELAY 12
  68. #define FT_MILLISECOND 1
  69. #define FT_SECOND 1000
  70. #define FT_FOREVER -1
  71. #ifndef HZ
  72. #error "HZ undefined."
  73. #endif
  74. #define FT_USPT (1000000/HZ) /* microseconds per tick */
  75. /* This defines the number of retries that the driver will allow
  76. * before giving up (and letting a higher level handle the error).
  77. */
  78. #ifdef TESTING
  79. #define FT_SOFT_RETRIES 1 /* number of low level retries */
  80. #define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
  81. #else
  82. #define FT_SOFT_RETRIES 6 /* number of low level retries (triple) */
  83. #define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
  84. #endif
  85. #ifndef THE_FTAPE_MAINTAINER
  86. #define THE_FTAPE_MAINTAINER "the ftape maintainer"
  87. #endif
  88. /* Initialize missing configuration parameters.
  89. */
  90. #ifndef CONFIG_FT_NR_BUFFERS
  91. # define CONFIG_FT_NR_BUFFERS 3
  92. #endif
  93. #ifndef CONFIG_FT_FDC_THR
  94. # define CONFIG_FT_FDC_THR 8
  95. #endif
  96. #ifndef CONFIG_FT_FDC_MAX_RATE
  97. # define CONFIG_FT_FDC_MAX_RATE 2000
  98. #endif
  99. #ifndef CONFIG_FT_FDC_BASE
  100. # define CONFIG_FT_FDC_BASE 0
  101. #endif
  102. #ifndef CONFIG_FT_FDC_IRQ
  103. # define CONFIG_FT_FDC_IRQ 0
  104. #endif
  105. #ifndef CONFIG_FT_FDC_DMA
  106. # define CONFIG_FT_FDC_DMA 0
  107. #endif
  108. /* Turn some booleans into numbers.
  109. */
  110. #ifdef CONFIG_FT_PROBE_FC10
  111. # undef CONFIG_FT_PROBE_FC10
  112. # define CONFIG_FT_PROBE_FC10 1
  113. #else
  114. # define CONFIG_FT_PROBE_FC10 0
  115. #endif
  116. #ifdef CONFIG_FT_MACH2
  117. # undef CONFIG_FT_MACH2
  118. # define CONFIG_FT_MACH2 1
  119. #else
  120. # define CONFIG_FT_MACH2 0
  121. #endif
  122. /* Insert default settings
  123. */
  124. #if CONFIG_FT_PROBE_FC10 == 1
  125. # if CONFIG_FT_FDC_BASE == 0
  126. # undef CONFIG_FT_FDC_BASE
  127. # define CONFIG_FT_FDC_BASE 0x180
  128. # endif
  129. # if CONFIG_FT_FDC_IRQ == 0
  130. # undef CONFIG_FT_FDC_IRQ
  131. # define CONFIG_FT_FDC_IRQ 9
  132. # endif
  133. # if CONFIG_FT_FDC_DMA == 0
  134. # undef CONFIG_FT_FDC_DMA
  135. # define CONFIG_FT_FDC_DMA 3
  136. # endif
  137. #elif CONFIG_FT_MACH2 == 1 /* CONFIG_FT_PROBE_FC10 == 1 */
  138. # if CONFIG_FT_FDC_BASE == 0
  139. # undef CONFIG_FT_FDC_BASE
  140. # define CONFIG_FT_FDC_BASE 0x1E0
  141. # endif
  142. # if CONFIG_FT_FDC_IRQ == 0
  143. # undef CONFIG_FT_FDC_IRQ
  144. # define CONFIG_FT_FDC_IRQ 6
  145. # endif
  146. # if CONFIG_FT_FDC_DMA == 0
  147. # undef CONFIG_FT_FDC_DMA
  148. # define CONFIG_FT_FDC_DMA 2
  149. # endif
  150. #elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */
  151. # if CONFIG_FT_FDC_BASE == 0
  152. # undef CONFIG_FT_FDC_BASE
  153. # define CONFIG_FT_FDC_BASE 0x370
  154. # endif
  155. # if CONFIG_FT_FDC_IRQ == 0
  156. # undef CONFIG_FT_FDC_IRQ
  157. # define CONFIG_FT_FDC_IRQ 6
  158. # endif
  159. # if CONFIG_FT_FDC_DMA == 0
  160. # undef CONFIG_FT_FDC_DMA
  161. # define CONFIG_FT_FDC_DMA 2
  162. # endif
  163. #else /* CONFIG_FT_ALT_FDC */
  164. # if CONFIG_FT_FDC_BASE == 0
  165. # undef CONFIG_FT_FDC_BASE
  166. # define CONFIG_FT_FDC_BASE 0x3f0
  167. # endif
  168. # if CONFIG_FT_FDC_IRQ == 0
  169. # undef CONFIG_FT_FDC_IRQ
  170. # define CONFIG_FT_FDC_IRQ 6
  171. # endif
  172. # if CONFIG_FT_FDC_DMA == 0
  173. # undef CONFIG_FT_FDC_DMA
  174. # define CONFIG_FT_FDC_DMA 2
  175. # endif
  176. #endif /* standard FDC */
  177. /* some useful macro's
  178. */
  179. #define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x))
  180. #endif /* __KERNEL__ */
  181. #endif