os/nandboot-R2_0_4/mtd/nand_ecc.c File Reference

#include <linux/types.h>
#include "nand_ecc.h"

Include dependency graph for nand_ecc.c:

Go to the source code of this file.

Functions

static void nand_trans_result (u_char reg2, u_char reg3, u_char *ecc_code)
int nand_calculate_ecc (struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
int nand_correct_data (struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc)
 EXPORT_SYMBOL (nand_calculate_ecc)
 EXPORT_SYMBOL (nand_correct_data)
 MODULE_LICENSE ("GPL")
 MODULE_AUTHOR ("Steven J. Hill <sjhill@realitydiluted.com>")
 MODULE_DESCRIPTION ("Generic NAND ECC support")

Variables

static const u_char nand_ecc_precalc_table []


Function Documentation

EXPORT_SYMBOL ( nand_correct_data   ) 

EXPORT_SYMBOL ( nand_calculate_ecc   ) 

MODULE_AUTHOR ( "Steven J. Hill <sjhill@realitydiluted.com>"   ) 

MODULE_DESCRIPTION ( "Generic NAND ECC support"   ) 

MODULE_LICENSE ( "GPL"   ) 

int nand_calculate_ecc ( struct mtd_info mtd,
const u_char *  dat,
u_char *  ecc_code 
)

nand_calculate_ecc - [NAND Interface] Calculate 3 byte ECC code for 256 byte block : MTD block structure : raw data : buffer for ECC

Definition at line 125 of file nand_ecc.c.

References nand_ecc_precalc_table, and nand_trans_result().

Referenced by nand_scan(), and nand_scan_tail().

int nand_correct_data ( struct mtd_info mtd,
u_char *  dat,
u_char *  read_ecc,
u_char *  calc_ecc 
)

nand_correct_data - [NAND Interface] Detect and correct bit error(s) : MTD block structure : raw data read from the chip : ECC from the chip : the ECC calculated from raw data

Detect and correct a 1 bit error for 256 byte block

Definition at line 167 of file nand_ecc.c.

References a, add, and bit.

Referenced by nand_scan(), and nand_scan_tail().

static void nand_trans_result ( u_char  reg2,
u_char  reg3,
u_char *  ecc_code 
) [static]

nand_trans_result - [GENERIC] create non-inverted ECC : line parity reg 2 : line parity reg 3 : ecc

Creates non-inverted ECC code from line parity

Definition at line 82 of file nand_ecc.c.

References a.

Referenced by nand_calculate_ecc().


Variable Documentation

const u_char nand_ecc_precalc_table[] [static]

Initial value:

 {
        0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00,
        0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
        0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
        0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
        0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
        0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
        0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
        0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
        0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
        0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
        0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
        0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
        0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
        0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
        0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
        0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00
}

Definition at line 54 of file nand_ecc.c.

Referenced by nand_calculate_ecc().


Generated on Fri Nov 28 00:08:36 2008 for elphel by  doxygen 1.5.1