Datasheet

59
SAM9G15 [DATASHEET]
11052D–ATARM–31-Oct-12
11.4.4.2 NAND Flash Boot: PMECC Error Detection and Correction
NAND Flash boot procedure uses PMECC to detect and correct errors during NAND Flash read operations in two cases:
z When the usePmecc flag is set in the specific NAND header. If the flag is not set, no ECC correction is performed
during NAND Flash page read.
z When the NAND Flash has been detected using ONFI parameters.
The ROM code embeds the software used in the process of ECC detection/correction: the Galois Field tables, and the
function PMECC_CorrectionAlgo(). The user does not need to embedd it in other software.
This function can be called by user software when PMECC status returns errors after a read page command.
Its address can be retrieved by reading the third vector of the ROM Code interrupt vector table, at address 0x100008.
The API of this function is:
unsigned int PMECC_CorrectionAlgo(AT91PS_PMECC pPMECC,
AT91PS_PMERRLOC pPMERRLOC,
PMECC_paramDesc_struct *PMECC_desc,
unsigned int PMECC_status,
unsigned int pageBuffer)
pPMECC : pointer to the PMECC base address,
pPMERRLOC : pointer to the PMERRLOC base address,
PMECC_desc : pointer to the PMECC descriptor,
PMECC_status : the status returned by the read of PMECCISR register;
pageBuffer : address of the buffer containing the page to be corrected.
The PMECC descriptor structure is:
typedef struct _PMECC_paramDesc_struct {
unsigned int pageSize;
unsigned int spareSize;
unsigned int sectorSize; // 0 for 512, 1 for 1024 bytes
unsigned int errBitNbrCapability;
unsigned int eccSizeByte;
unsigned int eccStartAddr;
unsigned int eccEndAddr;
unsigned int nandWR;
unsigned int spareEna;
unsigned int modeAuto;
unsigned int clkCtrl;
unsigned int interrupt;
int tt;
int mm;
int nn;
short *alpha_to;
short *index_of;
short partialSyn[100];
short si[100];
/* sigma table */
short smu[TT_MAX + 2][2 * TT_MAX + 1];
/* polynom order */
short lmu[TT_MAX + 1];
} PMECC_paramDesc_struct;