Exemplo n.º 1
0
void StartupHook(void)
{
	(void)SetRelAlarm(ID_vAlarmReceiver,50,10);
	(void)SetRelAlarm(ID_vAlarmSender,100,200);
	(void)SetRelAlarm(ID_vAlarmMainFunction,200,1); //so cyclic 1 Ticks = 4ms
	
	DcmEx1Init();
}
Exemplo n.º 2
0
/*test case:test the reaction of the system called with 
an activation of a task*/
static void test_t1_instance(void)
{
	
	StatusType result_inst_2, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_10, result_inst_11, result_inst_12, result_inst_14;
	TickType result_inst_3, result_inst_13;
	AlarmBaseType result_inst_1;
	
	SCHEDULING_CHECK_INIT(1);
	result_inst_2 = GetAlarmBase(Alarm1, &result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(1,OSMAXALLOWEDVALUE_Counter1, (int)(result_inst_1.maxallowedvalue));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(1,OSTICKSPERBASE_Counter1, (int)(result_inst_1.ticksperbase));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(1,OSMINCYCLE_Counter1, (int)(result_inst_1.mincycle));
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OK, result_inst_2);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_4 = GetAlarm(Alarm1, &result_inst_3);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OS_NOFUNC, result_inst_4);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_5 = CancelAlarm(Alarm1);
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OS_NOFUNC, result_inst_5);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_6 = SetAbsAlarm(Alarm1, 2, 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OK, result_inst_6);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_7 = SetAbsAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(5,E_OS_STATE, result_inst_7);
	
	WaitActivationPeriodicAlarm(Alarm1);
	
	WaitActivationPeriodicAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_10 = CancelAlarm(Alarm1);
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OK, result_inst_10);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_11 = SetRelAlarm(Alarm1, 2, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OK, result_inst_11);
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_12 = SetRelAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OS_STATE, result_inst_12);
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_14 = GetAlarm(Alarm1, &result_inst_13);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(11,2, result_inst_13);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,E_OK, result_inst_14);
	
	WaitActivationOneShotAlarm(Alarm1);
	
	SCHEDULING_CHECK_STEP(13);
	
}
Exemplo n.º 3
0
/*
 * MAIN TASK
 */
