Driver core: convert msr code to use struct device
[linux-2.6.22.y-op.git] / include / linux / ftape-header-segment.h
blob4732218f070804563f009f44577ceafe61734d55
1 #ifndef _FTAPE_HEADER_SEGMENT_H
2 #define _FTAPE_HEADER_SEGMENT_H
4 /*
5 * Copyright (C) 1996-1997 Claus-Justus Heine.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-header-segment.h,v $
23 * $Revision: 1.2 $
24 * $Date: 1997/10/05 19:19:28 $
26 * This file defines some offsets into the header segment of a
27 * floppy tape cartridge. For use with the QIC-40/80/3010/3020
28 * floppy-tape driver "ftape" for Linux.
31 #define FT_SIGNATURE 0 /* must be 0xaa55aa55 */
32 #define FT_FMT_CODE 4
33 #define FT_REV_LEVEL 5 /* only for QIC-80 since. Rev. L (== 0x0c) */
34 #define FT_HSEG_1 6 /* first header segment, except for format code 6 */
35 #define FT_HSEG_2 8 /* second header segment, except for format code 6 */
36 #define FT_FRST_SEG 10 /* first data segment, except for format code 6 */
37 #define FT_LAST_SEG 12 /* last data segment, except for format code 6 */
38 #define FT_FMT_DATE 14 /* date and time of most recent format, see below */
39 #define FT_WR_DATE 18 /* date and time of most recent write or format */
40 #define FT_SPT 24 /* segments per track */
41 #define FT_TPC 26 /* tracks per cartridge */
42 #define FT_FHM 27 /* floppy drive head (maximum of it) */
43 #define FT_FTM 28 /* floppy track max. */
44 #define FT_FSM 29 /* floppy sector max. (128) */
45 #define FT_LABEL 30 /* floppy tape label */
46 #define FT_LABEL_DATE 74 /* date and time the tape label was written */
47 #define FT_LABEL_SZ (FT_LABEL_DATE - FT_LABEL)
48 #define FT_CMAP_START 78 /* starting segment of compression map */
49 #define FT_FMT_ERROR 128 /* must be set to 0xff if remainder gets lost during
50 * tape format
52 #define FT_SEG_CNT 130 /* number of seg. written, formatted or verified
53 * through lifetime of tape (why not read?)
55 #define FT_INIT_DATE 138 /* date and time of initial tape format */
56 #define FT_FMT_CNT 142 /* number of times tape has been formatted */
57 #define FT_FSL_CNT 144 /* number of segments in failed sector log */
58 #define FT_MK_CODE 146 /* id string of tape manufacturer */
59 #define FT_LOT_CODE 190 /* tape manufacturer lot code */
60 #define FT_6_HSEG_1 234 /* first header segment for format code 6 */
61 #define FT_6_HSEG_2 238 /* second header segment for format code 6 */
62 #define FT_6_FRST_SEG 242 /* first data segment for format code 6 */
63 #define FT_6_LAST_SEG 246 /* last data segment for format code 6 */
65 #define FT_FSL 256
66 #define FT_HEADER_END 256 /* space beyond this point:
67 * format codes 2, 3 and 5:
68 * - failed sector log until byte 2047
69 * - bad sector map in the reamining part of segment
70 * format codes 4 and 6:
71 * - bad sector map starts hear
75 /* value to be stored at the FT_SIGNATURE offset
77 #define FT_HSEG_MAGIC 0xaa55aa55
78 #define FT_D2G_MAGIC 0x82288228 /* Ditto 2GB */
80 /* data and time encoding: */
81 #define FT_YEAR_SHIFT 25
82 #define FT_YEAR_MASK 0xfe000000
83 #define FT_YEAR_0 1970
84 #define FT_YEAR_MAX 127
85 #define FT_YEAR(year) ((((year)-FT_YEAR_0)<<FT_YEAR_SHIFT)&FT_YEAR_MASK)
87 #define FT_TIME_SHIFT 0
88 #define FT_TIME_MASK 0x01FFFFFF
89 #define FT_TIME_MAX 0x01ea6dff /* last second of a year */
90 #define FT_TIME(mo,d,h,m,s) \
91 ((((s)+60*((m)+60*((h)+24*((d)+31*(mo))))) & FT_TIME_MASK))
93 #define FT_TIME_STAMP(y,mo,d,h,m,s) (FT_YEAR(y) | FT_TIME(mo,d,h,m,s))
95 /* values for the format code field */
96 typedef enum {
97 fmt_normal = 2, /* QIC-80 post Rev. B 205Ft or 307Ft tape */
98 fmt_1100ft = 3, /* QIC-80 post Rev. B 1100Ft tape */
99 fmt_var = 4, /* QIC-80 post Rev. B variabel length format */
100 fmt_425ft = 5, /* QIC-80 post Rev. B 425Ft tape */
101 fmt_big = 6 /* QIC-3010/3020 variable length tape with more
102 * than 2^16 segments per tape
104 } ft_format_type;
106 /* definitions for the failed sector log */
107 #define FT_FSL_SIZE (2 * FT_SECTOR_SIZE - FT_HEADER_END)
108 #define FT_FSL_MAX_ENTRIES (FT_FSL_SIZE/sizeof(__u32))
110 typedef struct ft_fsl_entry {
111 __u16 segment;
112 __u16 date;
113 } __attribute__ ((packed)) ft_fsl_entry;
116 /* date encoding for the failed sector log
117 * month: 1..12, day: 1..31, year: 1970..2097
119 #define FT_FSL_TIME_STAMP(y,m,d) \
120 (((((y) - FT_YEAR_0)<<9)&0xfe00) | (((m)<<5)&0x01e0) | ((d)&0x001f))
122 #endif /* _FTAPE_HEADER_SEGMENT_H */