root/drivers/char/ftape/ecc.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  *      Copyright (C) 1993 Ning and David Mosberger.
   3  *      Original:
   4  *      Copyright (C) 1993 Bas Laarhoven.
   5  *      Copyright (C) 1992 David L. Brown, Jr.
   6  *
   7  * This program is free software; you can redistribute it and/or
   8  * modify it under the terms of the GNU General Public License as
   9  * published by the Free Software Foundation; either version 2, or (at
  10  * your option) any later version.
  11  *
  12  * This program is distributed in the hope that it will be useful, but
  13  * WITHOUT ANY WARRANTY; without even the implied warranty of
  14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15  * General Public License for more details.
  16  *
  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,
  20  * USA.
  21  *
  22  *
  23  * $Source: /home/bas/distr/ftape-2.03b/RCS/ecc.h,v $
  24  * $Author: bas $
  25  *
  26  * $Revision: 1.20 $
  27  * $Date: 1995/01/08 14:16:21 $
  28  * $State: Beta $
  29  *
  30  *      This file contains the definitions for the
  31  *      Reed-Solomon error correction code 
  32  *      for the QIC-40/80 tape streamer device driver.
  33  */
  34 #ifndef _ecc_h_
  35 #define _ecc_h_
  36 
  37 typedef unsigned long BAD_SECTOR;
  38 #define BAD_CLEAR(entry) ((entry)=0)
  39 #define BAD_SET(entry,sector) ((entry)|=(1<<(sector)))
  40 #define BAD_CHECK(entry,sector) ((entry)&(1<<(sector)))
  41 
  42 /*
  43  * Return values for ecc_correct_data:
  44  */
  45 enum {
  46         ECC_OK,                 /* Data was correct. */
  47         ECC_CORRECTED,          /* Correctable error in data. */
  48         ECC_FAILED,             /* Could not correct data. */
  49 };
  50 
  51 /*
  52  * Representation of an in memory segment.  MARKED_BAD lists the
  53  * sectors that were marked bad during formatting.  If the N-th sector
  54  * in a segment is marked bad, bit 1<<N will be set in MARKED_BAD.
  55  * The sectors should be read in from the disk and packed, as if the
  56  * bad sectors were not there, and the segment just contained fewer
  57  * sectors.  READ_SECTORS is a bitmap of errors encountered while
  58  * reading the data.  These offsets are relative to the packed data.
  59  * BLOCKS is a count of the sectors not marked bad.  This is just to
  60  * prevent having to count the zero bits in MARKED_BAD each time this
  61  * is needed.  DATA is the actual sector packed data from (or to) the
  62  * tape.
  63  */
  64 struct memory_segment {
  65         BAD_SECTOR marked_bad;
  66         BAD_SECTOR read_bad;
  67         int blocks;
  68         unsigned char *data;
  69         BAD_SECTOR corrected;
  70 };
  71 
  72 /*
  73  * ecc.c defined global variables:
  74  */
  75 #ifdef TEST
  76 extern int ftape_ecc_tracing;
  77 #endif
  78 
  79 /*
  80  * ecc.c defined global functions:
  81  */
  82 extern int ecc_correct_data(struct memory_segment *data);
  83 extern int ecc_set_segment_parity(struct memory_segment *data);
  84 
  85 #endif  /* _ecc_h_ */

/* [previous][next][first][last][top][bottom][index][help] */