gonzui


Format: Advanced Search

tkernel_2/monitor/hwdepend/tef_em1d/src/startup.cbare sourcepermlink (0.00 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      startup.c
   17:  *
   18:  *       system boot processing
   19:  */
   20: 
   21: #include "hwdepend.h"
   22: 
   23: /* No support for the progress report yet */
   24: #define DispProgress(n)         /* nop */
   25: 
   26: /*
   27:  * debug port speed
   28:  *       default setting is LO:38400bps, and HI:115200bps. But
   29:  *       if you need a different set value, then define the following macros in {cpu}/{machine}/setup_xxx.h :
   30:  *       LO_BAUD_RATE, and HI_BAUD_RATE.
   31:  */
   32: #ifndef LO_BAUD_RATE
   33: #  define LO_BAUD_RATE   38400
   34: #endif
   35: #ifndef HI_BAUD_RATE
   36: #  define HI_BAUD_RATE  115200
   37: #endif
   38: 
   39: /*
   40:  * initial processing after reset
   41:  */
   42: EXPORT void procReset( void )
   43: {
   44:         const MEMSEG   *mp;
   45:         W      i;
   46:         W      speed;
   47: 
   48:         DispProgress(0x01);
   49: 
   50:         /* system basic set up */
   51:         resetSystem(0);
   52:         DispProgress(0x06);
   53: 
   54:         /* setting up the initial count for micro-wait */
   55:         setupWaitUsec();
   56:         DispProgress(0x07);
   57: 
   58:         /* initialize console serial port */
   59: #if SW_BHI == 0
   60:         speed = HI_BAUD_RATE; /* HI speed is fixed. */
   61: #else
   62:         speed = ( (DipSw & SW_BHI) != 0 )? HI_BAUD_RATE: LO_BAUD_RATE;
   63: #endif
   64:         initSIO(getConPort(), speed);
   65:         DispProgress(0x08);
   66: 
   67:         /* initialize hardware (peripherals) */
   68:         initHardware();
   69:         DispProgress(0x0d);
   70: 
   71:         /* memory clear is not done to save time when automatic reboot is under way. */
   72:         if ( bootSelect() == BS_MONITOR ) {
   73:                 cpuLED(LED_MEMCLR);
   74: 
   75:                 /* all memory clear (save the monitor area) */
   76:                 for ( i = 1;; ++i ) {
   77:                         mp = MemArea(MSA_OS|MSA_ERAM, i);
   78:                         if ( mp == NULL ) break;
   79: 
   80:                         memset((void*)mp->top, 0, mp->end - mp->top);
   81:                 }
   82:         }
   83:         cpuLED(LED_POWERUP);
   84:         DispProgress(0x0e);
   85: 
   86:         /* initialize break processing */
   87:         initBreak();
   88: 
   89:         /* Invoking user reset initialization routine */
   90:         callUserResetInit();
   91:         DispProgress(0x0f);
   92: }