Mercurial > yaffs-ecoscentric-gpl
annotate packages/fs/yaffs/current/src/yaffs_ecc.h @ 425:dea4d7d250ad ecos
Move sources into packages/fs/yaffs/current/src/
| author | Ross Younger <wry@ecoscentric.com> |
|---|---|
| date | Fri, 14 May 2010 16:03:09 +0100 |
| parents | yaffs_ecc.h@b5309c9b6d7f |
| children |
| rev | line source |
|---|---|
| 0 | 1 /* |
|
198
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
168
diff
changeset
|
2 * YAFFS: Yet another Flash File System . A NAND-flash specific file system. |
| 0 | 3 * |
|
409
b5309c9b6d7f
yaffs Some cleanups.
Charles Manning <cdhmanning@gmail.com>
parents:
271
diff
changeset
|
4 * Copyright (C) 2002-2010 Aleph One Ltd. |
| 168 | 5 * for Toby Churchill Ltd and Brightstar Engineering |
| 0 | 6 * |
| 7 * Created by Charles Manning <charles@aleph1.co.uk> | |
| 8 * | |
| 9 * This program is free software; you can redistribute it and/or modify | |
| 168 | 10 * it under the terms of the GNU Lesser General Public License version 2.1 as |
| 0 | 11 * published by the Free Software Foundation. |
| 12 * | |
| 168 | 13 * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. |
| 0 | 14 */ |
| 75 | 15 |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
16 /* |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
17 * This code implements the ECC algorithm used in SmartMedia. |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
18 * |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
19 * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes. |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
20 * The two unused bit are set to 1. |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
21 * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
22 * blocks are used on a 512-byte NAND page. |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
23 * |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
24 */ |
| 0 | 25 |
| 26 #ifndef __YAFFS_ECC_H__ | |
| 27 #define __YAFFS_ECC_H__ | |
| 28 | |
| 75 | 29 typedef struct { |
| 0 | 30 unsigned char colParity; |
| 31 unsigned lineParity; | |
| 32 unsigned lineParityPrime; | |
| 33 } yaffs_ECCOther; | |
| 34 | |
| 75 | 35 void yaffs_ECCCalculate(const unsigned char *data, unsigned char *ecc); |
| 36 int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc, | |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
37 const unsigned char *test_ecc); |
| 0 | 38 |
| 75 | 39 void yaffs_ECCCalculateOther(const unsigned char *data, unsigned nBytes, |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
40 yaffs_ECCOther *ecc); |
| 75 | 41 int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes, |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
42 yaffs_ECCOther *read_ecc, |
|
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
43 const yaffs_ECCOther *test_ecc); |
| 0 | 44 #endif |
