1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>nand_check_erased_ecc_chunk</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="pubfunctions.html" title="Chapter 10. Public Functions Provided"><link rel="prev" href="API-nand-lock.html" title="nand_lock"><link rel="next" href="API-nand-scan-ident.html" title="nand_scan_ident"></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"><span class="phrase">nand_check_erased_ecc_chunk</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-nand-lock.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Public Functions Provided</th><td width="20%" align="right"> <a accesskey="n" href="API-nand-scan-ident.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-nand-check-erased-ecc-chunk"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>nand_check_erased_ecc_chunk — 2 check if an ECC chunk contains (almost) only 0xff data 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">nand_check_erased_ecc_chunk </b>(</code></td><td>void * <var class="pdparam">data</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">datalen</var>, </td></tr><tr><td> </td><td>void * <var class="pdparam">ecc</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">ecclen</var>, </td></tr><tr><td> </td><td>void * <var class="pdparam">extraoob</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">extraooblen</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">bitflips_threshold</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.12.6.5"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p> 4 data buffer to test 5 </p></dd><dt><span class="term"><em class="parameter"><code>datalen</code></em></span></dt><dd><p> 6 data length 7 </p></dd><dt><span class="term"><em class="parameter"><code>ecc</code></em></span></dt><dd><p> 8 ECC buffer 9 </p></dd><dt><span class="term"><em class="parameter"><code>ecclen</code></em></span></dt><dd><p> 10 ECC length 11 </p></dd><dt><span class="term"><em class="parameter"><code>extraoob</code></em></span></dt><dd><p> 12 extra OOB buffer 13 </p></dd><dt><span class="term"><em class="parameter"><code>extraooblen</code></em></span></dt><dd><p> 14 extra OOB length 15 </p></dd><dt><span class="term"><em class="parameter"><code>bitflips_threshold</code></em></span></dt><dd><p> 16 maximum number of bitflips 17 </p></dd></dl></div></div><div class="refsect1"><a name="id-1.12.6.6"></a><h2>Description</h2><p> 18 Check if a data buffer and its associated ECC and OOB data contains only 19 0xff pattern, which means the underlying region has been erased and is 20 ready to be programmed. 21 The bitflips_threshold specify the maximum number of bitflips before 22 considering the region as not erased. 23</p></div><div class="refsect1"><a name="id-1.12.6.7"></a><h2>Note</h2><p> 24 1/ ECC algorithms are working on pre-defined block sizes which are usually 25 different from the NAND page size. When fixing bitflips, ECC engines will 26 report the number of errors per chunk, and the NAND core infrastructure 27 expect you to return the maximum number of bitflips for the whole page. 28 This is why you should always use this function on a single chunk and 29 not on the whole page. After checking each chunk you should update your 30 max_bitflips value accordingly. 31 2/ When checking for bitflips in erased pages you should not only check 32 the payload data but also their associated ECC data, because a user might 33 have programmed almost all bits to 1 but a few. In this case, we 34 shouldn't consider the chunk as erased, and checking ECC bytes prevent 35 this case. 36 3/ The extraoob argument is optional, and should be used if some of your OOB 37 data are protected by the ECC engine. 38 It could also be used if you support subpages and want to attach some 39 extra OOB data to an ECC chunk. 40 </p><p> 41 42 Returns a positive number of bitflips less than or equal to 43 bitflips_threshold, or -ERROR_CODE for bitflips in excess of the 44 threshold. In case of success, the passed buffers are filled with 0xff. 45</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-nand-lock.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pubfunctions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-nand-scan-ident.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">nand_lock</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">nand_scan_ident</span></td></tr></table></div></body></html> 46