[Yaffs] Strange ECC Error
Charles Manning
manningc2@actrix.gen.nz
Wed, 13 Oct 2004 09:54:45 +1300
Are you getting the errors when scanning empty chunks/pages? If so, these=
can=20
be safely ignored.=20
The "ECC turned off" does not apply to the tags ECC calculation, only to =
the=20
data ECC calculation.
-- Charles
On Wednesday 13 October 2004 03:48, Daniel Gustafsson wrote:
> Can somebody please explain the functions below. I am using yaffs/direc=
t,
> ECC turned off.
>
> When scanning the emfile during a mount there are ecc errors.
>
>
>
> void yaffs_CalcTagsECC(yaffs_Tags *tags)
> {
> // Calculate an ecc
>
> unsigned char *b =3D ((yaffs_TagsUnion *)tags)->asBytes;
> unsigned i,j;
> unsigned ecc =3D 0;
> unsigned bit =3D 0;
> tags->ecc =3D 0;
>
> for(i =3D 0; i < 8; i++)
> {
> for(j =3D 1; j &0xff; j<<=3D1)
> {
> bit++;
> if(b[i] & j)
> {
> ecc ^=3D bit;
> }
> }
> }
>
> tags->ecc =3D ecc; %%%I always
> get a high value on ecc approx 64
>
>
> }
>
> int yaffs_CheckECCOnTags(yaffs_Tags *tags)
> {
> unsigned ecc =3D tags->ecc;
>
> yaffs_CalcTagsECC(tags);
>
> ecc ^=3D tags->ecc; %% Now my
> ecc increases to approx 4096.
>
> if(ecc && ecc <=3D 64)
> {
> // TODO: Handle the failure better. Retire?
> unsigned char *b =3D ((yaffs_TagsUnion *)tags)->asBytes;
>
> ecc--;
>
> b[ecc / 8] ^=3D (1 << (ecc & 7));
>
> // Now recvalc the ecc
> yaffs_CalcTagsECC(tags);
>
> return 1; // recovered error
> }
> else if(ecc)
> {
> // Wierd ecc failure value
> %%%% I always end up here.
> // TODO Need to do somethiong here
> return -1; //unrecovered error
> }
>
> return 0;
> }
>
>
>
> //Daniel
>
>
> _______________________________________________
> yaffs mailing list
> yaffs@stoneboat.aleph1.co.uk
> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs