📄 usrconfig1.c
字号:
/* initialize interactive shell */#ifdef INCLUDE_SHELL#ifdef INCLUDE_SECURITY /* include shell security */ if ((sysFlags & SYSFLG_NO_SECURITY) == 0) { loginInit (); /* initialize login table */ shellLoginInstall (loginPrompt, NULL); /* install security program */ /* add additional users here as required */ loginUserAdd (LOGIN_USER_NAME, LOGIN_PASSWORD); }#endif /* INCLUDE_SECURITY */ printLogo (); /* print out the banner page */ printf (" "); printf ("CPU: %s. Processor #%d.\n", sysModel (), sysProcNumGet ()); printf (" ");#ifdef HITACHI_SH_KERNEL_ON_SDRAM printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)FREE_RAM_ADRS));#else /* HITACHI_SH_KERNEL_ON_SDRAM */ printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)LOCAL_MEM_LOCAL_ADRS));#endif /* HITACHI_SH_KERNEL_ON_SDRAM */ printf (" BSP version " BSP_VERSION BSP_REV ".");#if defined(INCLUDE_WDB) && defined(INCLUDE_WDB_BANNER) printf ("\n "); printf ("WDB Comm Type: %s", WDB_COMM_TYPE_STR); printf ("\n "); printf ("WDB: %s.", ((wdbRunsExternal () || wdbRunsTasking ()) ? "Ready" : "Agent configuration failed") );#endif /*INCLUDE_WDB && INCLUDE_WDB_BANNER*/ printf ("\n\n");#ifdef INCLUDE_STARTUP_SCRIPT /* run a startup script */ if (sysBootParams.startupScript [0] != EOS) usrStartupScript (sysBootParams.startupScript);#endif /* INCLUDE_STARTUP_SCRIPT */ shellInit (SHELL_STACK_SIZE, TRUE); /* create the shell */ /* only include the simple demo if the shell is NOT included */#else#if defined(INCLUDE_DEMO) /* create demo w/o shell */ taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);#endif /* mips cpp no elif */#endif /* INCLUDE_SHELL */#ifdef INCLUDE_WINDML usrWindMlInit ();#endif /* INCLUDE_WINDML */#if defined (INCLUDE_SOUND) && defined(INCLUDE_SB16) sb16Drv (); /* install sound driver SB16 */ sb16DevCreate ("/sound", 0x220, 5, 1, 5);#endif /* INCLUDE_SOUND && INCLUDE_SB16 */#if defined(INCLUDE_JAVA) javaConfig ();#endif /* INCLUDE_JAVA */#ifdef INCLUDE_HTML usrHtmlInit ();#endif /* INCLUDE_HTML */#if CPU==SIMNT win_ReleaseMutex(simUpMutex);#endif#ifdef INCLUDE_USER_APPL /* Startup the user's application */ USER_APPL_INIT; /* must be a valid C statement or block */#endif }/********************************************************************************* usrClock - user-defined system clock interrupt routine** This routine is called at interrupt level on each clock interrupt.* It is installed by usrRoot() with a sysClkConnect() call.* It calls all the other packages that need to know about clock ticks,* including the kernel itself.** If the application needs anything to happen at the system clock interrupt* level, it can be added to this routine.** RETURNS: N/A*/void usrClock () { tickAnnounce (); /* announce system tick to kernel */ reset_watch_dog(); }#ifdef INCLUDE_DEMO/********************************************************************************* usrDemo - example application without shell** This routine is spawned as a task at the end of usrRoot(), if INCLUDE_DEMO* is defined, and INCLUDE_SHELL is NOT defined in configAll.h or config.h.* It is intended to indicate how a shell-less application can be linked,* loaded, and ROMed.** NOMANUAL*/void usrDemo (void) { char string [40]; printf ("VxWorks (for %s) version %s.\n", sysModel (), vxWorksVersion); printf ("Kernel: %s.\n", kernelVersion ()); printf ("Made on %s.\n", creationDate); FOREVER { printf ("\nThis is a test. Type something: "); fioRdString (STD_IN, string, sizeof (string)); printf ("\nYou typed \"%s\".\n", string); if (strcmp (string, "0") == 0) memShow (0); if (strcmp (string, "1") == 0) memShow (1); } }#endif /* INCLUDE_DEMO *//********************************************************************************* 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 ddd ( 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, '.'); Print ("%06x: ", (int) adrs & ~0xf); for (byte = 0; byte < ((int) adrs & 0xf); byte++) { Print (" "); if (byte & 1) Print (" "); /* space between words */ if (byte == 7) Print (" "); /* 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 */ Print (" *%16s*\n%06x: ", ascii, (int) adrs); bfill ((char *) ascii, 16, '.'); /* clear out ascii buffer */ byte = 0; /* reset word count */ }#if _BYTE_ORDER == _BIG_ENDIAN Print ("%02x", *adrs & 0x000000ff);#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ /* swap odd and even bytes */ if ( (long)adrs & 1) { Print ("%02x", *((char *)((long)adrs & 0xfffffffe)) & 0x000000ff); } else { Print ("%02x", *((char *)((long)adrs + 1)) & 0x000000ff); }#endif /* _BYTE_ORDER == _BIG_ENDIAN */ if (byte & 1) Print (" "); /* space between words */ if (byte == 7) Print (" "); /* 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++) { Print (" "); if (byte & 1) Print (" "); /* space between words */ if (byte == 7) Print (" "); /* extra space between words 3 and 4 */ ascii [byte] = ' '; } Print (" *%16s*\n", ascii); /* print out ascii format values */ last_adrs = adrs;}extern void CallStack(REG_SET *pRegSet);extern ULONG bReboot;LOCAL void mybootExcHandler ( int task, /* ID of offending task */ int vecNum, /* exception vector number */ ESF *pEsf /* pointer to exception stack frame */ ){ REG_SET * pRegs; pRegs= ((WIND_TCB*)task)->pExcRegSet; switch (pEsf->vecAddr) { case EXC_OFF_RESET: /* branch through zero */ Print("exception EXC_OFF_RESET\n"); break; case EXC_OFF_UNDEF: /* undefined instruction */ Print("exception EXC_OFF_UNDEF\n"); break; case EXC_OFF_SWI: /* software interrupt */ Print("exception EXC_OFF_SWI\n"); break; case EXC_OFF_PREFETCH: /* prefetch abort */ Print("exception EXC_OFF_PREFETCH\n"); break; case EXC_OFF_DATA: /* data abort */ Print("exception EXC_OFF_DATA\n"); break; default: /* what else can there be? */ break; } Print("pRegs->fpreg=%x\n",pRegs->fpReg); Print("pRegs->spreg=%x\n",pRegs->spReg); Print("pRegs->pc=%x\n",pRegs->pc); Print("pRegs->lr=%x\n",pRegs->r[14]); /*ddd((char *)(pRegs->spReg-0x20),0x200);*/ CallStack(pRegs); bReboot=1; /*reset_watch_dog() will reboot the system*/ }int SysBaud=9600;#if 0ULONG Print(char *format, ...){char buf[1024], *p;va_list arg_pt;#if 1va_start(arg_pt, format);vsprintf (buf, format, arg_pt);for (p = buf; *p; p++) { if (*p == '\n') rawprint(0, '\r'); rawprint(0, *p); }va_end(arg_pt);#endif}#endifvoid redict(void){ ioGlobalStdSet (STD_IN, vty_rdio_fd); ioGlobalStdSet (STD_OUT, vty_rdio_fd); ioGlobalStdSet (STD_ERR, vty_rdio_fd);}/*interface_device_callback_gettype(){}*/weba_user_get_diid(){}/*hty_main(){}*//*interface_omnivorous_callback_getbriefname(){}*//*interface_omnivorous_callback_makemomentary(){}*//*interface_omnivorous_callback_newqueryid(){}*/doshowsystem_info(){}/*interface_omnivorous_callback_getname(){}*/logic_init(){}sys_get_console_devid(){}/*interface_omnivorous_callback_line2diID(){}interface_omnivorous_callback_diID2line(){}*//*ip_addr_addr_dhcp(){}debug_ip_mcontrol(){}*/RAND_bytes(){}/*httpd_notify(){}*/get_ppc_r1(){}show_am973_slotinfo(){}IsRadiusGroup(){}do_marfec_sta(){}do_vlanmap(){}/*send_easy_trap(){}*/do_show_cp15(){}/*interface_set_showrunning_service(){}*/GetRadiusQid(){}isdn_dsl_add_b(){}isdn_dsl_delete(){}isdn_dsl_init(){}set_CardIfIndexEntry(){}GetDrvGrp(){}isdn_pri_dsl_add_b(){}long_return(){}/*send_link_trap(){}*//*snmp_oid_compare(){}*//*snmp_trace(){}*//*debugmsgtoken(){}*//*nullOid(){}*//*debugmsg(){}*//*nullOidLen(){}*//*register_snmp(){}snmp_get_sysUpTime(){}snmp_get_do_debugging(){}register_mib(){}sprint_objid(){}*//*dhcp_addr_duplicate(){}*/igmp_db_getif_byid(){}gre_input(){}/*dhcp_free_address(){}*/show_gre_traffic_c(){}show_gre_traffic_e(){}hdlc_fsc_service(){}/*ppp_fsc_service(){}*/header_generic(){}/*http_add_nat_entries(){}http_del_nat_entries(){}*/ipsec_input(){}ipsec_input2(){}ipsec_output(){}ipsec_output2(){}qos_change_dscp(){}/*dhcp_portupdown_up(){}*/ipsec_packet_proc(){}send_msg_to_cmd(){}/*dhcp_alloc_address(){}*//*dhcp_portupdown_update(){}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -