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

📄 bootconfig.c

📁 motorola mpc系列 mpc852cpu bsp
💻 C
📖 第 1 页 / 共 5 页
字号:
    }
#endif

    /* If we're here, either we aren't auto-booting, or we got an error
     * auto-booting, or the auto-booting was stopped. */

    /* read and execute the ROM commands */

    Drv_Print ("\n\r");
    
   
    FOREVER
    {
        if ((key == '!') || (key == '@'))
        {
            line [0] = key;
            line [1] = EOS;
            key = 0;
        }
        else
        {
             Drv_Print ("[VxWorks Boot]: ");
    		
    		
    		while(1)
    		{
   			 InChar( &data,rv);
    			if( (rv== SUCCESS) && (data !=0) )
            		{
                             Drv_Print("%c\r\n",data);
            			 break;
            		}
    		}
              
              
    		line [0] = data;
            	line [1] = EOS;
              data=0;
             /*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;

            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;

#ifdef  TARGET_HK_V2F
            case 's':       /* system controller */
            {
                extern unsigned long sysBCLSet ();

                if (getArg (&pLine, &value, DEC, !OPT) == OK)
                {
                    if (value != 0)
                    {
                        (void) sysBCLSet ((unsigned long)HK_BCL_SYS_CONTROLLER,
                                          (unsigned long)HK_BCL_SYS_CONTROLLER);
                        Drv_Print ("System controller on.\n");
                    }
                    else
                    {
                        (void) sysBCLSet( (unsigned long)HK_BCL_SYS_CONTROLLER,
                                          (unsigned long)0 );
                        Drv_Print ("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;
                        Drv_Print ("System controller on.\n");
                    }
                    else
                    {
                        *FGA_CTL1 &= ~FGA_CTL1_SCON;
                        Drv_Print ("System controller off.\n");
                    }
                }
                break;
#endif  /* TARGET_FRC_30 || TARGET_FRC_31 || TARGET_FRC_33 */

            case 'p':       /* print boot params */
                LoadCtrl_DisplayBootParam(&ParamInfo);
                break;

            case 'c':       /* change boot params */
            	  LoadCtrl_SetParam();
                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 */
                 Drv_Print("before entry:%x\r\n",(UINT32)entry);
                 
                if (bootLoad (pLine, &entry) == SUCCESS)
                {
                    Drv_Print("after entry:%x\r\n",(UINT32)entry);
                    go (entry);
                }
                else
                {
                    Drv_Print("bootload failed\r\n");
                    taskDelay (sysClkRateGet ());   /* pause a second */
                    reboot (BOOT_NO_AUTOBOOT);      /* something is awry */
                }
                
                while(1)
                {
                         taskDelay(10);
                }
                break;

            case 'l':           /* load with internal params */
                if (bootLoad (pLine, &entry) == OK)
                {
                    Drv_Print ("entry = 0x%x\n", (int) entry);
                }
                else
                {
                    taskDelay (sysClkRateGet ());   /* pause a second */
                    reboot (BOOT_NO_AUTOBOOT);      /* something is awry */
                }
                break;
           	case 'k':
			
           		break;
           	case'K':

                 
           		break;
		case 'z':

                     
           		break;

           	case'Z':

           		break;

	    	case 'y':

           		break;
           	case 'Y':



           		break;

            default:
                /*Drv_Print ("Unrecognized command. Type '?' for help.\n");*/
                break;

        }   /* switch */
    }       /* FOREVER */
    
}



/******************************************************************************
*
* autoboot - do automatic boot sequence
*
* Description:
*
* Calls:    bootLoad(), reboot(),
*           tickGet(), sysClkRateGet(),
*           go(), taskDelay()
* Called by: bootCmdLoop()
* Input:    timeout - timeout value in seconds
* Output:   print message on console
* Return:   Key value if a key pressed,
*           Doesn't return if successful (starts execution of booted system).
*****************************************************************************/
 char autoboot
    (
    int timeout     /* timeout time in seconds */
    )
{
    unsigned long   autoBootTime;
    int     timeLeft;
    UINT    timeMarker;
    int     bytesRead = 0;
    FUNCPTR entry;
    char    key;

    if (timeout > 0)
    {
        Drv_Print ("\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;

        Drv_Print ("%2d\r", timeLeft);

        while ((tickGet () < autoBootTime) && (bytesRead == 0))
        {
            (void) ioctl (consoleFd, FIONREAD, (int) &bytesRead);

            if (tickGet () == timeMarker)
            {
                timeMarker = tickGet () + sysClkRateGet ();
                Drv_Print ("%2d\r", --timeLeft);
            }
        }
    }

    if (bytesRead == 0)    /* nothing typed so auto-boot */
    {
        /* put the console back in line mode soit echoes (so's you can bang
        *  on it to see if it's still alive) */

        (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);

        Drv_Print ("\nauto-booting...\n\n");

        if (bootLoad (BOOT_LINE_ADRS, &entry) == OK)
        {
            go (entry);             /* ... and never return */
        }
        else
        {
            Drv_Print ("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 */
}
/******************************************************************************
*
* printBootLogo - print initial boot banner page
*
******************************************************************************/

LOCAL void printBootLogo (void)

{
    /*Drv_Print ("\n\n\n\n\n\n\n\n\n\n\n");*/
    /*Drv_Print ("%28s%s", "","VxWorks System Boot");*/
    Drv_Print ("\n\n\nCopyright 2005-2006 KZTECH Systems, Inc.\n\n\n\n\n\n");
    /*Drv_Print ("CPU: %s\n", sysModel ());*/
    /*Drv_Print ("Version: %s\n", vxWorksVersion);*/
    Drv_Print ("BSP version: " BSP_VERSION BSP_REV "\n");
    Drv_Print ("Creation date: %s\n\n", creationDate);
}

/*******************************************************************************
*
* bootHelp - print brief help list
*
* Description:
*   Print help information, show all commands
*
* Calls:    None
* Called by: bootCmdLoop()
* Input:    None
* Output:   print command list
* Return:   None
*******************************************************************************/

LOCAL void bootHelp (void)

{
    static char *helpMsg[] =
    {
        "?",                      "- print this list",
        "@",                      "- boot (load and go)",
        "p",                      "- print boot params",
        "c",                      "- change boot params",
        "l",                      "- load boot file",
        "g adrs",                 "- go to adrs",
        "d adrs[,n]",             "- display memory",
        "m adrs",                 "- modify memory",
        "f adrs, nbytes, value",  "- fill memory",
        "t adrs, adrs, nbytes",   "- copy memory",
        "e",                      "- print fatal exception",
#ifdef INCLUDE_NETWORK
        "n netif",              "- print network interface device address",
#if defined(ETHERNET_ADR_SET)
        "N",                    "- set ethernet address",
#endif  /* ETHERNET_ADR_SET */
#endif  /* INCLUDE_NETWORK */
#if defined(TARGET_HK_V2F) || defined(TARGET_FRC_30) || \
    defined(TARGET_FRC_31) || defined(TARGET_FRC_33)
        "s [0/1]",              "- system controller 0 = off, 1 = on",
#endif  /* TARGET_HK_V2F/FRC_30/FRC_31/FRC_33 */
        "$dev(0,procnum)host:/file h=# e=# b=# g=# u=usr [pw=passwd] f=#", "",
        "tn=targetname s=script o=other", "",

#ifdef  INCLUDE_SCSI_BOOT
        "boot device: scsi=id,lun              file name: /sd0/vxWorks", "",
#endif  /*INCLUDE_SCSI_BOOT*/

#ifdef  INCLUDE_FD
        "boot device: fd=drive,fdType          file name: /fd0/vxWorks", "",
#endif  /* INCLUDE_FD */

#ifdef  INCLUDE_IDE
        "boot device: ide=drive,configType     file name: /ide0/vxWorks","",
#endif  /* INCLUDE_IDE */

#ifdef  INCLUDE_ATA
        "boot device: ata=ctrl,drive           file name: /ata0/vxWorks","",
#endif  /* INCLUDE_ATA */

#ifdef  INCLUDE_PCMCIA
        "boot device: pcmcia=sock              file name: /pcmcia0/vxWorks","",
#endif  /* INCLUDE_PCMCIA */

#ifdef  INCLUDE_TFFS
        "boot device: tffs=drive,removable     file name: /tffs0/vxWorks","",
#endif  /* INCLUDE_TFFS */

#ifdef INCLUDE_TSFS_BOOT
        "boot device: tsfs                     file name: /tgtsvr/vxWorks","",
#endif /*INCLUDE_TSFS_BOOT */

        "Boot flags:",        "",
#if defined(TARGET_HK_V2F) || defined(TARGET_FRC_30) || \
    defined(TARGET_FRC_31) || defined(TARGET_FRC_33)
        "  0x01  - don't be system controller", "",
#endif  /* TARGET_HK_V2F/FRC_30/FRC_31/FRC_33 */
        "  0x02  - load local system symbols",      "",
        "  0x04  - don't autoboot",         "",
        "  0x08  - quick autoboot (no countdown)",  "",
#ifdef  INCLUDE_NETWORK
        "  0x20  - disable login security",     "",
#ifdef  INCLUDE_DHCPC
        "  0x40  - use dhcp to get boot parameters",    "",
#else
        "  0x40  - use bootp to get boot parameters",   "",
#endif
        "  0x80  - use tftp to get boot image",     "",
        "  0x100 - use proxy arp",          "",
#endif  /* INCLUDE_NETWORK */

⌨️ 快捷键说明

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