/* ChangeConsoleBaudrate(): * Called to attempt to adjust the console baudrate. * Support 2 special cases: * if baud == 0, then just turn off console echo; * if baud == 1, turn it back on. */ int ChangeConsoleBaudrate(int baud) { if (baud == 0) console_echo(0); else if (baud == 1) console_echo(1); else { if (ConsoleBaudSet(baud) < 0) { printf("Baud=%d failed\n",baud); return(-1); } ConsoleBaudRate = baud; ConsoleBaudEnvSet(); } return(0); }
/* init3(): * As each target boots up, it calls init1() and init2() to do multiple * phases of hardware initialization. This third initialization phase * is always common to all targets... * It is possible that this is being called by AppWarmStart(). In this * case, the user can specify which portions of the monitor code are * to be initialized by specifying them in the startmode mask. */ static void _init3(ulong startmode) { char *baud; #if INCLUDE_LINEEDIT /* Initialize command line history table. */ historyinit(); #endif #if INCLUDE_SHELLVARS /* Init shell variable table. */ ShellVarInit(); #endif #if INCLUDE_USRLVL /* Set user level to its max, then allow monrc file to adjust it. */ initUsrLvl(MAXUSRLEVEL); #endif #if INCLUDE_BOARDINFO /* Check for board-specific-information in some otherwise unused * sector. Also, establish shell variables from this information * based on the content of the boardinfo structure. * Note that the second half of the board-specific information setup * (the call to BoardInfoEnvInit()) must be done AFTER ShellVarInit() * because shell variables are established here. */ if(startmode & WARMSTART_BOARDINFO) { BoardInfoInit(); BoardInfoEnvInit(); } #endif #ifdef MONCOMPTR /* If MONCOMPTR is defined, then verify that the definition matches * the location of the actual moncomptr value. The definition in * config.h is provided so that outside applications can include that * header file so that the value passed into monConnect() is defined * formally. The REAL value of moncomptr is based on the location of * the pointer in monitor memory space, determined only after the final * link has been done. As a result, this check is used to simply verify * that the definition matches the actual value. */ { if(MONCOMPTR != (ulong)&moncomptr) { printf("\nMONCOMPTR WARNING: runtime != definition\n"); } } #endif #if INCLUDE_TFS /* After basic initialization, if the monitor's run-control file * exists, run it prior to EthernetStartup() so that the * MAC/IP addresses can be configured based on shell variables * that would be loaded by the rc file. */ if(startmode & WARMSTART_RUNMONRC) { tfsrunrcfile(); } #endif /* After MONRC is run, establish monitor flags... */ InitMonitorFlags(); /* We've run the monrc file at this point, so check for the * presence of the CONSOLEBAUD shell variable. If it's set, * then use the value to re-establish the console baud rate. * If it isn't set, then establish the CONSOLEBAUD shell variable * using the default, pre-configured baud rate. */ baud = getenv("CONSOLEBAUD"); if(baud) { ChangeConsoleBaudrate(atoi(baud)); } ConsoleBaudEnvSet(); #if INCLUDE_ETHERNET #if INCLUDE_STOREMAC storeMac(0); #endif if(startmode & WARMSTART_IOINIT) { EthernetStartup(0,1); } #endif /* Now that all has been initialized, display the monitor header. */ #ifndef NO_UMON_STARTUP_HDR if(startmode & WARMSTART_MONHEADER) { if(!MFLAGS_NOMONHEADER()) { monHeader(1); } } #endif #if INCLUDE_FBI if(StateOfMonitor == INITIALIZE) { fbi_splash(); } #endif #if INCLUDE_TFS if(startmode & WARMSTART_TFSAUTOBOOT) { tfsrunboot(); } #endif }