Beispiel #1
0
/*!
 * Init board.
 */
void BoardInit(void)
{
    /* Initialise ports. */
    PortInit();
    /* Initialise system clock. */
    SystemClkInit();
    /* Initialise SPI1. */
    Spi1Init();
    /* Initialise Timer0. */
    Timer0Init();
    /* Initialise Timer3. */
    Timer3Init();
    /* Initialise interrupts. */
    InterruptInit();
    /* Initialise the LCD. */
    LcdInit();
    /* Clear LCD. */
    LcdClearDisplay();
    /* Initialise LEDs. */
    LEDInit();
  #ifdef RTC_ENABLED
    /* RTC init. */
    RTC_Init();
  #endif //RTC_ENABLED
  #ifdef UART0_ENABLED
    /* UART0 init. */
    Uart0Init();
  #endif //UART0_ENABLED
}
Beispiel #2
0
void InitSystem() {
    // General init
    InitOsc();
    InitPort();

    // Peripheral init
    AdcInit();
    I2cInit();

    // Interrupt init
    InterruptInit();
}
Beispiel #3
0
void Main(void)
 {
  InterruptInit();
  IntDisableAll();
  Platform_Init();
  

  TS_Init();                            /* Init the kernel. */
  TMR_Init();                           /* Init the TMR module */							
  NvModuleInit();
  Uart_ModuleInit();
  /* This only creates the MAC TS thread. */
  MacInit();
  /* Use TS for MAC  - the MAC TS ID must be known at this step. */
  Init_802_15_4(TRUE);

  #if gZtcIncluded_d
  Ztc_TaskInit();
  #endif /* gZtcIncluded_d */ 

  /*initialize the application*/ 
  gAppTaskID_c = TS_CreateTask(gTsAppTaskPriority_c, AppTask);
 
  MApp_init();
  #if (gLpmIncluded_d == 1)
    /*do not allow the device to enter sleep mode*/
    PWR_DisallowDeviceToSleep();
  #endif /* gLpmIncluded_d == 1 */
 
  /*All LED's are switched OFF*/
  Led1Off();
  Led2Off();
  Led3Off();
  Led4Off();
  
  /* Start the task scheduler. Does not return. */
  TS_Scheduler(); 
 
}
Beispiel #4
0
void
StartOS (AppModeType mode)
{
  /* Set application mode */
  sdvos_appmode = mode;

  /*
   * Initialize the MCU we are using. This involves low
   * level initialization which usually at least include
   * a stack switch after disabling interrupts globally for
   * initialization. It is OK because StartOS will never
   * return and we already processed the parameter.
   * Procedures after this call will be carried out in
   * SDVOS kernel context.
   *
   * McuInit can either be a C function, assembly function
   * or a macro on different platforms.
   */
  McuInit ();

  /*
   * Board specific initialization. Might include clock
   * configuration, flash setup, etc.
   */
  BoardInit ();

  /* Initialize Interrupt Handling */
  InterruptInit ();

  /* Initialize all the drivers configured */
  DriversInit ();

  /* Activate auto start tasks */
  TaskAutoStart (sdvos_appmode);

  /* Initialize Alarm/Counter */
  AlarmInit ();

#ifdef USE_SCHEDTBL
  /*
   * Initialize schedule table. This is mostly schedule
   * table auto start. And it has to be done after task
   * and alarm auto start. [SWS_Os_00510]
   */
  ScheduleTableInit ();
#endif

  /*
   * StartupHook is called by the OS at the end of the
   * initialization and before the scheduler is running.
   */
  STARTUPHOOK ();

#ifdef DEBUG_SDVOS_VERBOSE
  IntegrityCheck ();
#endif

#ifdef PRINT_BANNER
  PrintBanner ();
#endif

  DEBUG_PRINTF ("Starting SDVOS in mode %d...\n", sdvos_appmode);

  /* Switch to the first user task */
  JumpNext ();

  /* Should never reach here */
  return;
}
Beispiel #5
0
static void NemesisMainThread(kernel_st *kst)
{
    DomainMgrMod_clp	dmm;
    DomainMgr_clp	dm;

    TRC(printf("NemesisMainThread: entered.\n"));
    
    TRC(printf( " + Finding DomainMgr...\n"));
    dmm = NAME_FIND("modules>DomainMgrMod",DomainMgrMod_clp);
    dm  = NAME_FIND("sys>DomainMgr",DomainMgr_clp);
    
    TRC(printf( " + Completing Domain Manager initialisation.\n"));
    DomainMgrMod$Done (dmm, dm);

    /* Get a tag for ourselves and tell the world about it */
    TRC(printf( " + Creating a Security.Tag for the system.\n"));
    {
	Security_Tag tag;
	Security_clp sec;
	Type_Any any;

	sec=IDC_OPEN("sys>SecurityOffer", Security_clp);
	/* XXX will be local, so we don't need to worry about dropping
	   it on the floor */
	if (Security$CreateTag(sec, &tag)) {
	    ANY_INIT(&any, Security_Tag, tag);
	    Context$Add (Pvs(root), "sys>SystemTag", &any);
	} else {
	    printf("Error: couldn't create system tag\n");
	    ntsc_dbgstop();
	}
    }


#if defined(CONFIG_MEMSYS_STD) || defined(CONFIG_MEMSYS_EXPT)
    TRC(printf( " + Creating mmentry.\n"));
    {
	MMEntryMod_cl *mmemod;
	MMEntry_cl    *mmentry; 
	MMNotify_cl   *mmnfy;

	mmemod  = NAME_FIND("modules>MMEntryMod", MMEntryMod_clp);
	mmnfy   = NAME_FIND("sys>MMNotify", MMNotify_clp);
	mmentry = MMEntryMod$New(mmemod, mmnfy, (ThreadF_cl *)Pvs(thds), 
				 Pvs(heap), 10 /* XXX should be param? */);
    }
#endif

    TRC(printf( " + Register binder's protection domain.\n"));
    {
	ProtectionDomain_ID pdid = VP$ProtDomID(Pvs(vp));
	ANY_DECL(tmpany,ProtectionDomain_ID, pdid); 
	Context$Add (Pvs(root), "sys>BinderPDom",&tmpany);
    } 
    
    TRC(printf( " + Register standard root context.\n"));
    CX_ADD ("sys>StdRoot", Pvs(root), Context_clp);

    /* Interrupt Allocation Module */
    TRC(printf( " + Init interrupt allocation module.\n"));
    {
	Interrupt_clp ipt;
	
	/* Find the interrupt allocation module */
	ipt = InterruptInit(kst);
	TRC(printf(" + Created an Interrupt server at %p.\n", ipt));
	TRC(printf(" +   exporting... "));
	IDC_EXPORT ("sys>InterruptOffer", Interrupt_clp, ipt);
	TRC(printf("done\n"));
    }
    
#ifdef CONFIG_CALLPRIV
    /* CallPriv allocation module */
    TRC(printf( " + Init CallPriv allocation module.\n"));
    {
	CallPriv_clp cp;

	/* Find the callpriv module */
	cp = CallPrivInit(kst);
	TRC(printf(" + created a CallPriv server at %p\n", cp));
	TRC(printf(" +   exporting... "));
	IDC_EXPORT ("sys>CallPrivOffer", CallPriv_clp, cp);
	TRC(printf("done.\n"));
    }
#endif /* CONFIG_CALLPRIV */

#ifdef CONFIG_MODULE_OFFSET_DATA
    /* Module offset data module */
    TRC(printf( " + Init ModData module.\n"));
    {
	ModData_clp md;

	md=ModDataInit();
	TRC(printf(" + created a ModData server at %p\n", md));
	TRC(printf(" +   exporting... "));
	IDC_EXPORT ("sys>ModDataOffer", ModData_clp, md);
	TRC(printf("done.\n"));
    }
#endif /* CONFIG_MODULE_OFFSET_DATA */

    {
	Type_Any any;
	if (Context$Get(Pvs(root), "modules>PCIBiosInstantiate", &any)) {
	    Closure_clp pcibiosinstantiate;
	    pcibiosinstantiate = NARROW(&any, Closure_clp);
	    TRC(printf( " + Init PCIBios allocation module.\n"));
	    Closure$Apply(pcibiosinstantiate);
	}
    }
	   
#ifdef AXP3000 
    TRC(printf( " + Probing Turbochannel...\n"));
    {
	char name[TC_ROMNAMLEN+2]; /* 1 extra for number, one for '\0' */
	volatile uint32_t *romptr;
	volatile uint32_t *mchk_expected = &(kst->mchk_expected);
	volatile uint32_t *mchk_taken = &(kst->mchk_taken);
	Context_clp tc_cx;
	NOCLOBBER int i, j, k;
	NOCLOBBER char added, dev_no;
	
	tc_cx = CX_NEW("sys>tc");

	for(i=0; i < 6; i++) {
	    /* get a pointer to the 'name' of the card current slot */
	    romptr = (uint32_t *)((char *)slots[i].addr+(TC_NAME_OFFSET*2));
	    
	    /* setup kernel to ignore a mchk (such as TC read timeout) */
	    *mchk_expected = True;
	    *mchk_taken    = 0;

	    /* dereference the romptr & see if we get a mchk */
	    *((uint32_t *)TC_EREG) = 0; /* unlock tcerr */
	    *romptr;

	    if(!(*mchk_taken)) { /* all is ok => read out the name */
#define TC_ROM_STRIDE 2
		for (j = 0, k = 0; j < TC_ROMNAMLEN; j++, k += TC_ROM_STRIDE) 
		    name[j] = (char)romptr[k];
		name[TC_ROMNAMLEN] = name[TC_ROMNAMLEN+1] = ' ';
		
		/* Get rid of extra spaces at the end & add in device number */
		dev_no= '0';
		added = False;

		for (j = 0; name[j]!=' '; j++)
		    ;
		name[j]   = dev_no;
		name[j+1] = '\0'; 

	        while(!added) {
		    TRY {
			CX_ADD_IN_CX(tc_cx, (char *)name, 
				     &(slots[i]), TCOpt_SlotP);
			added= True;
		    } CATCH_Context$Exists() {
			name[j]= dev_no++;
		    } ENDTRY;
		}

		TRC(printf(" +++ probed slot %d: added card, name= \"%s\"\n", 
			i, name));

	    } else {
#define MCHK_K_TC_TIMEOUT_RD   0x14
		if(*mchk_taken==MCHK_K_TC_TIMEOUT_RD) {
		    TRC(printf(" +++ slot %d is empty.\n", i));
		} else {
		    TRC(printf(" *** Bad MCHK (code 0x%x) taken in TC probe."
			    "Halting.\n",
			    *mchk_taken));
		}
	    }
	}

	
	*((uint32_t *)TC_EREG) = 0; /* unlock tcerr */
	*mchk_expected =  False;    /* enable mchks again */

	TRC(printf(" + Turbochannel probe done.\n"));
    }