ftape.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:5k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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/config.h>
  32. #include <linux/mtio.h>
  33. #define FT_SECTOR(x) (x+1) /* sector offset into real sector */
  34. #define FT_SECTOR_SIZE 1024
  35. #define FT_SECTORS_PER_SEGMENT   32
  36. #define FT_ECC_SECTORS    3
  37. #define FT_SEGMENT_SIZE ((FT_SECTORS_PER_SEGMENT - FT_ECC_SECTORS) * FT_SECTOR_SIZE)
  38. #define FT_BUFF_SIZE    (FT_SECTORS_PER_SEGMENT * FT_SECTOR_SIZE)
  39. /*
  40.  *   bits of the minor device number that define drive selection
  41.  *   methods. Could be used one day to access multiple tape
  42.  *   drives on the same controller.
  43.  */
  44. #define FTAPE_SEL_A     0
  45. #define FTAPE_SEL_B     1
  46. #define FTAPE_SEL_C     2
  47. #define FTAPE_SEL_D     3
  48. #define FTAPE_SEL_MASK     3
  49. #define FTAPE_SEL(unit) ((unit) & FTAPE_SEL_MASK)
  50. #define FTAPE_NO_REWIND 4 /* mask for minor nr */
  51. /* the following two may be reported when MTIOCGET is requested ... */
  52. typedef union {
  53. struct {
  54. __u8 error;
  55. __u8 command;
  56. } error;
  57. long space;
  58. } ft_drive_error;
  59. typedef union {
  60. struct {
  61. __u8 drive_status;
  62. __u8 drive_config;
  63. __u8 tape_status;
  64. } status;
  65. long space;
  66. } ft_drive_status;
  67. #ifdef __KERNEL__
  68. #define FT_RQM_DELAY    12
  69. #define FT_MILLISECOND  1
  70. #define FT_SECOND       1000
  71. #define FT_FOREVER      -1
  72. #ifndef HZ
  73. #error "HZ undefined."
  74. #endif
  75. #define FT_USPT         (1000000/HZ) /* microseconds per tick */
  76. /* This defines the number of retries that the driver will allow
  77.  * before giving up (and letting a higher level handle the error).
  78.  */
  79. #ifdef TESTING
  80. #define FT_SOFT_RETRIES 1    /* number of low level retries */
  81. #define FT_RETRIES_ON_ECC_ERROR 3  /* ecc error when correcting segment */
  82. #else
  83. #define FT_SOFT_RETRIES 6    /* number of low level retries (triple) */
  84. #define FT_RETRIES_ON_ECC_ERROR 3  /* ecc error when correcting segment */
  85. #endif
  86. #ifndef THE_FTAPE_MAINTAINER
  87. #define THE_FTAPE_MAINTAINER "the ftape maintainer"
  88. #endif
  89. /* Initialize missing configuration parameters.
  90.  */
  91. #ifndef CONFIG_FT_NR_BUFFERS
  92. # define CONFIG_FT_NR_BUFFERS 3
  93. #endif
  94. #ifndef CONFIG_FT_FDC_THR
  95. # define CONFIG_FT_FDC_THR 8
  96. #endif
  97. #ifndef CONFIG_FT_FDC_MAX_RATE
  98. # define CONFIG_FT_FDC_MAX_RATE 2000
  99. #endif
  100. #ifndef CONFIG_FT_FDC_BASE
  101. # define CONFIG_FT_FDC_BASE 0
  102. #endif
  103. #ifndef CONFIG_FT_FDC_IRQ
  104. # define CONFIG_FT_FDC_IRQ  0
  105. #endif
  106. #ifndef CONFIG_FT_FDC_DMA
  107. # define CONFIG_FT_FDC_DMA  0
  108. #endif
  109. /* Turn some booleans into numbers.
  110.  */
  111. #ifdef CONFIG_FT_PROBE_FC10
  112. # undef CONFIG_FT_PROBE_FC10
  113. # define CONFIG_FT_PROBE_FC10 1
  114. #else
  115. # define CONFIG_FT_PROBE_FC10 0
  116. #endif
  117. #ifdef CONFIG_FT_MACH2
  118. # undef CONFIG_FT_MACH2
  119. # define CONFIG_FT_MACH2 1
  120. #else
  121. # define CONFIG_FT_MACH2 0
  122. #endif
  123. /* Insert default settings
  124.  */
  125. #if CONFIG_FT_PROBE_FC10 == 1
  126. # if CONFIG_FT_FDC_BASE == 0
  127. #  undef  CONFIG_FT_FDC_BASE
  128. #  define CONFIG_FT_FDC_BASE 0x180
  129. # endif
  130. # if CONFIG_FT_FDC_IRQ == 0
  131. #  undef  CONFIG_FT_FDC_IRQ
  132. #  define CONFIG_FT_FDC_IRQ 9
  133. # endif
  134. # if CONFIG_FT_FDC_DMA == 0
  135. #  undef  CONFIG_FT_FDC_DMA
  136. #  define CONFIG_FT_FDC_DMA 3
  137. # endif
  138. #elif CONFIG_FT_MACH2 == 1    /* CONFIG_FT_PROBE_FC10 == 1 */
  139. # if CONFIG_FT_FDC_BASE == 0
  140. #  undef  CONFIG_FT_FDC_BASE
  141. #  define CONFIG_FT_FDC_BASE 0x1E0
  142. # endif
  143. # if CONFIG_FT_FDC_IRQ == 0
  144. #  undef  CONFIG_FT_FDC_IRQ
  145. #  define CONFIG_FT_FDC_IRQ 6
  146. # endif
  147. # if CONFIG_FT_FDC_DMA == 0
  148. #  undef  CONFIG_FT_FDC_DMA
  149. #  define CONFIG_FT_FDC_DMA 2
  150. # endif
  151. #elif defined(CONFIG_FT_ALT_FDC)  /* CONFIG_FT_MACH2 */
  152. # if CONFIG_FT_FDC_BASE == 0
  153. #  undef  CONFIG_FT_FDC_BASE
  154. #  define CONFIG_FT_FDC_BASE 0x370
  155. # endif
  156. # if CONFIG_FT_FDC_IRQ == 0
  157. #  undef  CONFIG_FT_FDC_IRQ
  158. #  define CONFIG_FT_FDC_IRQ 6
  159. # endif
  160. # if CONFIG_FT_FDC_DMA == 0
  161. #  undef  CONFIG_FT_FDC_DMA
  162. #  define CONFIG_FT_FDC_DMA 2
  163. # endif
  164. #else                          /* CONFIG_FT_ALT_FDC */
  165. # if CONFIG_FT_FDC_BASE == 0
  166. #  undef  CONFIG_FT_FDC_BASE
  167. #  define CONFIG_FT_FDC_BASE 0x3f0
  168. # endif
  169. # if CONFIG_FT_FDC_IRQ == 0
  170. #  undef  CONFIG_FT_FDC_IRQ
  171. #  define CONFIG_FT_FDC_IRQ 6
  172. # endif
  173. # if CONFIG_FT_FDC_DMA == 0
  174. #  undef  CONFIG_FT_FDC_DMA
  175. #  define CONFIG_FT_FDC_DMA 2
  176. # endif
  177. #endif                         /* standard FDC */
  178. /*      some useful macro's
  179.  */
  180. #define NR_ITEMS(x)     (int)(sizeof(x)/ sizeof(*x))
  181. #endif  /* __KERNEL__ */
  182. #endif