int main(void)
{
	//GPIO_InitTypeDef GPIO_InitStructure;

	SystemInit();
	/*Initializes Erika related stuffs*/
	EE_system_init();

	SWatch_state.errorStatus = errorSig;
	SWatch_state.ModelData.prevZCSigState = &ZCSig;
	SWatch_state.ModelData.dwork = &DWork;

	/* init state machine */
	SWatch_initialize(&SWatch_state,
			&Bplus, &Bminus, &Btime, &Btimer, &Balarm, &Bswatch, &Bstart, &Bstop,
			&hours, &minutes, &seconds, &tenths, &mode, &alarm_signal, &timer_exp);

	/*Initialize systick */
	EE_systick_set_period(MILLISECONDS_TO_TICKS(1, SystemCoreClock));
	EE_systick_enable_int();
	EE_systick_start();

	/* Initializes LCD and touchscreen */
	IOE_Config();
	/* Initialize the LCD */
	STM32f4_Discovery_LCD_Init();

	//	LCD_Clear(White);

	/* Set the LCD Text size */
	//	LCD_SetFont(&Font8x12);
	//	Lcd_Touch_Calibration();
	InitTouch(-0.102, 0.0656, -335, 10);

	/* Draw the background */
	DrawInit(MyWatchScr);
	LCD_SetTextColor(Black);
	LCD_SetBackColor(Black);
	LCD_DrawFullRect(10, 80, 240, 56);
	WPrint(&MyWatchScr[SEP1STR], ":");
	WPrint(&MyWatchScr[SEP2STR], ":");


	/* Program cyclic alarms which will fire after an initial offset,
	 * and after that periodically
	 * */
	SetRelAlarm(AlarmTaskLCD, 10, 50);
	SetRelAlarm(AlarmTaskClock, 10, 100);

	/* Forever loop: background activities (if any) should go here */
	for (;;) { 
	}

}
Exemplo n.º 4
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_isr1_instance(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9;
	TickType TickType_inst_1, TickType_inst_2;
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = GetCounterValue(Software_Counter, &TickType_inst_1);	
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(2,E_OK, result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,0, TickType_inst_1);

	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = SetRelAlarm(Alarm_ActivateTask, 2, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_2);	
		
	SCHEDULING_CHECK_INIT(4);
	result_inst_3 = IncrementCounter(Software_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OK, result_inst_3);

	SCHEDULING_CHECK_INIT(5);
	result_inst_4 = IncrementCounter(Software_Counter);	
	/* alarm expiration */
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OK, result_inst_4);
	/* force scheduling */
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_5 = SetRelAlarm(Alarm_SetEvent_suspendedtask, 2, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OK, result_inst_5);	
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_6 = IncrementCounter(Software_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OK, result_inst_6);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_7 = IncrementCounter(Software_Counter);
	/*alarm expires*/
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OK, result_inst_7);
	
	/*force rescheduling*/
	
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_8 = GetCounterValue(Software_Counter_By_Alarm, &TickType_inst_2);	
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(11,E_OK, result_inst_8);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,0, TickType_inst_2);
	
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_9 = SetRelAlarm(Alarm_ActivateTask, 0, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(13,E_OS_VALUE, result_inst_9);	
	
	
}
Exemplo n.º 5
0
/*test case:test the reaction of the system called with 
an activation of a task*/
static void test_t1_instance(void)
{
	
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_9, result_inst_10;
	TickType result_inst_8;

	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = SetAbsAlarm(Alarm1, 2, 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK, result_inst_1);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = SetAbsAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OS_STATE, result_inst_2);
	
	WaitActivationPeriodicAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_3 = Schedule();
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OK, result_inst_3);	

	WaitActivationPeriodicAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_4 = Schedule();
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OK, result_inst_4);	
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_5 = CancelAlarm(Alarm1);
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OK, result_inst_5);
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_6 = SetRelAlarm(Alarm1, 2, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,E_OK, result_inst_6);
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_7 = SetRelAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(12,E_OS_STATE, result_inst_7);
	
	SCHEDULING_CHECK_INIT(13);
	result_inst_9 = GetAlarm(Alarm1, &result_inst_8);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(13,2, result_inst_8);
	SCHEDULING_CHECK_AND_EQUAL_INT(13,E_OK, result_inst_9);
	
	WaitActivationOneShotAlarm(Alarm1);

	SCHEDULING_CHECK_INIT(14);
	result_inst_10 = Schedule();
	SCHEDULING_CHECK_AND_EQUAL_INT(15,E_OK, result_inst_10);
	
}
Exemplo n.º 6
0
//initialise the counter and alarm table
EXPORT void knl_cntalm_init(void)
{
    INT i;
    CCB* ccb;
    ALMCB* almcb;
    for(i=0;i<cfgOSEK_COUNTER_NUM;i++)
    {
        ccb = &knl_ccb_table[i];
        QueInit(&ccb->almque); 
        #if(cfgAR_SCHEDTBL_NUM > 0)
        QueInit(&ccb->tblque);
        #endif
        ccb->curvalue = 0;
    }
    
#if(cfgOSEK_ALARM_NUM >0)
    for(i=0;i<cfgOSEK_ALARM_NUM;i++)
    {
        almcb = &knl_almcb_table[i];
        QueInit(&almcb->almque);
        //almcb->almid = i;
        if((knl_galm_table[i].mode & knl_app_mode) != 0) 
        {
            (void)SetRelAlarm(i,knl_galm_table[i].time,knl_galm_table[i].cycle); 
        }
    }
#endif

#if(cfgAR_SCHEDTBL_NUM > 0)
    knl_init_schedule_table();
#endif
}
/* |------------------+-----------------------------------------------------------------| */
#if 0 /* defined as Macro */
StatusType SetAbsAlarm ( AlarmType xAlarmID , TickType xStart ,TickType xCycle )
{
	/* Yeah,I want to implement it,but the OSEK counter was not implemented.
	 * Temporarily I choose put it away.
	 * But later I will realize the OSEK Counter. */
	return SetRelAlarm(xAlarmID,xStart,xCycle);
}
Exemplo n.º 8
0
void StartupHook(void)
{
    /* Add Code Here */
    (void)SetRelAlarm(ID_vAlarmReceiver,50,10);
	(void)SetRelAlarm(ID_vAlarmSender,100,200);
	(void)SetRelAlarm(ID_vAlarmMainFunction,200,1); //so cyclic 1 Ticks = 4ms
	Can_Init(&Can_ConfigData); 
    CanIf_Init(&CanIf_Config);
    CanNm_Init(&CanNm_Config);
    CanSM_Init(&CanSM_Cfg);
    Nm_Init(&Nm_Config);
    ComM_Init(&ComM_Cfg);
    CanIf_SetControllerMode(vCanIf_Channel_0,CANIF_CS_STARTED);
    CanIf_SetControllerMode(vCanIf_Channel_1,CANIF_CS_STARTED);
    Nm_PassiveStartUp(vNm_Channel_0);
    ComM_RequestComMode(vComM_User_0,COMM_FULL_COMMUNICATION);
    CanNm_NetworkRequest(vCanNm_Channel_0);
}
Exemplo n.º 9
0
int main(int argc, char* argv[]) {

   WaitEvent(&Event1);
   WaitEvent(&Event2);
   WaitEvent(&Event3);

   ActivateTask(&Task1);
   ActivateTask(&Task2);
   ActivateTask(&Task3);

   SetRelAlarm(&Alarm1);
   SetRelAlarm(&Alarm2);

#ifdef WRONG
   WaitEvent(&Alarm1);
   ActivateTask(&Event3);
   SetRelAlarm(&Task3);
#endif // WRONG
   return 0;
}
Exemplo n.º 10
0
/* main function, only to initialize software and hardware,
 * fire alarms, and implement background activities */
