示例#1
0
BOOL WriteBlock(DWORD dwBlock, LPBYTE pbBlock, PSectorInfo pSectorInfoTable)
{
int i;
    for (int iSector = 0; iSector < g_FlashInfo.wSectorsPerBlock; iSector++) {
        #ifdef IROMBOOT
		if((dwBlock==0) && (iSector<(STEPLDR_LENGTH/SECTOR_SIZE))){
				OALMSG(TRUE, (TEXT("Stepldr for iROM NANDFlash Boot...\r\n")));
	        if (!FMD_WriteSector_Stepldr(dwBlock * g_FlashInfo.wSectorsPerBlock + iSector, pbBlock, pSectorInfoTable, 1))
	            return FALSE;
		}
		else

        #endif  // !IROMBOOT

        if (!FMD_WriteSector(dwBlock * g_FlashInfo.wSectorsPerBlock + iSector, pbBlock, pSectorInfoTable, 1))
            return FALSE;
		/*		for(i=0;i<2048;i++)
				RETAILMSG(1, (L"%x ",*(pbBlock+i)));
			RETAILMSG(1, (L"\r\n"));
*/
        if (pbBlock)
            pbBlock += g_FlashInfo.wDataBytesPerSector;
        if (pSectorInfoTable)        
            pSectorInfoTable++;        
    }
    return TRUE;
}
示例#2
0
BOOL WriteBlock(DWORD dwBlock, LPBYTE pbBlock, PSectorInfo pSectorInfoTable)
{
    for (int iSector = 0; iSector < g_FlashInfo.wSectorsPerBlock; iSector++) {

#ifdef _IROMBOOT_
        if((dwBlock==0) && (iSector<(IMAGE_STEPLOADER_SIZE/SECTOR_SIZE))){
            if (!FMD_WriteSector_Stepldr(dwBlock * g_FlashInfo.wSectorsPerBlock + iSector, pbBlock, pSectorInfoTable, 1))
                return FALSE;
        } else
#endif
        if (!FMD_WriteSector(dwBlock * g_FlashInfo.wSectorsPerBlock + iSector, pbBlock, pSectorInfoTable, 1))
            return FALSE;

//#endif  // !_IROMBOOT_

        if (pbBlock)
            pbBlock += g_FlashInfo.wDataBytesPerSector;
        if (pSectorInfoTable)
            pSectorInfoTable++;
    }
    return TRUE;
}