?? bootconfig_mod.c
字號:
#include "flash.c"
#define BOOT_FROM_FLASH
LOCAL char autoboot
(
int timeout /* timeout time in seconds */
)
{
ULONG autoBootTime;
int timeLeft;
UINT timeMarker;
int bytesRead = 0;
FUNCPTR entry;
char key;
#ifdef BOOT_FROM_FLASH
char tmpt[4];
int vxWorksLen = 0x100000;
#endif
if (timeout > 0)
{
printf ("\nPress any key to stop auto-boot...\n");
/* Loop looking for a char, or timeout after specified seconds */
autoBootTime = tickGet () + sysClkRateGet () * timeout;
timeMarker = tickGet () + sysClkRateGet ();
timeLeft = timeout;
printf ("%2d\r", timeLeft);
while ((tickGet () < autoBootTime) && (bytesRead == 0))
{
(void) ioctl (consoleFd, FIONREAD, (int) &bytesRead);
if (tickGet () == timeMarker)
{
timeMarker = tickGet () + sysClkRateGet ();
printf ("%2d\r", --timeLeft);
}
}
}
if (bytesRead == 0) /* nothing typed so auto-boot */
{
/* put the console back in line mode so it echoes (so's you can bang
* on it to see if it's still alive) */
(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
printf ("\nauto-booting...\n");
/*blueyna -- 2003.6.11,flash啟動*/
#ifdef BOOT_FROM_FLASH
if(FlashInit()==STATUS_NORMAL) /*初始化FLASH*/
{
/*首先讀取vxWorks的長度,存儲在FLASH_DATA_CPU開始的頭4個字節(jié)*/
if(FlashDataGet(FLASH_DATA_CPU,tmpt,4)!=STATUS_NORMAL)
printf("error in getting vxWorks length\n");
else
{
vxWorksLen = tmpt[0]*0x01000000+tmpt[1]*0x00010000+tmpt[2]*0x00000100+tmpt[3];
/*從flash中的第FLASH_DATA_CPU塊開始讀取vxWorks本身長度再加上頭4個字節(jié)長度的字節(jié)*/
printf("\nloading vxWorks for %d bytes from flash\n",vxWorksLen);
if(FlashDataGet(FLASH_DATA_CPU,(char *)(0x0010000-4),vxWorksLen+4)!=STATUS_NORMAL)
printf("error in getting vxWorks.bin from flash\n");
else
{
/*開始運行*/
printf("now running...\n");
go((FUNCPTR)0x0010000);
}
}
}
#endif
if (bootLoad (BOOT_LINE_ADRS, &entry) == OK)
go (entry); /* ... and never return */
else
{
printf ("Can't load boot file!!\n");
taskDelay (sysClkRateGet ()); /* pause a second */
reboot (BOOT_NO_AUTOBOOT); /* something is awry */
}
}
else
{
/* read the key that stopped autoboot */
read (consoleFd, &key, 1);
return (key & 0x7f); /* mask off parity in raw mode */
}
return (ERROR); /* for lint - can't really get here */
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -