Пример #1
0
int main(void)
{
	StartOS(OSDEFAULTAPPMODE);
	return 0;
}
Пример #2
0
FUNC(int, OS_CODE) main(void)
{
	StartOS(OSDEFAULTAPPMODE);
	return 0;
}
Пример #3
0
int main(void)
{
   StartOS(AppMode1);
   return 0;
}
Пример #4
0
FUNC(int, OS_APPL_CODE) main(void)
{
  initBoard(BUTTON_NOIT);
  StartOS(OSDEFAULTAPPMODE);
  return 0;
}
Пример #5
0
sword main(void)
{
  sword swReturn;

  // USER CODE BEGIN (Main,2)

  // USER CODE END

  swReturn = 0;

  switch(RESET_INDICATOR)
  {
    case WATCHDOG_RESET:         //  the last reset was a watchdog triggered
                                 //  (hardware) reset

         // USER CODE BEGIN (Main,3)

         // USER CODE END

    case SOFTWARE_RESET:         //  the last reset was an internally 
                                 //  triggered software reset

         // USER CODE BEGIN (Main,4)

         // USER CODE END

    case ESR0_RESET:             //  the last reset was an externally 
                                 //  triggered hardware reset (#ESR0 pin)

         // USER CODE BEGIN (Main,4.1)

         // USER CODE END

    case ESR1_RESET:             //  the last reset was an externally 
                                 //  triggered hardware reset (#ESR1 pin)

         // USER CODE BEGIN (Main,4.2)

         // USER CODE END

    case POWERON_RESET:          //  the last reset was an externally
                                 //  triggered power on reset (#POR pin)

         // USER CODE BEGIN (Main,5)

         // USER CODE END

    default:

         // USER CODE BEGIN (Main,6)

         // USER CODE END

         MAIN_vInit();
  }


         // USER CODE BEGIN (Main,7)
	StartOS(OSDEFAULTAPPMODE);
         // USER CODE END

  return(swReturn);

} //  End of function main
Пример #6
0
void main (void)
	{
	InitApp();
	StartOS(OSDEFAULTAPPMODE);
	}
