?? bootconfig.c
字號:
{ printErr ("\nCannot open \"%s\".\n", fileName); return (ERROR); } if (bootLoadModule (fd, pEntry) != OK) goto pcmciaLoadErr; close (fd); return (OK);pcmciaLoadErr: close (fd); return (ERROR); }#endif /* INCLUDE_PCMCIA */#ifdef INCLUDE_TFFS#define TFFS_MEM_DOSFS 0x200000#include "usrTffs.c"#include "sysTffs.c" /* the BSP stub file, in the BSP directory */ /******************************************************************************** tffsLoad - load a vxWorks image from a TFFS Flash disk** RETURNS: OK, or ERROR if file can not be loaded.** NOMANUAL*/LOCAL STATUS tffsLoad ( int drive, int removable, char * fileName, FUNCPTR * pEntry ) { int fd; printErr ("Loading %s...", fileName); if ((fd = open (fileName, O_RDONLY, 0)) == ERROR) { printErr ("\nCannot open \"%s\".\n", fileName); return (ERROR); } if (bootLoadModule (fd, pEntry) != OK) goto tffsLoadErr; close (fd); return (OK);tffsLoadErr: close (fd); return (ERROR); }#endif /* INCLUDE_TFFS */#ifdef INCLUDE_TSFS_BOOT/******************************************************************************** RETURNS: OK, or ERROR if file can not be loaded.** NOMANUAL*/LOCAL STATUS tsfsLoad ( char * fileName, /* file name to download */ FUNCPTR * pEntry ) { int fd; WDB_EVT_NODE rebootEventNode; char corefile [100]; if (fileName[0] != '/' && fileName[0] != '\\') sprintf (corefile, "/tgtsvr/%s", fileName); else sprintf (corefile, "/tgtsvr%s", fileName); printf ("Booting using TSFS...\nMake sure that your"); printf (" Target Server is started with -R[oot] option.\n");#ifndef INCLUDE_TSFS_BOOT_VIO_CONSOLE printf ("Waiting for Target Server connection..."); while (!wdbTargetIsConnected()) taskDelay (sysClkRateGet()); printf (" Done.\n");#endif /* INCLUDE_TSFS_BOOT_VIO_CONSOLE */ printErr ("\nLoading %s...\n", corefile); if ((fd = open (corefile, O_RDONLY, 0)) == ERROR) { printErr ("\nCannot open \"%s\".\n", corefile); return (ERROR); } if (bootLoadModule (fd, pEntry) != OK) goto tsfsLoadErr; close (fd);#if (WDB_COMM_TYPE != WDB_COMM_SERIAL) wdbEventNodeInit (&rebootEventNode, wdbRebootEventGet, NULL, NULL); wdbEventPost (&rebootEventNode); taskDelay (sysClkRateGet() / 10);#endif /* WDB_COMM_TYPE != WDB_COMM_SERIAL */ return (OK);tsfsLoadErr: close (fd); return (ERROR); }/******************************************************************************** wdbRebootEventGet - dummy eventGet routine to force the Target Server restart** suspend the WDB task, so the Target Server will get a RPC_SYSTEMERROR* will trying to get an event, so it will restart and try to re-attach to* the target.*/LOCAL void wdbRebootEventGet ( void * pNode, WDB_EVT_DATA * pEvtData ) { taskSuspend (0); }#endif /* INCLUDE_TSFS_BOOT */#ifdef INCLUDE_NETWORK/******************************************************************************** netifAdrsPrint - print MAC address of a network interface*/LOCAL void netifAdrsPrint ( char *ifname /* interface name */ ) { IMPORT struct ifnet *ifunit (); struct ifnet *ifp; char *buf; char devName [10]; int i, value; if (ifname == NULL || *ifname == EOS) { printf ("Interface not specified\n"); return; } while (*ifname == ' ') ifname++; /* skip leading blanks */ if (*ifname == EOS) { printf ("Interface not specified\n"); return; } i = 0; while (!isdigit((int)ifname[i]) && !isspace((int)ifname[i]) && ifname[i] != EOS) i++; if (ifname[i] == EOS) value = 0; buf = &ifname[i]; if (bootScanNum (&buf, &value, FALSE) != OK) value = 0; ifname[i] = EOS; sprintf (devName, "%s%d", ifname, value); if (strncmp (devName, "bp", 2) == 0) { printf ("Address for device \"%s\" == 00:00:00:00:00:%02x\n", devName, sysProcNumGet ()); return; } hostTblInit (); /* initialize host table */ if (netLibInit () != OK) printf ("netLibInit() error returned\n"); if ((ifp = ifunit (devName)) == NULL) { if ((usrNetIfAttach (ifname, value, "0") != OK) || (usrNetIfConfig (ifname, value, "0", (char *) NULL, 0) != OK)) { printf ("Cannot initialize interface named \"%s\"\n", devName); return; } if ((ifp = ifunit (devName)) == NULL) { printf ("Device named \"%s\" doesn't exist.\n", devName); return; } } if (!(ifp->if_flags & IFF_POINTOPOINT) && !(ifp->if_flags & IFF_LOOPBACK)) { printf ("Address for device \"%s\" == %02x:%02x:%02x:%02x:%02x:%02x\n", devName, ((struct arpcom *)ifp)->ac_enaddr [0], ((struct arpcom *)ifp)->ac_enaddr [1], ((struct arpcom *)ifp)->ac_enaddr [2], ((struct arpcom *)ifp)->ac_enaddr [3], ((struct arpcom *)ifp)->ac_enaddr [4], ((struct arpcom *)ifp)->ac_enaddr [5]); } if_dettach (ifunit (devName)); /* dettach interface for fresh start */ }#endif /* INCLUDE_NETWORK *//********************************************************************************* go - start at specified address*/LOCAL void go ( FUNCPTR entry ) { printf ("Starting at 0x%x...\n\n", (int) entry); taskDelay (sysClkRateGet ()); /* give the network a moment to close */#ifdef INCLUDE_NETWORK if (netLibInitialized == TRUE) ifreset (); /* reset network to avoid interrupts */#ifdef INCLUDE_END (void) muxDevStopAll (0); #endif /* INCLUDE_END */#endif /* INCLUDE_NETWORK */#if (CPU_FAMILY == PPC) cacheTextUpdate ((void *) (LOCAL_MEM_LOCAL_ADRS), /* cache coherency */ (size_t) (sysMemTop() - LOCAL_MEM_LOCAL_ADRS));#else#ifdef INCLUDE_CACHE_SUPPORT cacheClear (DATA_CACHE, NULL, ENTIRE_CACHE); /* push cache to mem */#endif /* INCLUDE_CACHE_SUPPORT */#endif /* (CPU_FAMILY == PPC) */#if (CPU_FAMILY == I80X86) sysClkDisable (); /* disable the system clock interrupt */ sysIntLock (); /* lock the used/owned interrupts */# if defined (SYMMETRIC_IO_MODE) || defined (VIRTUAL_WIRE_MODE) { extern void loApicEnable (); loApicEnable (FALSE); /* disable the LOAPIC */ }# if defined (SYMMETRIC_IO_MODE) { extern BOOL sysBp; /* TRUE for BP, FALSE for AP */ extern void ioApicEnable (); if (sysBp) ioApicEnable (FALSE); /* disable the IO APIC */ }# endif /* (SYMMETRIC_IO_MODE) */# endif /* (SYMMETRIC_IO_MODE) || (VIRTUAL_WIRE_MODE) */#endif /* (CPU_FAMILY == I80X86) */ intLock(); (entry) (); }/********************************************************************************* m - modify memory*** All numbers entered and displayed are in hexadecimal.* Memory is treated as 16-bit words.*/LOCAL void m ( char *adrs /* address to change */ ) { char line [MAX_LINE + 1]; /* leave room for EOS */ char *pLine; /* ptr to current position in line */ int value; /* value found in line */ char excess; /* round down to word boundary */ for (adrs = (char *) ((int) adrs & 0xfffffffe); /* start on even addr */ ; /* FOREVER */ adrs = (char *) (((short *) adrs) + 1)) /* bump as short ptr */ { /* prompt for substitution */ printf ("%06x: %04x-", (int) adrs, (*(short *)adrs) & 0x0000ffff); /* get substitution value: * skip empty lines (CR only); * quit on end of file or invalid input; * otherwise put specified value at address */ if (fioRdString (STD_IN, line, MAX_LINE) == EOF) break; line [MAX_LINE] = EOS; /* make sure input line has EOS */ /* skip leading spaces*/ for (pLine = line; isspace ((UINT) * pLine); ++pLine) ; if (*pLine == EOS) /* skip field if just CR */ continue; if (sscanf (pLine, "%x%1s", &value, &excess) != 1) break; /* quit if not number */ * (short *) adrs = value; /* assign new value */ } printf ("\n"); }/********************************************************************************* d - display memory** Display contents of memory, starting at adrs. Memory is displayed in* words. The number of words displayed defaults to 64. If* nwords is non-zero, that number of words is printed, rounded up to* the nearest number of full lines. That number then becomes the default.*/LOCAL void d ( FAST char *adrs, /* address to display */ int nwords /* number of words to print. */ ) /* If 0, print 64 or last specified. */ { static char *last_adrs; static int dNbytes = 128; char ascii [17]; FAST int nbytes; FAST int byte; ascii [16] = EOS; /* put an EOS on the string */ nbytes = 2 * nwords; if (nbytes == 0) nbytes = dNbytes; /* no count specified: use current byte count */ else dNbytes = nbytes; /* change current byte count */ if (adrs == 0) adrs = last_adrs; /* no address specified: use last address */ adrs = (char *) ((int) adrs & ~1); /* round adrs down to word boundary */ /* print leading spaces on first line */ bfill ((char *) ascii, 16, '.'); printf ("%06x: ", (int) adrs & ~0xf); for (byte = 0; byte < ((int) adrs & 0xf); byte++) { printf (" "); if (byte & 1) printf (" "); /* space between words */ if (byte == 7) printf (" "); /* extra space between words 3 and 4 */ ascii [byte] = ' '; } /* print out all the words */ while (nbytes-- > 0) { if (byte == 16) { /* end of line: * print out ascii format values and address of next line */ printf (" *%16s*\n%06x: ", ascii, (int) adrs); bfill ((char *) ascii, 16, '.'); /* clear out ascii buffer */ byte = 0; /* reset word count */ }#if _BYTE_ORDER == _BIG_ENDIAN printf ("%02x", *adrs & 0x000000ff);#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ /* swap odd and even bytes */ if ( (long)adrs & 1) { printf ("%02x", *((char *)((long)adrs & 0xfffffffe)) & 0x000000ff); } else { printf ("%02x", *((char *)((long)adrs + 1)) & 0x000000ff); }#endif /* _BYTE_ORDER == _BIG_ENDIAN */ if (byte & 1) printf (" "); /* space between words */ if (byte == 7) printf (" "); /* extra space between words 3 and 4 */ if (* adrs == ' ' || (isascii ((UINT) * adrs) && isprint ((UINT) * adrs))) ascii [byte] = (UINT) * adrs; adrs++; byte++; } /* print remainder of last line */ for (; byte < 16; byte++) { printf (" "); if (byte & 1) printf (" "); /* space between words */ if (byte == 7) printf (" "); /* extra space between words 3 and 4 */ ascii [byte] = ' '; } printf (" *%16s*\n", ascii); /* print out ascii format values */ last_adrs = adrs; }/********************************************************************************* bootExcHandler - bootrom exception handling routine*/LOCAL void bootExcHandler ( int tid /* task ID */ ) { REG_SET regSet; /* task's registers */ /* get registers of task to be traced */ if (taskRegsGet (tid, ®Set) != ERROR) { trcStack (®Set, (FUNCPTR) NULL, tid); taskRegsShow (tid); } else printf ("bootExcHandler: exception caught but no valid task.\n"); taskDelay (sysClkRateGet ()); /* pause a second */ reboot (BOOT_NO_AUTOBOOT); }/********************************************************************************* skipSpace - advance pointer past white space** Increments the string pointer passed as a parameter to the next* non-white-space character in the string.*/LOCAL void skipSpace ( FAST char **strptr /* pointer to pointer to string */ ) { while (isspace ((UINT) ** strptr)) ++ * strptr; }/********************************************************************************* printExcMsg - print exception message** Avoid printing possible control characters in exception message area.*/LOCAL void printExcMsg ( char *string ) { printf ("\n"); while (isascii ((UINT) * string) && (isprint ((UINT) * string) || isspace ((UINT) * string))) printf ("%c", * string++); printf ("\n"); }/******************************************************************************** getArg - get argument from command line*** RE
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -