<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="MTD NAND Driver Programming Interface" /><link rel="up" href="ch05.html" title="Chapter 5. Advanced board driver functions" /><link rel="prev" href="ch05.html" title="Chapter 5. Advanced board driver functions" /><link rel="next" href="ch05s03.html" title="Bad block table support" /></head><body><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="ch05.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="ch05s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Hardware ECC support"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Hardware_ECC_support"></a>Hardware ECC support</h2></div></div></div><div class="toc"><dl><dt><span class="sect2"><a href="ch05s02.html#Functions_and_constants">Functions and constants</a></span></dt><dt><span class="sect2"><a href="ch05s02.html#Hardware_ECC_with_syndrome_calculation">Hardware ECC with syndrome calculation</a></span></dt></dl></div><div class="sect2" title="Functions and constants"><div class="titlepage"><div><div><h3 class="title"><a id="Functions_and_constants"></a>Functions and constants</h3></div></div></div><p> The nand driver supports three different types of hardware ECC. </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>NAND_ECC_HW3_256</p><p> Hardware ECC generator providing 3 bytes ECC per 256 byte. </p></li><li class="listitem"><p>NAND_ECC_HW3_512</p><p> Hardware ECC generator providing 3 bytes ECC per 512 byte. </p></li><li class="listitem"><p>NAND_ECC_HW6_512</p><p> Hardware ECC generator providing 6 bytes ECC per 512 byte. </p></li><li class="listitem"><p>NAND_ECC_HW8_512</p><p> Hardware ECC generator providing 6 bytes ECC per 512 byte. </p></li></ul></div><p> If your hardware generator has a different functionality add it at the appropriate place in nand_base.c </p><p> The board driver must provide following functions: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>enable_hwecc</p><p> This function is called before reading / writing to the chip. Reset or initialize the hardware generator in this function. The function is called with an argument which let you distinguish between read and write operations. </p></li><li class="listitem"><p>calculate_ecc</p><p> This function is called after read / write from / to the chip. Transfer the ECC from the hardware to the buffer. If the option NAND_HWECC_SYNDROME is set then the function is only called on write. See below. </p></li><li class="listitem"><p>correct_data</p><p> In case of an ECC error this function is called for error detection and correction. Return 1 respectively 2 in case the error can be corrected. If the error is not correctable return -1. If your hardware generator matches the default algorithm of the nand_ecc software generator then use the correction function provided by nand_ecc instead of implementing duplicated code. </p></li></ul></div><p> </p></div><div class="sect2" title="Hardware ECC with syndrome calculation"><div class="titlepage"><div><div><h3 class="title"><a id="Hardware_ECC_with_syndrome_calculation"></a>Hardware ECC with syndrome calculation</h3></div></div></div><p> Many hardware ECC implementations provide Reed-Solomon codes and calculate an error syndrome on read. The syndrome must be converted to a standard Reed-Solomon syndrome before calling the error correction code in the generic Reed-Solomon library. </p><p> The ECC bytes must be placed immidiately after the data bytes in order to make the syndrome generator work. This is contrary to the usual layout used by software ECC. The seperation of data and out of band area is not longer possible. The nand driver code handles this layout and the remaining free bytes in the oob area are managed by the autoplacement code. Provide a matching oob-layout in this case. See rts_from4.c and diskonchip.c for implementation reference. In those cases we must also use bad block tables on FLASH, because the ECC layout is interferring with the bad block marker positions. See bad block table support for details. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch05.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch05s03.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>