//*pFB++ = 0x001F; //modify by jazka 2011.07.22
*pFB++ = InitialImage_rgb16_480x272[i];
}
*/
//add by jazka 2011.08.31
//memcpy((void *)EBOOT_FRAMEBUFFER_UA_START, (void *)InitialImage_rgb16_480x272, 480*272*2);
//modify by jazka 2011.09.07
DWORD dwReadAddr = (DWORD)EBOOT_FRAMEBUFFER_UA_START;
if (!DisplayLogoFromBootMedia(dwReadAddr, (DWORD)LCD_WIDTH*LCD_HEIGHT*2, dwReadAddr))
{
int i;
unsigned short *pFB;
pFB = (unsigned short *)EBOOT_FRAMEBUFFER_UA_START;
for (i=0; i<LCD_WIDTH*LCD_HEIGHT; i++)
*pFB++ = 0x0000;//0x001F;// Blue
}
DisplayLogoFromBootMedia函数便是Flash的度函数,这里将读出的数据读取到显示缓存EBOOT_FRAMEBUFFER_US_START中,该变量的推动后面给出。
4、修改nand.cpp文件,添加WriteLogoToBootMedia和DisplayLogoFromBootMedia两个函数的实现。
/*
Write the Logo data to Nand Flash
add by jazka 2011.09.05
*/
BOOL WriteLogoToBootMedia(DWORD dwImageStart, DWORD dwImageLength, DWORD dwLaunchAddr)
{
DWORD dwBlock,dwNumBlocks;
LPBYTE pbBuffer;
SectorInfo si;
OALMSG(TRUE, (TEXT("+WriteLogoToBootMedia\r\n")));
dwBlock = LOGO_BLOCK;
pbBuffer = (LPBYTE)dwImageStart;
OALMSG(TRUE, (TEXT("^^^^^^^^ 0x%x ^^^^^^^^\r\n"), (unsigned short *)pbBuffer));
dwNumBlocks = (dwImageLength/(g_FlashInfo.wDataBytesPerSector*g_FlashInfo.wSectorsPerBlock)) +
(dwImageLength%(g_FlashInfo.wDataBytesPerSector*g_FlashInfo.wSectorsPerBlock) ? 1: 0);
OALMSG(TRUE, (TEXT("dwImageLength = 0x%x \r\n"), dwImageLength));
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;
}
if (!ReadBlock(dwBlock, NULL, g_pSectorInfoBuf))
{
OALMSG(OAL_ERROR, (TEXT("WriteData: failed to read block (0x%x).\r\n"), dwBlock));
return(FALSE);
}
if (!FMD_EraseBlock(dwBlock))
{
OALMSG(OAL_ERROR, (TEXT("WriteData: failed to erase block (0x%x).\r\n"), dwBlock));
return FALSE;
}
if (!WriteBlock(dwBlock, pbBuffer, g_pSectorInfoBuf))
{
OALMSG(OAL_ERROR, (TEXT("WriteData: failed to write block (0x%x).\r\n"), dwBlock));
return(FALSE);
}
++dwBlock;
pbBuffer += g_FlashInfo.dwBytesPerBlock;
OALMSG(TRUE, (TEXT("dwBytesPerBlock : %d\r\n"), g_FlashInfo.dwBytesPerBlock));
}

OALMSG(TRUE, (TEXT("_WriteLogoToBootMedia\r\n")));
return TRUE;
}
/*
Read the Logo data from Nand Flash
add by jazka 2011.09.05
*/
BOOL DisplayLogoFromBootMedia(DWORD dwImageStart, DWORD dwImageLength, DWORD dwLaunchAddr)
{
unsigned int * pFB32 = (unsigned int *)EBOOT_FRAMEBUFFER_UA_START;
unsigned int * dst = pFB32;
//unsigned int * p = NULL;
SectorInfo si;
DWORD dwBlock,dwNumBlocks;
OALMSG(TRUE, (TEXT("+ReadLogoFromBootMedia\r\n")));
dwBlock = LOGO_BLOCK;
OALMSG(TRUE, (TEXT("dwImageLength = 0x%x \r\n"), dwImageLength));
OALMSG(TRUE, (TEXT("dwImageLength = 0x%x \r\n"), g_FlashInfo.wDataBytesPerSector));
OALMSG(TRUE, (TEXT("dwImageLength = 0x%x \r\n"), g_FlashInfo.wSectorsPerBlock));
if (0 == g_FlashInfo.wDataBytesPerSector || 0 == g_FlashInfo.wSectorsPerBlock)
{
return FALSE;
}
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));
//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);
}
dst += g_FlashInfo.dwBytesPerBlock/4;
++dwBlock;
}
OALMSG(TRUE, (TEXT("_ReadLogoFromBootMedia\r\n")));
return TRUE;
}
5、关于Logo数据的文件bin的生成,网上有众多软件可以实现wince主题软件,其实可以自己写一个应用程序完成该功能。本人撰写了24位Bmp文件生成RGB565格式的bin文件的程序,这部分代码也可以在nand.app中写成一个函数,在读取Flash时调用转换为相应的RGB565数据就能,这样更新Logo时可以很直接。注意下载时的数据量是目前的3倍。
这里就不给出源代码了,如果必须,请留言。
今天就到此处,改天上实现方式二:将Logo.bin做成和Eboot.bin一样的格式,这样下载Eboot.bin的好多代码就可以直接使用。
本文出自 “飞雪待剑” 博客,请务必保留此出处
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-137481-2.html
特别美特别浪漫的一部电影