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