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

📄 bootconfig.c

📁 (1)本人基于MPC860的vxworks bsp的程序 (2)实现了FEC 100M和 SCC 10M的网口功能 (3)实现了nor flash的TFFS文件系统 (4)实现了系统的自检 (
💻 C
📖 第 1 页 / 共 5 页
字号:
		bootCmdTaskStackSize, (FUNCPTR) bootCmdLoop,		0,0,0,0,0,0,0,0,0,0);    }/********************************************************************************* 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 [MAX_LINE];    char *pLine;    int nwords;    int nbytes;    int value;    int adr;    int adr2;    FUNCPTR entry;    char key = 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*/);    if (sysStartType & BOOT_CLEAR)	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 = 1;	    }	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 == '!') || (key == '@'))        {            line [0] = key;            line [1] = EOS;            key = 0;        }        else        {            printf ("[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);	        if (strncmp(pLine, "imageld", 7) == 0)	    {            MainImageLoad(pLine);        }        else if (strncmp(pLine, "tffs", 4) == 0)        {            if (TFFsDebugCommand(pLine) != OK)            {                printf("Error when executing TFFs command!\n");            }        }        else if (strncmp(pLine, "flash", 5) == 0)        {            if (FLASHDebugCommand(pLine) != OK)            {                printf("Error when executing flash command!\n");            }        }        else if(strncmp(pLine, "type", 4) == 0)        {            TypeFile(pLine);        }		        else if(strncmp(pLine, "del", 3) == 0)        {            DeleteFile(pLine);        }	        else if (strncmp(pLine, "MAC", 3) == 0)        {		SetDeviceInfo();        }				#if 0				else if(strncmp(pLine, "init", 3) == 0)        {            /* Initialize the DS21455 */            _ds2155E1Init(0, 1);            _ds2155E1Init(1, 1);            _ds2155E1Init(2, 1);             _ds2155E1Init(3, 1);									*((volatile unsigned char *)0x8000004f) = 0x00;			*((volatile unsigned char *)0x8000014f) = 0x00;						*((volatile unsigned char *)0x8000024f) = 0x00;          *((volatile unsigned char *)0x8000034f) = 0x00;					            /* Initialize the mode of CPLD */            /*            MPC860 Port C:                                              port 6     port7            LIU                                1           *               FRAMER (master)             0           1            FRAMER (slave)               0           0                   */						        }					        else if(strncmp(pLine, "zll", 3) == 0)        {						            /* Initialize the mode of CPLD */            /*            MPC860 Port C:                                                          port 6     port7            LIU                                            1           *               FRAMER (master line)                   0           1            FRAMER (master packet)               0           0                   */										    printf("zl50114: framer master line.\n");                  *PCDIR(INTERNAL_MEM_MAP_ADDR) |= 0x0300;						                  *PCDAT(INTERNAL_MEM_MAP_ADDR) &= 0xFCFF;					 *PCDAT(INTERNAL_MEM_MAP_ADDR) |= 0x0100;					                ZL50114CESFramerInitialise(0x1);								}				else if (strncmp(pLine, "zlp", 3) == 0)             {             printf("zl50114: framer master packet.\n");                  *PCDIR(INTERNAL_MEM_MAP_ADDR) |= 0x0300;						                  *PCDAT(INTERNAL_MEM_MAP_ADDR) &= 0xFCFF;										ZL50114CESFramerInitialise(0x2);                          }					else if (strncmp(pLine, "dco0", 4) == 0)					{					dco(0);					}				#endif        else        {            switch (*(pLine++))            {                case EOS:		/* blank line */                    break;                    case 'd':		/* display */                    if ((getArg (&pLine, &adr, HEX, OPT) == OK) &&                        (getArg (&pLine, &nwords, DEC, OPT) == OK))                            d ((char *) adr, nwords);                    break;                    case 'e':		/* exception */                    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;		case 'w':/*SetDeviceInfo*/			SetDeviceInfo();			break;		case 's':/*show device info*/			ShowDeviceInfo();			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);                    (void) sysNvRamSet (BOOT_LINE_ADRS,                    strlen (BOOT_LINE_ADRS) + 1, 0);                    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 '@':			/* load and go with internal params */                case '$':			/* load and go with internal params */                    if (bootLoad (pLine, &entry) == OK)                    {                        go (entry);                    }                    else                    {                        taskDelay (sysClkRateGet ());	/* pause a second */                        reboot (BOOT_NO_AUTOBOOT);		/* something is awry */                    }                    break;                    case 'l':			/* load with internal params */                        if (bootLoad (pLine, &entry) == OK)                    {                        printf ("entry = 0x%x\n", (int) entry);                    }                    else                    {                        taskDelay (sysClkRateGet ());	/* pause a second */                        reboot (BOOT_NO_AUTOBOOT);		/* something is awry */                    }                    break;										                default:                    printf ("Unrecognized command. Type '?' for help.\n");                    break;                    }        }				    } /* FOREVER */}/******************************************************************************** autoboot - do automatic boot sequence** RETURNS: Doesn't return if successful (starts execution of booted system).*/LOCAL char autoboot     (    int timeout		/* timeout time in seconds */    )    {    ULONG	autoBootTime;    int		timeLeft;    UINT	timeMarker;    int		bytesRead = 0;    FUNCPTR	entry;    char	key;    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);

⌨️ 快捷键说明

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