int main(void)
{
	Sys_init();//Initialize clock, devices and periphericals

	SetRelAlarm(AlarmReferenceChange,1000,1000);

	/* Forever loop: background activities (if any) should go here */
	for (;;);

	return 0;
}
Exemplo n.º 11
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_t1_instance(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_7;
	TickType result_inst_6;

	SCHEDULING_CHECK_INIT(1);
	result_inst_1 = SetAbsAlarm(Alarm1, 2, 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OK, result_inst_1);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_2 = SetAbsAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OS_STATE, result_inst_2);
	
	WaitActivationPeriodicAlarm(Alarm1);
	
	SCHEDULING_CHECK_STEP(4);

	WaitActivationPeriodicAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_3 = CancelAlarm(Alarm1);
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OK, result_inst_3);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_4 = SetRelAlarm(Alarm1, 2, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OK, result_inst_4);
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_5 = SetRelAlarm(Alarm1, 3, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OS_STATE, result_inst_5);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_7 = GetAlarm(Alarm1, &result_inst_6);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(9,2, result_inst_6);
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OK, result_inst_7);
	
	WaitActivationOneShotAlarm(Alarm1);
	
	SCHEDULING_CHECK_STEP(11);
	
}
Exemplo n.º 12
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_isr1_instance(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9;
	TickType TickType_inst_1, TickType_inst_2, TickType_inst_3, TickType_inst_4, TickType_inst_5;
	
	/*s1*/
	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = GetCounterValue(Software_Counter, &TickType_inst_1);	
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(2,E_OK, result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,0, TickType_inst_1);

	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = SetRelAlarm(Alarm1, 2, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_2);	
		
	SCHEDULING_CHECK_INIT(4);
	result_inst_3 = IncrementCounter(Software_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OK, result_inst_3);

	SCHEDULING_CHECK_INIT(5);
	result_inst_4 = IncrementCounter(Software_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(5,E_OK, result_inst_4);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_5 = GetCounterValue(Software_Counter, &TickType_inst_2);	
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(6,E_OK, result_inst_5);
	SCHEDULING_CHECK_AND_EQUAL_INT(6,1, TickType_inst_2);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_6 = IncrementCounter(Software_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OK, result_inst_6);
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_7 = IncrementCounter(Software_Counter);
	/*alarm expires*/
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OK, result_inst_7);
	
	/*force rescheduling*/
			
	SCHEDULING_CHECK_INIT(11);
	result_inst_8 = GetCounterValue(Software_Counter, &TickType_inst_3);	
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(11,E_OK, result_inst_8);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,2, TickType_inst_3);
		
	SCHEDULING_CHECK_INIT(12);
	TickType_inst_4 = 0;
	result_inst_9 = GetElapsedCounterValue(Software_Counter, &TickType_inst_4, &TickType_inst_5);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(12,E_OK , result_inst_9);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(12,2 , TickType_inst_4);
	SCHEDULING_CHECK_AND_EQUAL_INT(12,2 , TickType_inst_5);
		
}
Exemplo n.º 13
0
static void test_t1_instance(void)
{
  StatusType r1, r2;

  /* Activate t2 in cycle 10 */
  SCHEDULING_CHECK_INIT(1);
  r1 = SetAbsAlarm(activate_task_accross_cores, 10, 0);
  SCHEDULING_CHECK_AND_EQUAL_INT(1, E_OK, r1);

  /* Set t2_event after 20 cycles */
  SCHEDULING_CHECK_INIT(2);
  r2 = SetRelAlarm(set_event_accross_cores, 20, 0);
  SCHEDULING_CHECK_AND_EQUAL_INT(2, E_OK, r2);

  /* Wait for the core 1 to end its tests */
  SyncAllCores(sync);
}
extern void controller_init(void)
{
   /* open CIAA digital outputs */
   fd_out = ciaaPOSIX_open("/dev/dio/out/0", ciaaPOSIX_O_RDWR);

   /* open CIAA ADC */
   fd_adc = ciaaPOSIX_open("/dev/serial/aio/in/0", ciaaPOSIX_O_RDONLY);

   /* open UART connected to USB bridge (FT2232) */
   fd_uart1 = ciaaPOSIX_open("/dev/serial/uart/1", ciaaPOSIX_O_RDWR);

   uart_init(ciaaBAUDRATE_115200, ciaaFIFO_TRIGGER_LEVEL3);

   sensorLM35_init(fd_adc, ciaaCHANNEL_3);

   SetRelAlarm(ActivatePeriodicTask, 350, SAMPLES_TIME);
}
Exemplo n.º 15
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_t1_instance1(void)
{
	ApplicationType result_app_1;
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7;
	ScheduleTableStatusType ScheduleTableStatusType_inst_1;
	TickType TickType_inst_1;
	
	SCHEDULING_CHECK_INIT(1);
	result_app_1 = GetApplicationID(); 
	SCHEDULING_CHECK_AND_EQUAL_INT(1, app1, result_app_1);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = SetRelAlarm(Alarm1, 1, 0); 
	SCHEDULING_CHECK_AND_EQUAL_INT(2, E_OK, result_inst_1);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = GetAlarm(Alarm1, &TickType_inst_1); 
	SCHEDULING_CHECK_AND_EQUAL_INT(3, E_OK, result_inst_2);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_3 = StartScheduleTableAbs(sched1, 0); 
	SCHEDULING_CHECK_AND_EQUAL_INT(4, E_OK, result_inst_3);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_4 = GetScheduleTableStatus(sched1, &ScheduleTableStatusType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(5 , SCHEDULETABLE_RUNNING , ScheduleTableStatusType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(5, E_OK, result_inst_4);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_5 = GetResource(Resource1); 
	SCHEDULING_CHECK_AND_EQUAL_INT(6, E_OK, result_inst_5);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_6 = TerminateApplication(INVALID_RESTART);
	SCHEDULING_CHECK_AND_EQUAL_INT(8, E_OS_VALUE, result_inst_6);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_7 = TerminateApplication(RESTART); 
	SCHEDULING_CHECK_AND_EQUAL_INT(90, E_OK, result_inst_7);
	
			
}
Exemplo n.º 16
0
/*test case:test the reaction of the system called with 
an activation of a task*/
static void test_t1_instance(void)
{
	
	StatusType result_inst_1, result_inst_3, result_inst_4;
	TaskStateType result_inst_2;
	
	SCHEDULING_CHECK_INIT(1);
	result_inst_1 = SetRelAlarm(Alarm1, 0, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OK, result_inst_1);
	
	WaitActivationOneShotAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_3 = GetTaskState(t2, &result_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(2,READY, result_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK, result_inst_3);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_4 = TerminateTask();
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_4);
}
Exemplo n.º 17
0
EXPORT void knl_alarm_counter_init(void)
{
	uint8 i;
	for(i=0;i<cfgOS_COUNTER_NUM;i++)
	{
		knl_ccb_head[i] = INVALID_ALARM;
		knl_ccb_value[i] = 0;
	}
	for(i=0;i<cfgOS_ALARM_NUM;i++)
	{
		knl_acb_next[i] = INVALID_ALARM;
		knl_acb_prev[i] = INVALID_ALARM;
		knl_acb_value[i] = ALARM_STOPPED;
	}
	for(i=0;i<cfgOS_ALARM_NUM;i++)
	{
		if((knl_acb_mode[i]&knl_appmode) != 0u)
		{
			(void)SetRelAlarm(i,knl_acb_time[i],knl_acb_cycle[i]);
		}
	}
}
Exemplo n.º 18
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_t1_instance(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5;
	TickType TickType_inst_1, TickType_inst_2, TickType_inst_3, tick_temp;
	TickType alarm_increment = 2;
	EventMaskType EventMaskType_inst_1;

	SCHEDULING_CHECK_INIT(1);
	result_inst_1 = GetCounterValue(Hardware_Counter, &TickType_inst_1);	
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OK, result_inst_1);
	
	WaitCounterDeltaValue(Hardware_Counter, 3);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_2 = GetCounterValue(Hardware_Counter, &TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(2, (TickType_inst_1 + 3)%(OSMAXALLOWEDVALUE_Hardware_Counter + 1) , TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK , result_inst_2);
	 
	SCHEDULING_CHECK_INIT(3);
	result_inst_3 = SetRelAlarm(Alarm1, alarm_increment, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_3);	
	
	WaitActivationOneShotAlarm(Alarm1);
	
	SCHEDULING_CHECK_INIT(4);
	tick_temp = TickType_inst_2;
	result_inst_4 = GetElapsedCounterValue(Hardware_Counter, &TickType_inst_2, &TickType_inst_3);	   
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(4,E_OK , result_inst_4);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(4, (tick_temp + alarm_increment)%(OSMAXALLOWEDVALUE_Hardware_Counter + 1) , TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(4,alarm_increment , TickType_inst_3);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_5 = GetEvent(t1, &EventMaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(5,Event1 , EventMaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(5, E_OK , result_inst_5);
		
}
Exemplo n.º 19
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_isr1_instance(void)
{
	StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9, result_inst_10, result_inst_11;
	TickType TickType_inst_1, TickType_inst_2, TickType_inst_3, TickType_inst_4, TickType_inst_6, TickType_inst_8, TickType_inst_9, TickType_inst_10, tick_temp;
	TickType TickType_inst_5 = OSMAXALLOWEDVALUE_Software_Counter + 1;
	TickType TickType_inst_7 = OSMAXALLOWEDVALUE_Hardware_Counter + 1;
	TickType alarm_increment = 2;
	EventMaskType EventMaskType_inst_1;

	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = GetCounterValue(Hardware_Counter, &TickType_inst_1);	
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK, result_inst_1);
	
	WaitCounterDeltaValue(Hardware_Counter, 3);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = GetCounterValue(Hardware_Counter, &TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(3, (TickType_inst_1 + 3)%(OSMAXALLOWEDVALUE_Hardware_Counter + 1) , TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK , result_inst_2);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_3 = SetRelAlarm(Alarm1, alarm_increment, 0);	
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OK, result_inst_3);	
	
	WaitActivationOneShotAlarm(Alarm1);
		
	SCHEDULING_CHECK_INIT(5);
	tick_temp = TickType_inst_2;
	result_inst_4 = GetElapsedCounterValue(Hardware_Counter, &TickType_inst_2, &TickType_inst_3);	   
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(5,E_OK , result_inst_4);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(5,(tick_temp + alarm_increment)%(OSMAXALLOWEDVALUE_Hardware_Counter + 1) , TickType_inst_2);
	SCHEDULING_CHECK_AND_EQUAL_INT(5,alarm_increment , TickType_inst_3);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_5 = GetEvent(t1, &EventMaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(6,Event1 , EventMaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OK , result_inst_5);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_6 = IncrementCounter(Hardware_Counter);	
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OS_ID, result_inst_6);
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_7 = IncrementCounter(INVALID_COUNTER);	
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OS_ID, result_inst_7);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_8 = GetCounterValue(INVALID_COUNTER, &TickType_inst_4);	
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OS_ID, result_inst_8);
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_9 = GetElapsedCounterValue(Software_Counter, &TickType_inst_5, &TickType_inst_6);	
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OS_VALUE, result_inst_9);
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_10 = GetElapsedCounterValue(Hardware_Counter, &TickType_inst_7, &TickType_inst_8);	
	SCHEDULING_CHECK_AND_EQUAL_INT(11,E_OS_VALUE, result_inst_10);
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_11 = GetElapsedCounterValue(INVALID_COUNTER, &TickType_inst_9, &TickType_inst_10);	
	SCHEDULING_CHECK_AND_EQUAL_INT(12,E_OS_ID, result_inst_11);
		
}
Exemplo n.º 20
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_t1_instance(void)
{
	
	StatusType result_inst_2, result_inst_4, result_inst_6, result_inst_7, result_inst_8, result_inst_9, result_inst_10, result_inst_11, result_inst_12, result_inst_13, result_inst_14, result_inst_15, result_inst_16, result_inst_17;
	AlarmBaseType result_inst_1, result_inst_5;
	TickType result_inst_3;
	
	SCHEDULING_CHECK_INIT(1);
	result_inst_2 = GetAlarmBase(INVALID_ALARM, &result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(1,E_OS_ID, result_inst_2);
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_4 = GetAlarm(INVALID_ALARM, &result_inst_3);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OS_ID, result_inst_4);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_6 = GetAlarmBase(Alarm1, &result_inst_5);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(3,OSMAXALLOWEDVALUE, (int)(result_inst_5.maxallowedvalue));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(3,OSTICKSPERBASE, (int)(result_inst_5.ticksperbase));
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(3,OSMINCYCLE, (int)(result_inst_5.mincycle));	
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_6);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_7 = SetRelAlarm(INVALID_ALARM, 0, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OS_ID, result_inst_7);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_8 = SetRelAlarm(Alarm1, -1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(5,E_OS_VALUE, result_inst_8);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_9 = SetRelAlarm(Alarm1, result_inst_5.maxallowedvalue + 1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OS_VALUE, result_inst_9);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_10 = SetRelAlarm(Alarm1, 0, result_inst_5.mincycle - 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OS_VALUE, result_inst_10);
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_11 = SetRelAlarm(Alarm1, 0,  result_inst_5.maxallowedvalue + 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OS_VALUE, result_inst_11);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_12 = SetAbsAlarm(INVALID_ALARM, 0, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OS_ID, result_inst_12);
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_13 = SetAbsAlarm(Alarm1, -1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OS_VALUE, result_inst_13);
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_14 = SetAbsAlarm(Alarm1, result_inst_5.maxallowedvalue + 1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,E_OS_VALUE, result_inst_14);
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_15 = SetAbsAlarm(Alarm1, 0, result_inst_5.mincycle - 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(12,E_OS_VALUE, result_inst_15);
	
	SCHEDULING_CHECK_INIT(13);
	result_inst_16 = SetAbsAlarm(Alarm1, 0,  result_inst_5.maxallowedvalue + 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(13,E_OS_VALUE, result_inst_16);
	
	SCHEDULING_CHECK_INIT(14);
	result_inst_17 = CancelAlarm(INVALID_ALARM);
	SCHEDULING_CHECK_AND_EQUAL_INT(14,E_OS_ID, result_inst_17);
	
}
Exemplo n.º 21
0
/*test case:test the reaction of the system called with 
an activation of a task*/
static void test_t1_instance(void)
{
	AlarmBaseType AlarmBaseType_inst_1;
	EventMaskType EventMaskType_inst_1;
	StatusType result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9, result_inst_10, result_inst_11, result_inst_12, result_inst_13, result_inst_14, result_inst_15, result_inst_16, result_inst_17, result_inst_18, result_inst_19;
	TaskStateType TaskStateType_inst_1;
	TaskType TaskType_inst_1;
	TickType TickType_inst_1;
		
	SCHEDULING_CHECK_STEP(1);
	
	SCHEDULING_CHECK_STEP(2);
	SuspendAllInterrupts();
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_2 = ActivateTask(t2);
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OS_DISABLEDINT, result_inst_2);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_3 = TerminateTask();
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OS_DISABLEDINT, result_inst_3);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_4 = ChainTask(t2);
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OS_DISABLEDINT, result_inst_4);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_5 = Schedule();
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OS_DISABLEDINT, result_inst_5);
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_6 = GetTaskID(&TaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(12,E_OS_DISABLEDINT, result_inst_6);
	
	SCHEDULING_CHECK_INIT(13);
	result_inst_7 = GetTaskState(t2, &TaskStateType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(14,E_OS_DISABLEDINT, result_inst_7);
	
	SCHEDULING_CHECK_INIT(15);
	result_inst_8 = GetResource(Resource1);
	SCHEDULING_CHECK_AND_EQUAL_INT(16,E_OS_DISABLEDINT, result_inst_8);
	
	SCHEDULING_CHECK_INIT(17);
	result_inst_9 = ReleaseResource(Resource1);
	SCHEDULING_CHECK_AND_EQUAL_INT(18,E_OS_DISABLEDINT, result_inst_9);
	
	SCHEDULING_CHECK_INIT(19);
	result_inst_10 = SetEvent(t2, Event1);
	SCHEDULING_CHECK_AND_EQUAL_INT(20,E_OS_DISABLEDINT, result_inst_10);
	
	SCHEDULING_CHECK_INIT(21);
	result_inst_11 = ClearEvent(Event1);
	SCHEDULING_CHECK_AND_EQUAL_INT(22,E_OS_DISABLEDINT, result_inst_11);
	
	SCHEDULING_CHECK_INIT(23);
	result_inst_12 = GetEvent(t2, &EventMaskType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(24,E_OS_DISABLEDINT, result_inst_12);
	
	SCHEDULING_CHECK_INIT(25);
	result_inst_13 = WaitEvent(Event1);
	SCHEDULING_CHECK_AND_EQUAL_INT(26,E_OS_DISABLEDINT, result_inst_13);
	
	SCHEDULING_CHECK_INIT(27);
	result_inst_14 = GetAlarmBase(Alarm1, &AlarmBaseType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(28,E_OS_DISABLEDINT, result_inst_14);
	
	SCHEDULING_CHECK_INIT(29);
	result_inst_15 = GetAlarm(Alarm1, &TickType_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(30,E_OS_DISABLEDINT, result_inst_15);
	
	SCHEDULING_CHECK_INIT(31);
	result_inst_16 = SetRelAlarm(Alarm1, 1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(32,E_OS_DISABLEDINT, result_inst_16);
	
	SCHEDULING_CHECK_INIT(33);
	result_inst_17 = SetAbsAlarm(Alarm1, 1, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(34,E_OS_DISABLEDINT, result_inst_17);
	
	SCHEDULING_CHECK_INIT(35);
	result_inst_18 = CancelAlarm(Alarm1);
	SCHEDULING_CHECK_AND_EQUAL_INT(36,E_OS_DISABLEDINT, result_inst_18);
	
	SCHEDULING_CHECK_INIT(37);
	result_inst_19 = GetActiveApplicationMode();
	SCHEDULING_CHECK_AND_EQUAL_INT(38,OSDEFAULTAPPMODE, result_inst_19);
	
	SCHEDULING_CHECK_STEP(39);
	ResumeAllInterrupts();
}
Exemplo n.º 22
0
/** 走行中の処理 */
SINT Driver::state_driving(void){

    //DEBUG_PRINT1("s", "state_driving()");

    RobotInfo r_info;
    NavInfo  n_info;

    RobotCmd cmd;

    bool ret;

	navigator_.Init();

	//Position prePos;
	//Position now_position;
 //   F32 r = 41.34;    // タイヤの半径 []
 //   F32 d = 82.6;      // 左右のタイヤ間距離 [mm]
 //   S32 angR = nxt_motor_get_count(1);
 //   S32 angL = nxt_motor_get_count(2);
 //   S32 angR_bak;
 //   S32 angL_bak;


	navigator_.Init();
    r_info = robot_.GetInfo();
    //angR = r_info.rot_encoderR_val;
    //angL = r_info.rot_encoderL_val;
	n_info = navigator_.GetInfo(r_info);
    // 最初のミッションを設定&初期化
    cur_mission_iter_ = this->mission_list_.Begin();
    if ( cur_mission_iter_ != this->mission_list_.End() ){
        (*cur_mission_iter_)->Init(r_info, n_info);
    } else {
        this->status_ = STATE_ERROR;
    }

    this->ClearEventFlag();

    SetRelAlarm(Alarm4msec, 1, DRIVE_PERIOD); // ドライブ用Alarmタイマーのセット

    // 走行開始
    // ステータスが運転中ならループを繰り返す
    while(this->status_ == STATE_DRIVING){
        //DEBUG_PRINT1("s", (*cur_mission_iter_)->Name());
        ClearEvent(EventDrive); // ドライブイベントのクリア
		WaitEvent(EventDrive);  // ドライブイベント待ち

        // タッチセンサON,もしくは転倒情報より走行停止
        if ( event_flag_.is_SetEvent(Robot::EVENT_TOUCH_SENSOR_ON) || event_flag_.is_SetEvent(Robot::EVENT_FAIL) ){
            status_ = STATE_WAIT_START;
            break;
        }

        // デバッグ用
        if ( event_flag_.is_SetEvent(Robot::EVENT_GYRO) ){
//            robot_.Beep();
        }
        if ( event_flag_.is_SetEvent(Robot::EVENT_GYRO2) ){
//            robot_.Beep();
        }

        if ( event_flag_.is_SetEvent(Robot::EVENT_SONAR_SENSOR_ON) ){
//            robot_.Beep();
        }

        r_info = robot_.GetInfo();
        n_info = navigator_.GetInfo(r_info);


        //prePos = now_position;
        //angR_bak = angR;
        //angL_bak = angL;
        //angR = r_info.rot_encoderR_val;

        //angL = r_info.rot_encoderL_val;
        //now_position = getPositionEstimation(prePos, angR - angR_bak, angL - angL_bak, r, d);

        while(1){
            ret = (*cur_mission_iter_)->Run(r_info, n_info, this->event_flag_, cmd);
            if ( ret == true ){
                robot_.Drive(cmd);
                break;
            } else if ( ret == false ){
                // 次のミッションに遷移
                ++cur_mission_iter_;
                if ( cur_mission_iter_ == mission_list_.End() ){
                    // ミッションリストがなくなったので終了
                    // ただし、最後のミッションは倒立したまま停止を続けるはずなので、
                    // 基本的にこの処理には入らない
                    this->status_ = STATE_COMPLETE;
                    break;
                } else {
                    (*cur_mission_iter_)->Init(r_info, n_info);
                    continue;
                }
            } else {
                // ここに入ることはないはず
                this->status_ = STATE_WAIT_START;
                break;
            }
        }

#if 1
        // Bluetooth データ送信
        if ( this->is_bt_connect_ ){
            robot_.BTSend(cmd, r_info, n_info);
            //robot_.BTSend(cmd, now_position);
        }
#endif

        this->ClearEventFlag();
    }

    robot_.Stop();
    this->ClearEventFlag();
    CancelAlarm(Alarm4msec);            // ドライブ用Alarmタイマーのキャンセル
    ClearEvent(EventDrive); // ドライブイベントのクリア
    return 0;
}
Exemplo n.º 23
0
/*==================[external functions definition]==========================*/
void StartOS
(
   AppModeType Mode
)
{
   /* \req OSEK_SYS_3.25 The system service void
    ** StartOS ( AppModeType Mode ) shall be defined */

   /* \req OSEK_SYS_3.25.1 This system service shall starts the operating
    ** system */
   uint8f loopi;

   IntSecure_Start();

   /* save the aplication mode */
   ApplicationMode = Mode;

   /* StartOs_Arch */
   StartOs_Arch();


   /* init every task */
   for( loopi = 0; loopi < TASKS_COUNT; loopi++)
   {
      /* \req OSEK_SYS_3.1.2-2/3 The operating system shall ensure that the task
       ** code is being executed from the first statement. */
      SetEntryPoint(loopi); /* set task entry point */
   }

   /* set sys context */
   SetActualContext(CONTEXT_SYS);

   /* set actual task to invalid task */
   SetRunningTask(INVALID_TASK);

   /* add to ready the corresponding tasks for this
    * Application Mode */
   for (loopi = 0; loopi < AutoStart[Mode].TotalTasks; loopi++)
   {
      /* activate task */
      ActivateTask(AutoStart[Mode].TasksRef[loopi]);
   }

   for (loopi = 0; loopi < ALARM_AUTOSTART_COUNT; loopi++)
   {
      if (AutoStartAlarm[loopi].Mode == Mode)
      {
         (void)SetRelAlarm(AutoStartAlarm[loopi].Alarm, AutoStartAlarm[loopi].AlarmTime, AutoStartAlarm[loopi].AlarmCycleTime);
      }
   }

#if (HOOK_STARTUPHOOK == OSEK_ENABLE)
   StartupHook();
#endif

   IntSecure_End();

   /* enable all OS interrupts */
   EnableOSInterrupts();

   /* enable interrupts */
   EnableInterrupts();

   /* call Scheduler */
   (void)Schedule();

   /* this function shall never return */
   while(1);
}
Exemplo n.º 24
0
void tempo(int ms)
{
    CancelAlarm(0);
    SetRelAlarm (0, ms, T_ORDO) ;
}
Exemplo n.º 25
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_isr1_instance(void)
{
	StatusType result_inst_1, result_inst_1_5, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6, result_inst_7, result_inst_8, result_inst_9, result_inst_10, result_inst_11, result_inst_12, result_inst_13, result_inst_14, result_inst_15;
	StatusType result_inst_16, result_inst_17, result_inst_18, result_inst_19, result_inst_20, result_inst_21, result_inst_22, result_inst_23, result_inst_24, result_inst_25, result_inst_26, result_inst_27, result_inst_28, result_inst_29, result_inst_30, result_inst_31, result_inst_32, result_inst_33, result_inst_34, result_inst_35;
	AlarmBaseType alarmbase;
	TickType tik;
	
	SCHEDULING_CHECK_INIT(2);
	result_inst_1 = ActivateTask(t4);
	SCHEDULING_CHECK_AND_EQUAL_INT(2,E_OK, result_inst_1);
	
	SCHEDULING_CHECK_INIT(3);
	result_inst_1_5 = ActivateTask(t3);
	SCHEDULING_CHECK_AND_EQUAL_INT(3,E_OK, result_inst_1_5);
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_2 = GetAlarmBase(INVALID_ALARM, &alarmbase);
	SCHEDULING_CHECK_AND_EQUAL_INT(4,E_OS_ID, result_inst_2);
	
	SCHEDULING_CHECK_INIT(5);
	result_inst_3 = GetAlarmBase(Alarm0, &alarmbase);
	SCHEDULING_CHECK_AND_EQUAL_INT(5,E_OK, result_inst_3);
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_4 = GetAlarm(INVALID_ALARM, &tik);
	SCHEDULING_CHECK_AND_EQUAL_INT(6,E_OS_ID, result_inst_4);
	
	SCHEDULING_CHECK_INIT(7);
	result_inst_5 = GetAlarm(Alarm0, &tik);
	SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OS_NOFUNC, result_inst_5);
	
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_6 = SetRelAlarm(INVALID_ALARM, 0, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OS_ID, result_inst_6);
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_7 = SetRelAlarm(Alarm0, -1 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OS_VALUE, result_inst_7);
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_8 = SetRelAlarm(Alarm0, alarmbase.maxallowedvalue + 1 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(10,E_OS_VALUE, result_inst_8);	
	
	SCHEDULING_CHECK_INIT(11);
	result_inst_9 = SetRelAlarm(Alarm0, 0 , alarmbase.mincycle - 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(11,E_OS_VALUE, result_inst_9);
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_10 = SetRelAlarm(Alarm0, 0 , alarmbase.maxallowedvalue + 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(12,E_OS_VALUE, result_inst_10);	
	
	
	SCHEDULING_CHECK_INIT(13);
	result_inst_11 = SetAbsAlarm(INVALID_ALARM, 0, 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(13,E_OS_ID, result_inst_11);
	
	SCHEDULING_CHECK_INIT(14);
	result_inst_12 = SetAbsAlarm(Alarm0, -1 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(14,E_OS_VALUE, result_inst_12);
	
	SCHEDULING_CHECK_INIT(15);
	result_inst_13 = SetAbsAlarm(Alarm0, alarmbase.maxallowedvalue + 1 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(15,E_OS_VALUE, result_inst_13);	
	
	SCHEDULING_CHECK_INIT(16);
	result_inst_14 = SetAbsAlarm(Alarm0, 0 , alarmbase.mincycle - 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(16,E_OS_VALUE, result_inst_14);
	
	SCHEDULING_CHECK_INIT(17);
	result_inst_15 = SetAbsAlarm(Alarm0, 0 , alarmbase.maxallowedvalue + 1);
	SCHEDULING_CHECK_AND_EQUAL_INT(17,E_OS_VALUE, result_inst_15);	
	
	
	SCHEDULING_CHECK_INIT(18);
	result_inst_16 = CancelAlarm(INVALID_ALARM);
	SCHEDULING_CHECK_AND_EQUAL_INT(18,E_OS_ID, result_inst_16);	
	
	SCHEDULING_CHECK_INIT(19);
	result_inst_17 = CancelAlarm(Alarm0);
	SCHEDULING_CHECK_AND_EQUAL_INT(19,E_OS_NOFUNC, result_inst_17);	
	
	
	SCHEDULING_CHECK_INIT(20);
	result_inst_18 = SetRelAlarm(Alarm1_1, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(20,E_OK, result_inst_18);	
	
	SCHEDULING_CHECK_INIT(21);
	result_inst_19 = SetRelAlarm(Alarm1_1, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(21,E_OS_STATE, result_inst_19);	
	
	SCHEDULING_CHECK_INIT(22);
	result_inst_20 = GetAlarm(Alarm1_1, &tik);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(22,E_OK, result_inst_20);
	SCHEDULING_CHECK_AND_EQUAL_INT(22,2, tik);
	
	WaitActivationPeriodicAlarm(Alarm1_1);
	
	SCHEDULING_CHECK_INIT(23);
	result_inst_21 = CancelAlarm(Alarm1_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(23,E_OK, result_inst_21);	
	
	
	SCHEDULING_CHECK_INIT(24);
	result_inst_22 = SetAbsAlarm(Alarm1_2, 2 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(24,E_OK, result_inst_22);	
	
	SCHEDULING_CHECK_INIT(25);
	result_inst_23 = SetAbsAlarm(Alarm1_2, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(25,E_OS_STATE, result_inst_23);	
	
	WaitActivationOneShotAlarm(Alarm1_2);
	
	
	SCHEDULING_CHECK_INIT(26);
	result_inst_24 = SetRelAlarm(Alarm2_1, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(26,E_OK, result_inst_24);	
	
	SCHEDULING_CHECK_INIT(27);
	result_inst_25 = SetRelAlarm(Alarm2_1, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(27,E_OS_STATE, result_inst_25);	
	
	SCHEDULING_CHECK_INIT(28);
	result_inst_26 = GetAlarm(Alarm2_1, &tik);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(28,E_OK, result_inst_26);
	SCHEDULING_CHECK_AND_EQUAL_INT(28,2, tik);
	
	WaitActivationPeriodicAlarm(Alarm2_1);
	
	SCHEDULING_CHECK_INIT(29);
	result_inst_27 = CancelAlarm(Alarm2_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(29,E_OK, result_inst_27);	
	
	
	SCHEDULING_CHECK_INIT(30);
	result_inst_28 = SetAbsAlarm(Alarm2_2, 2 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(30,E_OK, result_inst_28);	
	
	SCHEDULING_CHECK_INIT(31);
	result_inst_29 = SetAbsAlarm(Alarm2_2, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(31,E_OS_STATE, result_inst_29);	
	
	WaitActivationOneShotAlarm(Alarm2_2);
	
	
	SCHEDULING_CHECK_INIT(32);
	result_inst_30 = SetRelAlarm(Alarm3, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(32,E_OK, result_inst_30);	
	
	SCHEDULING_CHECK_INIT(33);
	result_inst_31 = SetRelAlarm(Alarm3, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(33,E_OS_STATE, result_inst_31);	
	
	SCHEDULING_CHECK_INIT(34);
	result_inst_32 = GetAlarm(Alarm3, &tik);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(34,E_OK, result_inst_32);
	SCHEDULING_CHECK_AND_EQUAL_INT(34,2, tik);
	
	WaitActivationPeriodicAlarm(Alarm3);
	
	SCHEDULING_CHECK_INIT(36);
	result_inst_33 = CancelAlarm(Alarm3);
	SCHEDULING_CHECK_AND_EQUAL_INT(36,E_OK, result_inst_33);	
	
	
	SCHEDULING_CHECK_INIT(37);
	result_inst_34 = SetAbsAlarm(Alarm3, 2 , 0);
	SCHEDULING_CHECK_AND_EQUAL_INT(37,E_OK, result_inst_34);	
	
	SCHEDULING_CHECK_INIT(38);
	result_inst_35 = SetAbsAlarm(Alarm3, 2 , 2);
	SCHEDULING_CHECK_AND_EQUAL_INT(38,E_OS_STATE, result_inst_35);	
	
	WaitActivationOneShotAlarm(Alarm3);
	
	SCHEDULING_CHECK_STEP(40);
	
}