⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bootconfig.c

📁 MPC860的BSP典型代码
💻 C
📖 第 1 页 / 共 5 页
字号:
#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 */    #if     defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK)#ifdef  INCLUDE_EXC_SHOW    excShowInit ();			/* init exception show routines */#endif    excInit ();				/* initialize exception handling */#endif  /* defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK) */    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_PCMCIA                                                                                                        pcmciaInit ();                      /* init PCMCIA Lib */#endif /* INCLUDE_PCMCIA */printf("now begin to initilize the MUX...\n");#ifdef INCLUDE_END    /* initialize the MUX */    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)            {            printf ("muxLoad failed!\n");            }        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);		printf("the end of usrRoot...\n");	}/********************************************************************************* 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*/void usrClock (void){	tickAnnounce ();	/* announce system tick to kernel */}/********************************************************************************* bootCmdLoop - read and execute user commands forever (until boot)*/LOCAL void bootCmdLoop (void)    {    BOOT_PARAMS		params;    char			line [BOOT_CMD_MAX_LINE];    char			*pLine;    int				nwords;    int				nbytes;    int				value;    int				adr;    int				adr2;    FUNCPTR			entry;    char			key = 0;	unsigned long	ultmp = 0;   	/* flush standard input to get rid of any garbage;     * E.g. the Heurikon HKV2F gets junk in USART if no terminal connected.     */    (void) ioctl (STD_IN, FIOFLUSH, 0 /*XXX*/);    /* mody by hubing*/#ifdef INCLUDE_TFFSif (tffsDrv () != OK)	{	printErr ("Could not initialize.\n");	return (ERROR);	}    printf ("Attaching to TFFS... ");    dosFsInit (NUM_DOSFS_FILES);    if (usrTffsConfig (0, 0, "/tffs0") == ERROR)        printf ("usrTffsConfig failed.\n");	else		printf ("done.\n");#endif	/* add by hubing */#ifdef INCLUDE_FTP_SERVER	ftpdInit(0,0);	ioDefPathSet("/tffs0/");/*	ftpdHomeDirSet("/tffs0");*//*	ftpdAnonymousAllow("/tffs0","/tffs0");*/#endif    if (sysStartType & BOOT_CLEAR)	{		/*add by xdy*/		printf("Printf BootLog from \"bootCmdLoop!\" ");		printf("\n");		printBootLogo ();	}    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 */    /* start autoboot, unless no-autoboot specified */    bootStringToStruct (BOOT_LINE_ADRS, &params);    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 (!(sysStartType & BOOT_NO_AUTOBOOT) &&	!(sysFlags & SYSFLG_NO_AUTOBOOT))	{	int timeout = TIMEOUT;	if ((sysStartType & BOOT_QUICK_AUTOBOOT) ||	    (sysFlags & SYSFLG_QUICK_AUTOBOOT))	    {	    timeout = 10;	/*mody by hubing from 1 to 10 */	    }	key = autoboot (timeout);	/* doesn't return if successful */	}    /* If we're here, either we aren't auto-booting, or we got an error     * auto-booting, or the auto-booting was stopped. */    /* put console in line mode */    (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);    /* read and execute the ROM commands */    printf ("\n");    FOREVER	{	if (key == '@')	    {	    line [0] = key;	    line [1] = EOS;	    key = 0;	    }	else	    {	    printf ("[VxWorks Boot]: ");	    fioRdString (STD_IN, line, sizeof (line));	    }	adr = adr2 = 0;	nwords = 0;	/* take blanks off end of line */	pLine = line + strlen (line) - 1;		/* point at last char */	while ((pLine >= line) && (*pLine == ' '))	    {	    *pLine = EOS;	    pLine--;	    }	pLine = line;	skipSpace (&pLine);	switch (*(pLine++))	{	    case EOS:		/* blank line */			break;		/*add by xdy for flash test*/				case 'i':			printf("now initalize the flash..\n");			break;			case 'F':						printf("erase all...now!\n");			break;					case 'a':			break;					case 'b':			printf("erase all...b\n");			/*mflash_erase_all2();*/			break;			    case 'd':		/* display */		/*modi by xdy*/		/*		pLine = line;		pLine++;		skipSpace (&pLine);		ultmp = atol(pLine);		printf("The addr\(0x%08x\) is:", ultmp );		ultmp  = *(unsigned long *)ultmp;		printf("0x%08x\n", ultmp);		*/				printf("Hello...\n");		if ((getArg (&pLine, &adr, HEX, OPT) == OK) &&		    (getArg (&pLine, &nwords, DEC, OPT) == OK))		    d ((char *) adr, nwords);				break;	    case 'e':		/* exception */	    printf("Erase the frist block...\n");		printExcMsg (sysExcMsg + 1);		break;	    case 'f':		/* fill */		if ((getArg (&pLine, &adr, HEX, !OPT) == OK) &&		    (getArg (&pLine, &nbytes, DEC, !OPT) == OK) &&		    (getArg (&pLine, &value, DEC, !OPT) == OK))		    {		    bfillBytes ((char *) adr, nbytes, value);		    }		break;	    case 't':		/* transpose(?) (running out of letters!) */		if ((getArg (&pLine, &adr, HEX, !OPT) == OK) &&		    (getArg (&pLine, &adr2, HEX, !OPT) == OK) &&		    (getArg (&pLine, &nbytes, HEX, !OPT) == OK))		    {		    bcopy ((char *) adr, (char *) adr2, nbytes);		    }		break;	    case 'm':		/* modify */		if (getArg (&pLine, &adr, HEX, !OPT) == OK)		    m ((char *) adr);		break;	#ifdef	TARGET_HK_V2F	    case 's':		/* system controller */		{		extern ULONG sysBCLSet ();		if (getArg (&pLine, &value, DEC, !OPT) == OK)		    {		    if (value != 0)			{			(void) sysBCLSet ((ULONG)HK_BCL_SYS_CONTROLLER,					  (ULONG)HK_BCL_SYS_CONTROLLER);			printf ("System controller on.\n");			}		    else			{			(void) sysBCLSet ((ULONG)HK_BCL_SYS_CONTROLLER,					  (ULONG)0);			printf ("System controller off.\n");			}		    }		break;		}#endif	/* TARGET_HK_V2F */#if defined(TARGET_FRC_30) || defined(TARGET_FRC_31) || defined(TARGET_FRC_33)	    case 's':		/* system controller */		if (getArg (&pLine, &value, DEC, !OPT) == OK)		    {		    if (value != 0)			{			*FGA_CTL1 |= FGA_CTL1_SCON;			printf ("System controller on.\n");			}		    else			{			*FGA_CTL1 &= ~FGA_CTL1_SCON;			printf ("System controller off.\n");			}		    }		break;#endif	/* TARGET_FRC_30 || TARGET_FRC_31 || TARGET_FRC_33 */	    case 'p':		/* print boot params */		bootParamsShow (BOOT_LINE_ADRS);		break;	    case 'c':		/* change boot params */		bootParamsPrompt (BOOT_LINE_ADRS);                if (strlen(BOOT_LINE_ADRS) <= BOOT_LINE_SIZE)                    {                    if ((sysNvRamSet (BOOT_LINE_ADRS,                        strlen (BOOT_LINE_ADRS) + 1, 0)) == ERROR)                        printf("\nNOTE: Bootline not saved to NVRAM\n");                    }                else                    printf("\nWARNING:Bootline longer than BOOT_LINE_SIZE \(%d bytes). Not saved to NVRAM\n", (int) BOOT_LINE_SIZE);                break;	    case 'g':		/* go */		if (getArg (&pLine, (int *) &entry, HEX, !OPT) == OK)		    go (entry);		break;#ifdef  INCLUDE_NETWORK	    case 'n':		netifAdrsPrint (pLine);		break;#ifdef ETHERNET_ADR_SET	    case 'N':		mEnet (pLine);		break;#endif  /* ETHERNET_ADR_SET */#endif  /* INCLUDE_NETWORK */	    case '?':			/* help */            case 'h':			/* help */		bootHelp ();		break;	    case '#':/*hubing*/	    	if (bootLoad (pLine, &entry) == OK)				    		{		    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -