📄 bootconfig.c
字号:
*PCSO(INTERNAL_MEM_MAP_ADDR) &= ~(PC15 | PC13);
*PCDIR(INTERNAL_MEM_MAP_ADDR) |= (PC15 | PC13);
*PCDAT(INTERNAL_MEM_MAP_ADDR) &= ~PC15;
#if 0
Drv_SmcCreate(VPL_SERIAL, 0);
Drv_Print("\r\nSerial init success.");
#endif
#if (CPU_FAMILY == SPARC)
excWindowInit (); /* SPARC window management */
#endif
#if (CPU_FAMILY == MIPS)
sysGpInit (); /* MIPS global pointer */
#endif /* (CPU_FAMILY == MIPS) */
/* configure data and instruction cache if available and leave disabled */
#ifdef INCLUDE_CACHE_SUPPORT
cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE);
#endif /* INCLUDE_CACHE_SUPPORT */
#if (CPU == SPARClite)
cacheLib.textUpdateRtn = NULL; /* XXX - mod hist 07u */
#endif
/* don't assume bss variables are zero before this call */
bzero (edata, end - edata); /* zero out bss variables */
sysStartType = startType;
intVecBaseSet ((FUNCPTR *) VEC_BASE_ADRS); /* set vector base table */
#if (CPU_FAMILY == AM29XXX)
excSpillFillInit (); /* am29k stack cache managemt */
#endif
excVecInit (); /* install exception vectors */
sysHwInit (); /* initialize system hardware */
usrKernelInit (); /* configure the Wind kernel */
#if (CPU==SPARC) || (CPU_FAMILY==I80X86) /* XXX workaround for sun1e */
#undef USER_I_CACHE_ENABLE /* XXX disable instruction cache */
#endif /* (CPU==SPARC) || (CPU_FAMILY==I80X86) */
#ifdef USER_I_CACHE_ENABLE
cacheEnable (INSTRUCTION_CACHE); /* enable instruction cache */
#endif /* USER_I_CACHE_ENABLE */
/* start the kernel specifying usrRoot as the root task */
/* start the kernel specifying usrRoot as the root task */
kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE,
#ifdef INCLUDE_WDB
(char *) FREE_RAM_ADRS + WDB_POOL_SIZE,
#else
(char *) FREE_RAM_ADRS,
#endif
sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
}
/*******************************************************************************
*
* usrRoot - user-defined root task
*
* Description:
* The root task performs any initialization that should be done
* subsequent to the kernel initialization.
*
* It initializes the I/O system, install drivers, create devices,
* sets up the network, etc., as necessary for the particular configuration.
* It may also create the system symbol table if one is to be included.
* Finally, it spawns the boot command loop task.
*
* NOMANUAL
*/
extern STATUS wdbConfig (void);
extern char vxBootFile [100];
extern UINT32 TickCount;
void usrRoot
(
char * pMemPoolStart, /* start of system memory partition */
unsigned memPoolSize /* initial size of mem pool */
)
{
/*char tyName [20];
int ix;
*/
#ifdef INCLUDE_END
int count;
END_TBL_ENTRY* pDevTbl;
#endif /* INCLUDE_END */
/* Initialize the memory pool before initializing any other package.
* The memory associated with the root task will be reclaimed at the
* completion of its activities.
*/
memInit (pMemPoolStart, memPoolSize);/* XXX select between memPartLibInit */
sysClkConnect ((FUNCPTR) usrClock, 0); /* connect clock interrupt routine */
sysClkRateSet (60); /* set system clock rate */
sysClkEnable (); /* start it */
/* set up serial */
/* use smc2 for debug UART */
Drv_SmcCreate(VPL_SERIAL, 0);
/*Drv_Print("\r\ntimer!");*/
/* Initialize flash */
/* initialize I/O and file system */
/* printf use */
iosInit (NUM_DRIVERS, NUM_FILES, "/null");
consoleFd = NONE;
#if 0
/* install driver for on-board serial ports and make devices */
#ifdef INCLUDE_TYCODRV_5_2
#ifdef INCLUDE_TTY_DEV
if (NUM_TTY > 0)
{
tyCoDrv (); /* install console driver */
for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
{
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) tyCoDevCreate (tyName, ix, 512, 512);
if (ix == CONSOLE_TTY)
strcpy (consoleName, tyName); /* store console name */
}
consoleFd = open (consoleName, O_RDWR, 0);
/* set baud rate */
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS,
OPT_ECHO | OPT_CRMOD | OPT_TANDEM | OPT_7_BIT);
}
#endif /* INCLUDE_TTY_DEV */
#else /* !INCLUDE_TYCODRV_5_2 */
#ifdef INCLUDE_TTY_DEV
if (NUM_TTY > 0)
{
ttyDrv(); /* install console driver */
for (ix = 1; ix < NUM_TTY; ix++) /* create serial devices */
{
#if (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL)) /* 未定义 */
if (ix == WDB_TTY_CHANNEL) /* don't use WDBs channel */
{
continue;
}
#endif
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);
if (ix == CONSOLE_TTY) /* init the tty console */
{
strcpy (consoleName, tyName);
consoleFd = open (consoleName, O_RDWR, 0);
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS,
OPT_ECHO | OPT_CRMOD | OPT_TANDEM | OPT_7_BIT);
write(consoleFd, tyName, 7);
}
}
}
#endif /* INCLUDE_TTY_DEV */
#ifdef INCLUDE_PC_CONSOLE
pcConDrv ();
for (ix = 0; ix < N_VIRTUAL_CONSOLES; ix++)
{
sprintf (tyName, "%s%d", "/pcConsole/", ix);
(void) pcConDevCreate (tyName,ix, 512, 512);
if (ix == PC_CONSOLE) /* init the console device */
{
strcpy (consoleName, tyName);
consoleFd = open (consoleName, O_RDWR, 0);
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS,
OPT_ECHO | OPT_CRMOD | OPT_TANDEM | OPT_7_BIT);
}
}
#endif /* INCLUDE_PC_CONSOLE */
#endif /* !INCLUDE_TYCODRV_5_2 */
#endif /* !INCLUDE_TYCODRV_5_2 */
#ifdef INCLUDE_WDB /* 定义 */
wdbConfig(); /* configure and initialize the WDB agent */
vxBootFile[0] = NULL; /* clear boot line set by wdbConfig() */
#if defined(INCLUDE_TSFS_BOOT) && defined(INCLUDE_TSFS_BOOT_VIO_CONSOLE)
consoleFd = open ("/vio/0", O_RDWR, 0); /* for Target Server Console */
#endif
#endif /* INCLUDE_WDB */
ioGlobalStdSet (STD_IN, consoleFd);
ioGlobalStdSet (STD_OUT, consoleFd);
ioGlobalStdSet (STD_ERR, consoleFd);
pipeDrv (); /* install pipe driver */
excInit (); /* init exception handling */
excHookAdd ((FUNCPTR) bootExcHandler); /* install exc handler */
logInit (consoleFd, 5); /* initialize logging */
#ifdef INCLUDE_DOSFS
hashLibInit (); /* hashLib used by dosFS */
#endif
/* initialize object module loader */
#if defined(INCLUDE_AOUT)
bootAoutInit (); /* use a.out format */
#else /* coff or ecoff */
#if defined(INCLUDE_ECOFF)
bootEcoffInit (); /* use ecoff format */
#else /* coff */
#if defined(INCLUDE_COFF)
bootCoffInit (); /* use coff format */
#else /* coff */
#if defined(INCLUDE_ELF)
bootElfInit (); /* use elf format */
#endif
#endif /* mips cpp no elif */
#endif
#endif
#ifdef INCLUDE_END /* 定义 */
muxMaxBinds = MUX_MAX_BINDS;
if (muxLibInit() == ERROR)
return; /* can't return ERROR */
/* Initialize all the available devices. */
for (count = 0, pDevTbl = endDevTbl; pDevTbl->endLoadFunc != END_TBL_END;
pDevTbl++, count++ )
{
cookieTbl[count].pCookie = muxDevLoad (pDevTbl->unit, pDevTbl->endLoadFunc,
pDevTbl->endLoadString,
pDevTbl->endLoan, pDevTbl->pBSP);
if (cookieTbl[count].pCookie == NULL)
{
Drv_Print ("muxLoad failed!\n");
}
else
{
Drv_Print ("muxLoad device pCookie=0x%x\n", cookieTbl[count].pCookie);
}
cookieTbl[count].unitNo=pDevTbl->unit;
bzero((void *)cookieTbl[count].devName,END_NAME_MAX);
pDevTbl->endLoadFunc((char*)cookieTbl[count].devName, NULL);
}
#endif /* INCLUDE_END */
taskSpawn ("tBoot", bootCmdTaskPriority, bootCmdTaskOptions,
bootCmdTaskStackSize, (FUNCPTR) bootCmdLoop,
0,0,0,0,0,0,0,0,0,0);
}
extern void VPL_MinipInBsp_Init();
/*******************************************************************************
*
* usrClock - user defined system clock interrupt routine
*
* This routine is called at interrupt level on each clock interrupt. It is
* installed a call to sysClkConnect(). It calls any other facilities that
* need to know about clock ticks, including the kernel itself.
*
* If the application needs anything to happen at clock interrupt level,
* it should be added to this routine.
*
* NOMANUAL
*******************************************************************************/
/*--- BSP_CLOCK ---*/
/*--- BSP_CLOCK ---*/
extern volatile unsigned long g_DecTimer ;
void usrClock (void)
{
Led_Flash();
tickAnnounce ();
TickCount++;
if( g_DecTimer )
g_DecTimer -- ;
}
/*******************************************************************************
*
* bootCmdLoop - read and execute user commands forever (until boot)
*
* Description:
*
* Calls: autoboot(), bootHelp, d(), m(),
* bootLoad(), reboot()
* Called by: usrRoot()
* Input: None
* Output: print message on console
* Return: None
*******************************************************************************/
LOCAL void bootCmdLoop (void)
{
BOOT_PARAMS params;
FUNCPTR entry;
char *pLine;
char line [MAX_LINE];
int nwords;
int nbytes;
int value;
int adr;
int adr2;
char key = 0;
unsigned char data=0;
int rv=0;
/* flush standard input to get rid of any garbage;
* E.g. the Heurikon HKV2F gets junk in USART if no terminal connected.
*/
/*Drv_Print("\r\nStart bootCmdLoop ok !");*/
(void) ioctl (STD_IN, FIOFLUSH, 0);
/* put console in line mode */
(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
if( sysStartType & BOOT_CLEAR )
{
printBootLogo ();
}
LoadCtrl_SetDefaultParam();
LoadCtrl_DisplayBootParam(&ParamInfo);
usrBootLineInit (sysStartType);
/* print out any new exception message -
* the first byte is zeroed after printing so that we won't print
* it again automatically. However, 'e' command will still print out
* the remainder. */
printExcMsg (sysExcMsg);
*sysExcMsg = EOS; /* indicate exception message is old */
if (FAILURE == LoadCtrl_GetBootParam())
{
Drv_Print("\r\nBootConfig Get Boot Param Failed!");
/*Drv_ErrBook(DRV_ERR_BOOTCONFIG_GETPARAM_FAIL, 0, 0);
*/
Drv_Print("\r\nSystem Reboot...");
sysToMonitor(BOOT_NO_AUTOBOOT);
}
/* start autoboot, unless no-autoboot specified */
bootStringToStruct( BOOT_LINE_ADRS, ¶ms );
sysFlags = params.flags;
#if defined(INCLUDE_TSFS_BOOT) && defined(INCLUDE_TSFS_BOOT_VIO_CONSOLE)
/* Wait for Target Server connection */
while( !wdbTargetIsConnected() )
{
taskDelay (sysClkRateGet());
}
/*
* disable the auto-boot mechanism, because the Target Server may not have
* time to start its VIO Console before the end of the auto-boot coutdown.
*/
sysStartType |= BOOT_NO_AUTOBOOT;
#endif
#if 0
if (!(sysStartType & BOOT_NO_AUTOBOOT) &&
!(sysFlags & SYSFLG_NO_AUTOBOOT))
{
int timeout = TIMEOUT;
if ((sysStartType & BOOT_QUICK_AUTOBOOT) ||
(sysFlags & SYSFLG_QUICK_AUTOBOOT))
{
timeout = 5;
}
key = autoboot (timeout); /* doesn't return if successful */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -