lkml.org 
[lkml]   [2010]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/29] Staging: yaffs2: yaffs_ecc: Add files
On Mon, Nov 01, 2010 at 02:40:56PM -0400, Tracey Dent wrote:
> +/*
> + * This code implements the ECC algorithm used in SmartMedia.
> + *
> + * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
> + * The two unused bit are set to 1.
> + * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC
> + * blocks are used on a 512-byte NAND page.
> + *
> + */
> +
> +/* Table generated by gen-ecc.c
> + * Using a table means we do not have to calculate p1..p4 and p1'..p4'
> + * for each byte of data. These are instead provided in a table in bits7..2.
> + * Bit 0 of each entry indicates whether the entry has an odd or even parity, and therefore
> + * this bytes influence on the line parity.
> + */
> +
This all looks pretty generic. Have you considered just adding gen-ecc to
lib/, tying it in to hostprogs, and generating the tables during build
(see the crc32 code for reference)?

The rest of this would probably also be better off living in lib/ and
simply being selected by the YAFFS code as necessary.

> +/* Calculate the ECC for a 256-byte block of data */
> +void yaffs_ecc_cacl(const unsigned char *data, unsigned char *ecc)
> +void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes,
> + yaffs_ecc_other *ecc_other)

Is there some reason for this naming inconistency?


\
 
 \ /
  Last update: 2010-11-01 20:53    [W:0.111 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site