Пример #7
0
SINT main(void)
{
#ifdef NO_RUN_ENTER_STOP_EXIT
	 
	init_OS_flag(); /* this should be called before device init */
	nxt_device_init();
	ecrobot_initDeviceStatus(); // added 10/28/2010 to fix a bug by tchikama
	ecrobot_init_nxtstate();

	if  (execution_mode() == EXECUTED_FROM_FLASH)
	{
		/*
		 * Call buttons_get() because ecrobot_get_button_state() has button bouncer.
		 * The button bouncer requires multiple periodical calls to make it work, but
		 * in this case, only single call (no while loop), so buttons_get is called. 
		 */
		if ((buttons_get() & 0x0F) == (ENTER_PRESSED | STOP_PRESSED))
		{
			/* set flash request and shut down the NXT
	 	 	 * at the next start, NXT BIOS will be executed.
	 	 	 */
			display_clear(0);
   			display_goto_xy(0, 0);
   			display_string("PWR ON: NXT BIOS");
			display_update();
			systick_wait_ms(1000);
   		
			set_flash_request();
			display_clear(1);
			systick_wait_ms(10);
			nxt_lcd_power_down(); /* reset LCD hardware */
			systick_wait_ms(10);
			while(1)
			{
				nxt_avr_power_down();
			}
		}
	}

	/* device init should be called prior to running the application */
	ecrobot_device_initialize();
	ecrobot_setDeviceInitialized();
	
	nxt_motor_set_count(NXT_PORT_A, 0);
	nxt_motor_set_count(NXT_PORT_B, 0);
	nxt_motor_set_count(NXT_PORT_C, 0);
	cpp_constructor();
	display_clear(1);
	systick_wait_ms(10);

#ifdef NXT_JSP
	interrupts_get_and_disable();
#else
	disable_int(); /* set_OS_flag and Start OS have to be atomic */
#endif
	set_OS_flag(); /* this shoud be called before starting OS */
#ifdef NXT_JSP
	lejos_osek_run(); /* start TOPPERS JSP */
#else
	StartOS(1);    /* start TOPPERS OSEK */
#endif

	/* never reached here */


#else
	/* 
	 * Default start up sequence
	 */
	U32 st;
	U32 last_act_time = 0;
	U32 flash_req_cnt = 0;

	init_OS_flag(); /* this should be called before device init */
	nxt_device_init();
	ecrobot_initDeviceStatus(); // added 10/28/2010 to fix a bug by tchikama
	ecrobot_init_nxtstate();

	show_splash_screen();
	show_main_screen();
	display_status_bar(1); /* clear status bar */
	add_status_info(execution_mode());
	display_status_bar(0); /* update status bar */
	while(1)
	{
		/* device init should be called prior to running the application */
		ecrobot_device_initialize();
		ecrobot_setDeviceInitialized();
		/* check the buttons every 10msec */
		st = systick_get_ms();
		if (st >= last_act_time + 10) 
		{
			last_act_time = st;
			ecrobot_poll_nxtstate();
			display_status_bar(0);

			/* 
			 * executed in FLASH: setup for the application flash
			 * executed in SRAM:  no effect
			 */
			if ((ecrobot_get_button_state() == (ENTER_PRESSED | STOP_PRESSED)) &&
			    (execution_mode() == EXECUTED_FROM_FLASH))
			{
				flash_req_cnt++;
				/* keep pusing ENTER + STOP buttons more than 1000msec */
				if (flash_req_cnt >= 100)
				{
					/* set flash request and shut down the NXT
				 	 * at the next start, NXT BIOS will be executed.
				 	 */
					ecrobot_device_terminate();
					set_flash_request();
					display_clear(1);
					systick_wait_ms(10);
					nxt_lcd_power_down(); /* reset LCD hardware */
					systick_wait_ms(10);
					while(1)
					{
						nxt_avr_power_down();
					}
				}
			}
			else
			{
				flash_req_cnt = 0;
				if ((ecrobot_get_button_state() == EXIT_PRESSED) || (systick_get_ms() > SLEEP_TIME))
				{
					/* shut down the NXT */
					ecrobot_device_terminate();
					display_clear(1);
					systick_wait_ms(10);
					nxt_lcd_power_down(); /* reset LCD hardware */
					systick_wait_ms(10);
					while(1)
					{
						nxt_avr_power_down();
					}
				}
				else if (ecrobot_get_button_state() == RUN_PRESSED)
				{
					nxt_motor_set_count(NXT_PORT_A, 0);
					nxt_motor_set_count(NXT_PORT_B, 0);
					nxt_motor_set_count(NXT_PORT_C, 0);
					cpp_constructor();
					display_clear(1);
					systick_wait_ms(10);
#ifdef NXT_JSP
					interrupts_get_and_disable();
#else
					disable_int(); /* set_OS_flag and Start OS have to be atomic */
#endif
					set_OS_flag(); /* this shoud be called before starting OS */
#ifdef NXT_JSP
					lejos_osek_run(); /* start TOPPERS JSP */
#else
					StartOS(1);    /* start TOPPERS OSEK */
#endif
					/* never reached here */
				}
			}
		}
    }
#endif    

    return 0;
}
FUNC(int, AUTOMATIC) main()
{
    StartOS(OSDEFAULTAPPMODE);
    return 0;
}
int main (void)
{
    InitApp();
    StartOS(OSDEFAULTAPPMODE);
    return 0;
}
Пример #10
0
/**
 * Initialize EcuM.
 */
