📄 bootinit.s
字号:
# 732 "d:/tornado2.2-arm/target/config/all/configAll.h"
# 811 "d:/tornado2.2-arm/target/config/all/configAll.h"
# 935 "d:/tornado2.2-arm/target/config/all/configAll.h"
# 1058 "d:/tornado2.2-arm/target/config/all/configAll.h"
# 1089 "d:/tornado2.2-arm/target/config/all/configAll.h"
# 51 "config.h" 2
# 106 "config.h"
# 152 "config.h"
extern void sysHwInit0 (void);
# 1 "s3c2410x.h" 1
# 82 "s3c2410x.h"
# 296 "config.h" 2
# 312 "config.h"
# 326 "config.h"
# 119 "bootinit.c" 2
# 1 "d:/tornado2.2-arm/target/h/errno.h" 1
# 36 "d:/tornado2.2-arm/target/h/errno.h"
extern int * __errno(void);
# 175 "d:/tornado2.2-arm/target/h/errno.h"
# 120 "bootinit.c" 2
# 1 "d:/tornado2.2-arm/target/h/sioLib.h" 1
# 22 "d:/tornado2.2-arm/target/h/sioLib.h"
# 248 "d:/tornado2.2-arm/target/h/sioLib.h"
# 121 "bootinit.c" 2
extern void romInit ();
extern STATUS inflate ();
extern void usrInit ();
extern void sysInit ();
extern void sysInitAlt ();
extern void start ();
extern UCHAR binArrayStart [];
extern UCHAR binArrayEnd [];
extern char etext [];
extern char end [];
extern UCHAR wrs_kernel_data_start [];
extern UCHAR wrs_kernel_data_end [];
static void copyLongs (register UINT *source, register UINT *destination, UINT nlongs);
static void fillLongs (register UINT *buf, UINT nlongs, register UINT val);
# 211 "bootinit.c"
extern
int nandReadPage(unsigned int block,unsigned int page,unsigned char *buffer)
{
int i;
unsigned int blockPage;
unsigned char ecc0,ecc1,ecc2;
unsigned char *bufPt=buffer;
unsigned char se[16];
page=page&0x1f;
blockPage=(block<<5)+page;
{(*(volatile unsigned *)0x4e000000)|=(1<<12);};
{(*(volatile unsigned *)0x4e000000)&=~(1<<11);};
{(*(volatile unsigned char *)0x4e000004)=0x00;};
{(*(volatile unsigned char *)0x4e000008)=0;};
{(*(volatile unsigned char *)0x4e000008)=blockPage&0xff;};
{(*(volatile unsigned char *)0x4e000008)=(blockPage>>8)&0xff;};
{(*(volatile unsigned char *)0x4e000008)=(blockPage>>16)&0xff;};
for(i=0;i<10;i++);
{while(!((*(volatile unsigned *)0x4e000010)&(1<<0)));};
for(i=0;i<512;i++)
{
*bufPt++=((*(volatile unsigned char *)0x4e00000c));
}
ecc0=(*(volatile unsigned char *)0x4e000014);
ecc1=(*(volatile unsigned char *)0x4e000015);
ecc2=(*(volatile unsigned char *)0x4e000016);
for(i=0;i<16;i++)
{
se[i]=((*(volatile unsigned char *)0x4e00000c));
}
{(*(volatile unsigned *)0x4e000000)|=(1<<11);};
if(ecc0==se[0] && ecc1==se[1] && ecc2==se[2])
{
return 1;
}
else
{
return -1;
}
}
int nandLoadBootrom()
{
int i;
int iBlock=0,iPage=0,iSize=0;
unsigned char *iDes=(unsigned char *)0x33e00000;
(*(volatile unsigned *)0x4e000000)=(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(0<<8)|(3<<4)|(0<<0);
{(*(volatile unsigned *)0x4e000000)&=~(1<<11);};
{(*(volatile unsigned char *)0x4e000004)=0xFF;};
for(i=0;i<10;i++);
{while(!((*(volatile unsigned *)0x4e000010)&(1<<0)));};
{(*(volatile unsigned *)0x4e000000)|=(1<<11);};
while(iSize < ((UINT)wrs_kernel_data_end-(UINT)romInit)) {
((FUNCPTR)(((UINT)nandReadPage - (UINT)romInit) + 0x00000000))(iBlock,iPage,iDes);
iPage++;
if(iPage >= 32) {
iPage=0;
iBlock++;
}
iDes += 512;
iSize += 512;
}
return 1;
}
void romStart
(
register int startType
)
{
volatile
FUNCPTR absEntry;
VOIDFUNCPTR ramfillLongs = (VOIDFUNCPTR)(((UINT)fillLongs - (UINT)romInit) + 0x00000000);
# 371 "bootinit.c"
((FUNCPTR)(((UINT)nandLoadBootrom - (UINT)romInit) + 0x00000000))();
# 428 "bootinit.c"
if (startType & 0x02)
{
# 452 "bootinit.c"
ramfillLongs((UINT *)((0x30000000 + 0)),
((UINT)romInit - 512 - (UINT)(0x30000000 + 0)) /
sizeof(long), 0);
# 457 "bootinit.c"
ramfillLongs((UINT *)((UINT)romInit + ((UINT)wrs_kernel_data_end-(UINT)romInit)),
((UINT)(0x30000000 + 0x04000000 - 0x1000) - ((UINT)romInit + ((UINT)wrs_kernel_data_end-(UINT)romInit)))
/ sizeof(long), 0);
# 465 "bootinit.c"
*(((char *) (0x30000000+0x700))) = '\0';
}
absEntry = (FUNCPTR)sysInit;
# 522 "bootinit.c"
(absEntry) (startType);
}
static void copyLongs (source, destination, nlongs)
register UINT *source;
register UINT *destination;
UINT nlongs;
{
register UINT *dstend = destination + nlongs;
register UINT nchunks;
for (nchunks = nlongs / 8; nchunks; --nchunks)
{
# 568 "bootinit.c"
destination[0] = source[0];
destination[1] = source[1];
destination[2] = source[2];
destination[3] = source[3];
destination[4] = source[4];
destination[5] = source[5];
destination[6] = source[6];
destination[7] = source[7];
destination += 8, source += 8;
}
while (destination < dstend)
*destination++ = *source++;
}
static void fillLongs (buf, nlongs, val)
register UINT *buf;
UINT nlongs;
register UINT val;
{
register UINT *bufend = buf + nlongs;
register UINT nchunks;
for (nchunks = nlongs / 8; nchunks; --nchunks)
{
# 615 "bootinit.c"
buf[0] = val;
buf[1] = val;
buf[2] = val;
buf[3] = val;
buf[4] = val;
buf[5] = val;
buf[6] = val;
buf[7] = val;
buf += 8;
}
while (buf < bufend)
*buf++ = val;
}
# 655 "bootinit.c"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -