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