/*
* This code implements the ECC algorithm used in SmartMedia.
*
- * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes.
+ * 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
+ * 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.
*
*/
return 1; /* Corrected the error */
}
- if ((yaffs_CountBits(d0) +
- yaffs_CountBits(d1) +
+ if ((yaffs_CountBits(d0) +
+ yaffs_CountBits(d1) +
yaffs_CountBits(d2)) == 1) {
/* Reccoverable error in ecc */
return 1; /* Corrected the error */
}
-
+
/* Unrecoverable error */
return -1;
if ((cDelta | lDelta | lDeltaPrime) == 0)
return 0; /* no error */
- if (lDelta == ~lDeltaPrime &&
+ if (lDelta == ~lDeltaPrime &&
(((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15))
{
/* Single bit (recoverable) error in data */
if(lDelta >= nBytes)
return -1;
-
+
data[lDelta] ^= (1 << bit);
return 1; /* corrected */