void EcuM_Init(void) {
	Std_ReturnType status;
	set_current_state(ECUM_STATE_STARTUP_ONE);

	// Initialize drivers that are needed to determine PostBuild configuration
	EcuM_AL_DriverInitZero();

	// Initialize the OS
	InitOS();

	// Setup interrupts
	Os_IsrInit();

	// Determine PostBuild configuration
	EcuM_World.config = EcuM_DeterminePbConfiguration();

	// TODO: Check consistency of PB configuration

	// Initialize drivers needed before the OS-starts
	EcuM_AL_DriverInitOne(EcuM_World.config);

	// Determine the reset/wakeup reason
	switch (Mcu_GetResetReason()) {
	case MCU_POWER_ON_RESET:
		EcuM_SetWakeupEvent(ECUM_WKSOURCE_POWER);
		break;
	case MCU_SW_RESET:
		EcuM_SetWakeupEvent(ECUM_WKSOURCE_RESET);
		break;
	case MCU_RESET_UNDEFINED:
		break;
	case MCU_WATCHDOG_RESET:
		EcuM_SetWakeupEvent(ECUM_WKSOURCE_INTERNAL_WDG);
		break;
	default:
		assert(0);
		break;
	}

	// Moved this here because EcuM_SelectShutdownTarget needs us to be initilized.
	EcuM_World.initiated = TRUE;

	// Set default shutdown target

	status = EcuM_SelectShutdownTarget(
					EcuM_World.config->EcuMDefaultShutdownTarget,
					EcuM_World.config->EcuMDefaultSleepMode);/** @req EcuM2181 */
	if (status != E_OK) {
		//TODO: Report error.
	}

	// Set default application mode
	status = EcuM_SelectApplicationMode(
					EcuM_World.config->EcuMDefaultAppMode);
	if (status != E_OK) {
		//TODO: Report error.
	}

#if defined(USE_COMM)
	EcuM_World.run_comm_requests = 0;
#endif
	EcuM_World.run_requests = 0;
	EcuM_World.postrun_requests = 0;

	// Start this baby up
	AppModeType appMode;
	status = EcuM_GetApplicationMode(&appMode);
	if (status != E_OK) {
		//TODO: Report error.
	}

	StartOS(appMode); /** @req EcuM2141 */
}
Пример #11
0
Файл: os.c Проект: ismaellc/SOTR
///******** OS_Launch ***************
// start the scheduler, enable interrupts
// Inputs: number of 20ns clock cycles for each time slice
//         (maximum of 24 bits)
// Outputs: none (does not return)
void OS_Launch(uint32_t theTimeSlice){
  NVIC_ST_RELOAD_R = theTimeSlice - 1; // reload value
  NVIC_ST_CTRL_R = 0x00000007; // enable, core clock and interrupt arm
  StartOS();                   // start on the first task
}
Пример #12
0
int main(void)
{
  /*test_hal_init();*/
  StartOS(OSDEFAULTAPPMODE);
  return 0;
}
Пример #13
0
/***************************************************************************************************
 *                                                                                                 *
 * PRE-TEST SETUP OF EXPECTED RESULTS                                                              *
 *                                                                                                 *
 ***************************************************************************************************/
int do_test() {
	int i;

	init_testevents();
	first_run_TaskJ = 1;
	
	DEFINE_TESTEVENT("Before StartOS");
#ifdef USESTARTUPHOOK
	DEFINE_TESTEVENT("StartupHook");
#endif
	/* TaskA and TaskB are autostarted. TaskB is higher priority than TaskB so should run first */
#ifdef USEPRETASKHOOK
	DEFINE_TESTEVENT("PreTaskHook");
	DEFINE_TESTEVENT("TaskB");
#endif
	DEFINE_TESTEVENT("Start B");
	
	DEFINE_TESTEVENT("Unlock resource to switch to C");
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (1)");
	
	DEFINE_TESTEVENT("Still in B (1)");
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (2)");

	DEFINE_TESTEVENT("Still in B (2)");
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (3)");
	
	DEFINE_TESTEVENT("Still in B (3)");
	DEFINE_TESTEVENT("Start X");
	DEFINE_TESTEVENT("End X");
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (4)");
	
	DEFINE_TESTEVENT("Still in B (4)");
	if(cat1_interrupts_cat2()) {
		DEFINE_TESTEVENT("Running cat1");
	}
	DEFINE_TESTEVENT("Still in B (4a)");
	if(!cat1_interrupts_cat2()) {
		DEFINE_TESTEVENT("Running cat1");
	}
	DEFINE_TESTEVENT("Start X");
	DEFINE_TESTEVENT("End X");
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (5)");
	
	DEFINE_TESTEVENT("Still in B (5)");
	DEFINE_TESTEVENT("Resuming OS interrupts");
	DEFINE_TESTEVENT("Resuming all interrupts");
	if(cat1_interrupts_cat2() || cat1_precedes_cat2()) {
		DEFINE_TESTEVENT("Running cat1");
		DEFINE_TESTEVENT("Start X");
		DEFINE_TESTEVENT("End X");
		define_task_switch(TaskB, TaskC);
	}
	else {
		DEFINE_TESTEVENT("Start X");
		DEFINE_TESTEVENT("End X");
		define_task_switch(TaskB, TaskC);
		DEFINE_TESTEVENT("Running cat1");
	}
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);
	DEFINE_TESTEVENT("Back in B (6)");
	
	DEFINE_TESTEVENT("Still in B (6)");
	DEFINE_TESTEVENT("Resuming OS interrupts");
	DEFINE_TESTEVENT("Enabling all interrupts");
	if(cat1_interrupts_cat2() || cat1_precedes_cat2()) {
		DEFINE_TESTEVENT("Running cat1");
		DEFINE_TESTEVENT("Start X");
		DEFINE_TESTEVENT("End X");
		define_task_switch(TaskB, TaskC);
	}
	else {
		DEFINE_TESTEVENT("Start X");
		DEFINE_TESTEVENT("End X");
		define_task_switch(TaskB, TaskC);
		DEFINE_TESTEVENT("Running cat1");
	}
	define_task_switch(TaskB, TaskC);
	DEFINE_TESTEVENT("Start C");
	DEFINE_TESTEVENT("End C");
	define_task_switch(TaskC, TaskB);	
	DEFINE_TESTEVENT("Back in B (7)");
	
	DEFINE_TESTEVENT("End B");
	
	define_task_switch(TaskB, TaskJ);
	DEFINE_TESTEVENT("Start J");
	DEFINE_TESTEVENT("Chain J");
	define_task_switch(TaskJ, TaskI);
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
	define_task_switch(TaskI, TaskJ);
	define_task_switch(TaskJ, TaskJ);
	DEFINE_TESTEVENT("Start J");
	DEFINE_TESTEVENT("End J");
	define_task_switch(TaskJ, TaskA);

	DEFINE_TESTEVENT("Start A");
	DEFINE_TESTEVENT("Activating D");
	
	define_task_switch(TaskA, TaskD);
	DEFINE_TESTEVENT("Start D");
	DEFINE_TESTEVENT("Activate E");
	DEFINE_TESTEVENT("D continues");
	define_task_switch(TaskD, TaskE);
	DEFINE_TESTEVENT("Start E");
	DEFINE_TESTEVENT("End E");
	define_task_switch(TaskE, TaskD);
	DEFINE_TESTEVENT("Back in D");
	DEFINE_TESTEVENT("End D");
	define_task_switch(TaskD, TaskE);
	DEFINE_TESTEVENT("Start E");
	DEFINE_TESTEVENT("End E");
	define_task_switch(TaskE, TaskA);
	DEFINE_TESTEVENT("Activating F");
	define_task_switch(TaskA, TaskF);
	DEFINE_TESTEVENT("Start F");
	DEFINE_TESTEVENT("F continues");
	define_task_switch(TaskF, TaskE);
	DEFINE_TESTEVENT("Start E");
	DEFINE_TESTEVENT("End E");
	define_task_switch(TaskE, TaskF);
	DEFINE_TESTEVENT("End F");
	define_task_switch(TaskF, TaskA);
	DEFINE_TESTEVENT("Back in A (1)");

#ifndef OPTIMIZED_QUEUEING
	DEFINE_TESTEVENT("Activating G and H");
