1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Hardware ECC support</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="MTD NAND Driver Programming Interface"><link rel="up" href="boarddriversadvanced.html" title="Chapter 5. Advanced board driver functions"><link rel="prev" href="boarddriversadvanced.html" title="Chapter 5. Advanced board driver functions"><link rel="next" href="Bad_Block_table_support.html" title="Bad block table support"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Hardware ECC support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="boarddriversadvanced.html">Prev</a> </td><th width="60%" align="center">Chapter 5. Advanced board driver functions</th><td width="20%" align="right"> <a accesskey="n" href="Bad_Block_table_support.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Hardware_ECC_support"></a>Hardware ECC support</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="Hardware_ECC_support.html#Functions_and_constants">Functions and constants</a></span></dt><dt><span class="sect2"><a href="Hardware_ECC_support.html#Hardware_ECC_with_syndrome_calculation">Hardware ECC with syndrome calculation</a></span></dt></dl></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="Functions_and_constants"></a>Functions and constants</h3></div></div></div><p> 2 The nand driver supports three different types of 3 hardware ECC. 4 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>NAND_ECC_HW3_256</p><p> 5 Hardware ECC generator providing 3 bytes ECC per 6 256 byte. 7 </p></li><li class="listitem"><p>NAND_ECC_HW3_512</p><p> 8 Hardware ECC generator providing 3 bytes ECC per 9 512 byte. 10 </p></li><li class="listitem"><p>NAND_ECC_HW6_512</p><p> 11 Hardware ECC generator providing 6 bytes ECC per 12 512 byte. 13 </p></li><li class="listitem"><p>NAND_ECC_HW8_512</p><p> 14 Hardware ECC generator providing 6 bytes ECC per 15 512 byte. 16 </p></li></ul></div><p> 17 If your hardware generator has a different functionality 18 add it at the appropriate place in nand_base.c 19 </p><p> 20 The board driver must provide following functions: 21 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>enable_hwecc</p><p> 22 This function is called before reading / writing to 23 the chip. Reset or initialize the hardware generator 24 in this function. The function is called with an 25 argument which let you distinguish between read 26 and write operations. 27 </p></li><li class="listitem"><p>calculate_ecc</p><p> 28 This function is called after read / write from / to 29 the chip. Transfer the ECC from the hardware to 30 the buffer. If the option NAND_HWECC_SYNDROME is set 31 then the function is only called on write. See below. 32 </p></li><li class="listitem"><p>correct_data</p><p> 33 In case of an ECC error this function is called for 34 error detection and correction. Return 1 respectively 2 35 in case the error can be corrected. If the error is 36 not correctable return -1. If your hardware generator 37 matches the default algorithm of the nand_ecc software 38 generator then use the correction function provided 39 by nand_ecc instead of implementing duplicated code. 40 </p></li></ul></div><p> 41 </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="Hardware_ECC_with_syndrome_calculation"></a>Hardware ECC with syndrome calculation</h3></div></div></div><p> 42 Many hardware ECC implementations provide Reed-Solomon 43 codes and calculate an error syndrome on read. The syndrome 44 must be converted to a standard Reed-Solomon syndrome 45 before calling the error correction code in the generic 46 Reed-Solomon library. 47 </p><p> 48 The ECC bytes must be placed immediately after the data 49 bytes in order to make the syndrome generator work. This 50 is contrary to the usual layout used by software ECC. The 51 separation of data and out of band area is not longer 52 possible. The nand driver code handles this layout and 53 the remaining free bytes in the oob area are managed by 54 the autoplacement code. Provide a matching oob-layout 55 in this case. See rts_from4.c and diskonchip.c for 56 implementation reference. In those cases we must also 57 use bad block tables on FLASH, because the ECC layout is 58 interfering with the bad block marker positions. 59 See bad block table support for details. 60 </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="boarddriversadvanced.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="boarddriversadvanced.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="Bad_Block_table_support.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Advanced board driver functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Bad block table support</td></tr></table></div></body></html> 61