<blockquote>/*<font color="#ff0000" size="7"> </font><font color="#ff0000" size="6">急!!!</font>
int main(void)
{
unsigned int startBlock;
unsigned int endBlock;
unsigned int fileLen;
unsigned int executeAddr;
int count, i;
void (*fw_func)(void);
spuDacOnLoader(2);
#ifndef __No_RTC__
outp32(AER,0x0000a965);
while(1)
{
if((inp32(AER) & 0x10000) ==0x10000)
break;
}
outp32(PWRON, 0x60005); /* Press Power Key during 6 sec to Power off (0x'6'0005) */
outp32(RIIR,0x4);
#endif
init();
#ifdef _S605_ // support S605 chip
S605_init_gpio();
S605_power_on();
#endif
#ifdef __DAC_ON__
sysprintf("DAC On\n");
outp32(REG_AHBCLK, inp32(REG_AHBCLK) | ADO_CKE | SPU_CKE | HCLK4_CKE); // enable SPU engine clock
/* Initial SPU in advance for linux set volume issue */
spuOpen(eDRVSPU_FREQ_8000);
// spuIoctl(SPU_IOCTL_SET_VOLUME, 60, 60);
#endif
#ifndef __No_LCM__
initVPostShow**();
#endif
imagebuf = (UINT8 *)((UINT32)image_buffer | 0x80000000);///:dizzy::dizzy::dizzy:
pImageList=((unsigned int *)(((unsigned int)image_buffer)|0x80000000));// :dizzy::dizzy::dizzy::dizzy:
/* Initial DMAC and NAND interface */
SPI_OpenSPI();
memset(imagebuf, 0, 1024);
sysprintf("Load Image ");
/* read image information */
SPIReadFast(0, 63*1024, 1024, (UINT32*)imagebuf); /* offset, len, address */
if (((*(pImageList+0)) == 0xAA554257) && ((*(pImageList+3)) == 0x63594257))
{
count = *(pImageList+1);
pImageList=((unsigned int*)(((unsigned int)image_buffer)|0x80000000));
startBlock = endBlock = fileLen = executeAddr = 0;
/* load ** first */
pImageList = pImageList+4;
for (i=0; i<count; i++)
{
if (((*(pImageList) >> 16) & 0xffff) == 4) // **
{
startBlock = *(pImageList + 1) & 0xffff;
endBlock = (*(pImageList + 1) & 0xffff0000) >> 16;
executeAddr = *(pImageList + 2);
fileLen = *(pImageList + 3);
SPIReadFast(0, startBlock * 0x10000, fileLen, (UINT32*)executeAddr);
break;
}
/* pointer to next image */
pImageList = pImageList+12;
}
pImageList=((unsigned int*)(((unsigned int)image_buffer)|0x80000000)); // :dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy::dizzy:
startBlock = endBlock = fileLen = executeAddr = 0;
/* load romfs file */
pImageList = pImageList+4;
for (i=0; i<count; i++)
{
if (((*(pImageList) >> 16) & 0xffff) == 2) // RomFS
{
startBlock = *(pImageList + 1) & 0xffff;
endBlock = (*(pImageList + 1) & 0xffff0000) >> 16;
executeAddr = *(pImageList + 2);
fileLen = *(pImageList + 3);
SPIReadFast(0, startBlock * 0x10000, fileLen, (UINT32*)executeAddr);
tag_flag = 1;
tagaddr = executeAddr;
tagsize = fileLen;
break;
}
/* pointer to next image */
pImageList = pImageList+12;
}
pImageList=((unsigned int*)(((unsigned int)image_buffer)|0x80000000));
startBlock = endBlock = fileLen = executeAddr = 0;
/* load execution file */
pImageList = pImageList+4;
for (i=0; i<count; i++)
{
if (((*(pImageList) >> 16) & 0xffff) == 1) // execute
{
startBlock = *(pImageList + 1) & 0xffff;
endBlock = (*(pImageList + 1) & 0xffff0000) >> 16;
executeAddr = *(pImageList + 2);
fileLen = *(pImageList + 3);
sysSetGlobalInterrupt(DISABLE_ALL_INTERRUPTS);
sysSetLocalInterrupt(DISABLE_FIQ_IRQ);
SPIReadFast(0, startBlock * 0x10000, fileLen, (UINT32*)executeAddr);
sysSetGlobalInterrupt(DISABLE_ALL_INTERRUPTS);
sysSetLocalInterrupt(DISABLE_FIQ_IRQ);
// Invalid and disable cache
sysDisableCache();// :dizzy::dizzy::dizzy:
sysInvalidCache();// :dizzy::dizzy::dizzy:
if(tag_flag)
{
sysprintf("Create Tag - Address 0x%08X, Size 0x%08X\n",tagaddr,tagsize );
TAG_create(tagaddr,tagsize);
}
// JUMP to kernel
sysprintf("Jump to kernel\n");
//lcmFill2Dark((char *)(FB_ADDR | 0x80000000));
outp32(REG_AHBIPRST, JPGRST | SICRST |UDCRST | EDMARST);
outp32(REG_AHBIPRST, 0);
outp32(REG_APBIPRST, UART1RST | UART0RST | TMR1RST | TMR0RST );
outp32(REG_APBIPRST, 0);
sysFlushCache(I_D_CACHE); // 不懂什么意思
fw_func = (void(*)(void))(executeAddr);
fw_func();
break;
}
/* pointer to next image */
pImageList = pImageList+12;
}
}
return(0); // avoid compilation warning
}
|