#endif
	DEFINE_TESTEVENT("Activating I");

	DEFINE_TESTEVENT("Letting go of scheduler");
	define_task_switch(TaskA, TaskI);
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
	define_task_switch(TaskI, TaskI);
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
	define_task_switch(TaskI, TaskI);
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
	define_task_switch(TaskI, TaskI);
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
	define_task_switch(TaskI, TaskI);		/* 5th run of TaskI */
	DEFINE_TESTEVENT("Start I");
	DEFINE_TESTEVENT("End I");
#ifndef OPTIMIZED_QUEUEING
	define_task_switch(TaskI, TaskG);		/* 1st run of TaskG */
	DEFINE_TESTEVENT("Start G");
	DEFINE_TESTEVENT("End G");
	define_task_switch(TaskG, TaskH);
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskG);		/* 2nd run of TaskG */
	DEFINE_TESTEVENT("Start G");
	DEFINE_TESTEVENT("End G");
	define_task_switch(TaskG, TaskH);		
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskH);
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskH);
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskH);
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskH);
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskH);		/* 7th run of TaskH */
	DEFINE_TESTEVENT("Start H");
	DEFINE_TESTEVENT("End H");
	define_task_switch(TaskH, TaskG);		/* 3rd run of TaskG */
	DEFINE_TESTEVENT("Start G");
	DEFINE_TESTEVENT("End G");
	define_task_switch(TaskG, TaskA);
#else /* non-optimized queueing */
	define_task_switch(TaskI, TaskA);
#endif
	
	DEFINE_TESTEVENT("Back in A (2)");

#ifndef OPTIMIZED_QUEUEING
	DEFINE_TESTEVENT("Bulk activations");
	for(i = 0; i < 7; i++) {
		DEFINE_TESTEVENT("Phase start");
		DEFINE_TESTEVENT("Activating G and H");
		DEFINE_TESTEVENT("Activating I");
		DEFINE_TESTEVENT("Activating C");
		
		define_task_switch(TaskA, TaskI);
		DEFINE_TESTEVENT("Start I");
		DEFINE_TESTEVENT("End I");
		define_task_switch(TaskI, TaskI);
		DEFINE_TESTEVENT("Start I");
		DEFINE_TESTEVENT("End I");
		define_task_switch(TaskI, TaskG);
		DEFINE_TESTEVENT("Start G");
		DEFINE_TESTEVENT("End G");
		define_task_switch(TaskG, TaskH);
		DEFINE_TESTEVENT("Start H");
		DEFINE_TESTEVENT("End H");
		define_task_switch(TaskH, TaskG);
		DEFINE_TESTEVENT("Start G");
		DEFINE_TESTEVENT("End G");
		define_task_switch(TaskG, TaskC);
		DEFINE_TESTEVENT("Start C");
		DEFINE_TESTEVENT("End C");		
		define_task_switch(TaskC, TaskA);
		
		DEFINE_TESTEVENT("Phase end");
	}
#endif
	
	DEFINE_TESTEVENT("End A");

	DEFINE_TESTEVENT("Calling ShutdownOS");
#ifdef USESHUTDOWNHOOK
	DEFINE_TESTEVENT("ShutdownHook");
#endif
	DEFINE_TESTEVENT("After StartOS");

#undef DEFINE_TESTEVENT
	
	/************************************************************************************************
	 *************************BEGIN TEST AND CHECK AGAINST EXPECTED RESULTS**************************
	 ************************************************************************************************
	 */
	SET_TESTEVENT("Before StartOS");
	StartOS(OSDEFAULTAPPMODE);
	/* Call returns after ShutDownOS() called.
	 * 
	 * $Req: artf1219 $
	 * $Req: artf1217 $
	 */
	SET_TESTEVENT("After StartOS");
	
	test_finished();
	return 0;
}
Пример #14
0
void main(void) {
	DisableInterrupts;
	StartOS(OSDEFAULTAPPMODE);
    for(;;);
 
}