阅读:2286回复:3
wince 5.0 au1200MIPS nand驱动加载时ecc校验错误问题
K9F1208UOM型号的nand就可以正常启动,但是对于K9F1208UOA,K9F1208UOC型号的nand均会出现ecc错误,如果不进行ecc校验即直接让该函数返回true时,系统可以起来,但每次都会重新格式化nand(因为要用nand做注册表保存,所以这个是绝对不允许发生的);
BOOL FMD_ReadSector(SECTOR_ADDR startSectorAddr, LPBYTE pSectorBuff, PSectorInfo pSectorInfoBuff, DWORD dwNumSectors) { DWORD count; // // Sanity check if (!pSectorBuff && !pSectorInfoBuff) { RETAILMSG(1, (TEXT("Invalid parameters!\n"))); return FALSE; } for (count=0;count<dwNumSectors;count++) { NAND_ReadSector(startSectorAddr, pSectorBuff, pSectorInfoBuff, ECC); if (pSectorBuff) { // Test the data integrity; if the data is invalid, attempt to fix it using ECC if (!ECC_IsDataValid(pSectorBuff, SECTOR_SIZE, ECC, ECC_BUFF_LEN)) { if (!ECC_CorrectData(pSectorBuff, SECTOR_SIZE, ECC, ECC_BUFF_LEN)) { RETAILMSG(1, (TEXT("FMD: ERROR - Sector data (sector %d) Unable to correct invalid data!\r\n"),startSectorAddr)); return FALSE; } else { RETAILMSG(1, (TEXT("FMD: Invalid data was corrected using ECC (sector %d)!\r\n"),startSectorAddr)); } } pSectorBuff += SECTOR_SIZE; } pSectorInfoBuff ++; startSectorAddr ++; } return TRUE; } 请各位帮忙分析下 |
|
沙发#
发布于:2008-04-21 09:46
RETAILMSG(1, (TEXT("FMD: ERROR - Sector data (sector %d) Unable to correct invalid data!\r\n"),startSectorAddr));
大部分是报这个错,偶尔一两次可以正常启动 |
|
板凳#
发布于:2008-04-21 09:52
感觉是NAND_ReadSector出的问题
static BOOL NAND_ReadSector( DWORD SectorNumber, PUCHAR pSector, PSectorInfo pSectorInfo, PUCHAR pECC ) { UCHAR addr1, addr2, addr3; PUCHAR pInfoBuffer = (PUCHAR)pSectorInfo; volatile UCHAR junk; int i; BOOL intrState; addr1 = (UCHAR) ((SectorNumber) & 0xff); addr2 = (UCHAR) ((SectorNumber >> 8) & 0xff); addr3 = (UCHAR) ((SectorNumber >> 16) & 0xff); intrState = DISABLE_INTERRUPTS(); SELECT_DEVICE(); if (!pSector) { WRITE_REGISTER_UCHAR(NAND_CMD_PORT, CMD_READ2); } else { WRITE_REGISTER_UCHAR(NAND_CMD_PORT, CMD_READ); } WRITE_REGISTER_UCHAR(NAND_ADDR_PORT, 0); WRITE_REGISTER_UCHAR(NAND_ADDR_PORT, addr1); WRITE_REGISTER_UCHAR(NAND_ADDR_PORT, addr2); WRITE_REGISTER_UCHAR(NAND_ADDR_PORT, addr3); WaitForReady(0); if (pSector) { for (i=0; i<SECTOR_SIZE; i++) *pSector++ = READ_REGISTER_UCHAR(NAND_DATA_PORT); } if (pInfoBuffer) { for (i=0; i<8; i++) *pInfoBuffer++ = READ_REGISTER_UCHAR(NAND_DATA_PORT); } else { for (i=0; i<8; i++) junk = READ_REGISTER_UCHAR(NAND_DATA_PORT); } if (pECC) { for (i=0; i<8; i++) *pECC++ = READ_REGISTER_UCHAR(NAND_DATA_PORT); } DESELECT_DEVICE(); RESTORE_INTERRUPTS(intrState); return TRUE; } |
|
地板#
发布于:2008-06-23 20:27
Nand多Bit错误是小概率事件,你遇上了,换个同型号片子试试。
程序没有问题 |
|