OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [char/] [ftape/] [ecc.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/*
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/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/rc203soc/sw/uClinux/drivers/char/ftape/ecc.h,v $
24
 * $Author: jcastillo $
25
 *
26
 * $Revision: 1.1 $
27
 * $Date: 2005-12-20 10:16:52 $
28
 * $State: Exp $
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_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.