分类: WINDOWS
2011-03-26 16:23:18
//<++ZhangTianlu ztlchina@foxmail.com 2011-3-25 22:55:14 BOOL Desplay_Logo(DWORD pFramebuffer, DWORD dwImageLength) { unsigned int * pFB32 = (unsigned int *)pFramebuffer; unsigned int * dst = pFB32; unsigned int * p = NULL; int i = 0; SectorInfo si; DWORD dwBlock,dwNumBlocks; dwBlock = LOGO_BLOCK; OALMSG(TRUE, (TEXT("dwImageLength = 0x%x \r\n"), dwImageLength)); dwNumBlocks = (dwImageLength / (g_FlashInfo.wDataBytesPerSector*g_FlashInfo.wSectorsPerBlock)) + (dwImageLength%(g_FlashInfo.wDataBytesPerSector*g_FlashInfo.wSectorsPerBlock) ? 1: 0); OALMSG(TRUE, (TEXT("dwNumBlocks = 0x%x \r\n"), dwNumBlocks)); while (dwNumBlocks--) { OALMSG(TRUE, (TEXT("dwBlock(0x%x) X "), dwBlock)); OALMSG(TRUE, (TEXT("g_FlashInfo.wSectorsPerBlock(0x%x)"),g_FlashInfo.wSectorsPerBlock)); OALMSG(TRUE, (TEXT(" = 0x%x \r\n"),dwBlock*g_FlashInfo.wSectorsPerBlock)); /* FMD_ReadSector(dwBlock*g_FlashInfo.wSectorsPerBlock, NULL, &si, 1); // Stepldr & Eboot image in nand flash // block mark as BLOCK_STATUS_RESERVED & BLOCK_STATUS_READONLY & BLOCK_STATUS_BAD if ((si.bBadBlock == 0x0) && (si.bOEMReserved !=3 )) { ++dwBlock; ++dwNumBlocks; // Compensate for fact that we didn't write any blocks. continue; }*/ //BOOL ReadBlock(DWORD dwBlock, LPBYTE pbBlock, PSectorInfo pSectorInfoTable) if (!ReadBlock(dwBlock, (LPBYTE)dst, g_pSectorInfoBuf)) { OALMSG(OAL_ERROR, (TEXT("WriteData: failed to read block (0x%x).\r\n"), dwBlock)); return(FALSE); } //memcpy(dst, (unsigned int*)p, g_FlashInfo.dwBytesPerBlock); //for debug for(i = 0; i < 10; i++) { OALMSG(TRUE, (TEXT("%x "), *((unsigned char*)g_FlashInfo.dwBytesPerBlock + i))); } OALMSG(TRUE, (TEXT("\r\n"))); dst += g_FlashInfo.dwBytesPerBlock/4; ++dwBlock; } return TRUE; } //++> |
最后在 loader.h中添加 上述两个函数的声明:
//<++ZTL FOR DESPLAY LOGO BOOL Desplay_Logo(DWORD pFramebuffer, DWORD dwImageLength); BOOL WriteLogoToBootMedia(DWORD dwImageStart, DWORDdwImageLength, DWORD dwLaunchAddr); //++>ZTL |