📄 bootconfig.c
字号:
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 '@': /* 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;#if 0/*add for test by davey*/ case 'x': startNIC(0); /*fei82557DumpPrint(0);*/ /*sys557Show(0);*/ /*fei82557ShowRxRing(0);*/ /*fei82557GetRUStatus(0); */ break; case 'y': startNIC(1); /*fei82557DumpPrint(1);*/ /*sys557Show(1);*/ /*fei82557ShowRxRing(1);*/ /*fei82557GetRUStatus(1);*/ break; case 'z': printf("test software interrupt\n"); fei82557SoftIntr(0); break;#endif#if 1 case 'j': if((getArg (&pLine, (int *) &adr, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &adr2, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &nbytes, HEX, !OPT) == OK)) { programFlashLoad((unsigned char * )adr, (char * )adr2, nbytes); } break; case 'X': /*initialize spi and test*/ /*spi_simulate_test(0x0);*/ spiSimulate_init(); break; case 'Y': { int chip, spipage, spireg; int spistatus; char spibuf[16]; if((getArg (&pLine, (int *) &chip, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &spipage, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &spireg, HEX, !OPT) == OK)) { printf("reading chip:0x%x, page:0x%x, reg:0x%x ...\n", chip, spipage, spireg); spistatus = spi8xx_read_bcm53x8_register(chip, spipage, spireg, spibuf, 16); printf("status:%s\n", spistatus<0?"fail":"success"); printf("value:0x%4.4x\n", spibuf[0]|spibuf[1]<<8); printf("\n"); } } break; case 'Z': { char buffer[8]; int devAddr, nbytes, offset, i; if((getArg (&pLine, (int *) &devAddr, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &nbytes, HEX, !OPT) == OK) &&(getArg (&pLine, (int *) &offset, HEX, !OPT) == OK)) printf("read offset 0x%x, devAddr 0x%x, nbytes:0x%x:\n", offset, devAddr, nbytes); if(ixp425I2CReadTransfer (devAddr, buffer, nbytes, offset) > 0) { for(i=0;i<nbytes;i++) printf("0x%2.2x, ", buffer[i]); printf("\n"); } else { printf("failed\n"); } } break; case 'A': { char x=0x17; spi8xx_write_bcm53x8_register(0, 0, 0xe, &x, 1); } break; case 'k': /* test memory from adr to adr2) */ if ((getArg (&pLine, &adr, HEX, !OPT) == OK) && (getArg (&pLine, &adr2, HEX, !OPT) == OK)) { dv_testmem((UINT32 *)adr, (UINT32 *)adr2); } break; /* end */#endif 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; case 'v': /* print version & logo */ printBootLogo (); break; default: printf ("Unrecognized command. Type '?' for help.\n"); break; } /* switch */ } /* 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); 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\n"); 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 */ }/******************************************************************************** printBootLogo - print initial boot banner page*/LOCAL void printBootLogo (void) { printf ("\n\n\n\n\n\n\n\n\n\n\n"); printf ("%28s%s", "","VxWorks System Boot"); printf ("\n\n\nCopyright 1984-2002 Wind River Systems, Inc.\n\n\n\n\n\n"); printf ("CPU: %s\n", sysModel ()); printf ("Version: %s\n", vxWorksVersion); printf ("BSP version: " BSP_VERSION BSP_REV "\n"); printf ("Creation date: %s\n\n", creationDate); }/********************************************************************************* bootHelp - print brief help list*/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", "v", "- print boot logo with version", "j src, dst, nbytes" "- program flash from src to dst, nytes programed",#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 */ NULL }; FAST char **pMsg;#ifdef INCLUDE_NETWORK FAST NETIF *pNif;#endif /* INCLUDE_NETWORK */#ifdef INCLUDE_E
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -