5 * Copyright (C) 1993 Ning and David Mosberger.
7 * Copyright (C) 1993 Bas Laarhoven.
8 * Copyright (C) 1992 David L. Brown, Jr.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; see the file COPYING. If not, write to
22 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
26 * $Source: /homes/cvs/ftape-stacked/ftape/lowlevel/ftape-ecc.h,v $
28 * $Date: 1997/10/05 19:18:11 $
30 * This file contains the definitions for the
31 * Reed-Solomon error correction code
32 * for the QIC-40/80 tape streamer device driver.
35 #include "../lowlevel/ftape-bsm.h"
37 #define BAD_CLEAR(entry) ((entry)=0)
38 #define BAD_SET(entry,sector) ((entry)|=(1<<(sector)))
39 #define BAD_CHECK(entry,sector) ((entry)&(1<<(sector)))
42 * Return values for ecc_correct_data:
45 ECC_OK
, /* Data was correct. */
46 ECC_CORRECTED
, /* Correctable error in data. */
47 ECC_FAILED
, /* Could not correct data. */
51 * Representation of an in memory segment. MARKED_BAD lists the
52 * sectors that were marked bad during formatting. If the N-th sector
53 * in a segment is marked bad, bit 1<<N will be set in MARKED_BAD.
54 * The sectors should be read in from the disk and packed, as if the
55 * bad sectors were not there, and the segment just contained fewer
56 * sectors. READ_SECTORS is a bitmap of errors encountered while
57 * reading the data. These offsets are relative to the packed data.
58 * BLOCKS is a count of the sectors not marked bad. This is just to
59 * prevent having to count the zero bits in MARKED_BAD each time this
60 * is needed. DATA is the actual sector packed data from (or to) the
63 struct memory_segment
{
72 * ecc.c defined global variables:
75 extern int ftape_ecc_tracing
;
79 * ecc.c defined global functions:
81 extern int ftape_ecc_correct_data(struct memory_segment
*data
);
82 extern int ftape_ecc_set_segment_parity(struct memory_segment
*data
);
84 #endif /* _FTAPE_ECC_H_ */