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