void OsAlm_InitAlarms(void) #endif /* KOS_MEMORY_MAPPING */ { uint8 i; #if defined(OS_FEATURE_AUTOSTART_ALARMS) AlarmConfigurationType * alarm_def; #endif /* OS_FEATURE_AUTOSTART_ALARMS */ for (i = (uint8)0; i < OS_NUMBER_OF_ALARMS; ++i) { #if defined(OS_FEATURE_AUTOSTART_ALARMS) alarm_def = (AlarmConfigurationType *)&OS_AlarmConf[i]; if ((uint16)alarm_def->Autostart & GetActiveApplicationMode()) { OS_AlarmValue[i].ExpireCounter = alarm_def->AlarmTime; OS_AlarmValue[i].CycleCounter = alarm_def->CycleTime; OsAlm_StartAlarm(i); } else { #endif /* OS_FEATURE_AUTOSTART_ALARMS */ OS_AlarmValue[i].ExpireCounter = (TickType)0; OS_AlarmValue[i].CycleCounter = (TickType)0; OsAlm_StopAlarm(i); #if defined(OS_FEATURE_AUTOSTART_ALARMS) } #endif /* OS_FEATURE_AUTOSTART_ALARMS */ } }
/*test case:test the reaction of the system called with an activation of a isr*/ static void test_isr2_instance1(void) { StatusType result_inst_1; SCHEDULING_CHECK_INIT(5); result_inst_1 = GetActiveApplicationMode(); SCHEDULING_CHECK_AND_EQUAL_INT(5,E_OK , result_inst_1); }
/*test case:test the reaction of the system called with an activation of a task*/ static void test_startup_instance(void) { StatusType result_inst_1; SCHEDULING_CHECK_INIT(1); result_inst_1 = GetActiveApplicationMode(); SCHEDULING_CHECK_AND_EQUAL_INT(1,OSDEFAULTAPPMODE , result_inst_1); ShutdownOS(E_OK); }
/*test case:test the reaction of the system called with an activation of a task*/ static void test_error_instance(void) { StatusType result_inst_1, result_inst_2, result_inst_3, result_inst_4, result_inst_5, result_inst_6; TaskType task_id; TaskStateType task_state; EventMaskType event_mask; AlarmBaseType alarm_base; TickType tik; SCHEDULING_CHECK_INIT(4); result_inst_1 = GetActiveApplicationMode(); SCHEDULING_CHECK_AND_EQUAL_INT(4,OSDEFAULTAPPMODE , result_inst_1); SCHEDULING_CHECK_INIT(5); result_inst_2 = GetTaskID(&task_id); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(5,E_OK , result_inst_2); SCHEDULING_CHECK_AND_EQUAL_INT(5,t1 , task_id); SCHEDULING_CHECK_INIT(6); result_inst_3 = GetTaskState(task_id, &task_state); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(6,E_OK , result_inst_3); SCHEDULING_CHECK_AND_EQUAL_INT(6,RUNNING , task_state); SCHEDULING_CHECK_INIT(7); result_inst_4 = GetEvent(task_id,&event_mask); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(7,E_OK , result_inst_2); SCHEDULING_CHECK_AND_EQUAL_INT(7,E_OK , result_inst_2); SCHEDULING_CHECK_INIT(8); result_inst_5 = GetAlarmBase(Alarm1, &alarm_base); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,OSMAXALLOWEDVALUE_Counter1, (int)(alarm_base.maxallowedvalue)); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,OSTICKSPERBASE_Counter1, (int)(alarm_base.ticksperbase)); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,OSMINCYCLE_Counter1, (int)(alarm_base.mincycle)); SCHEDULING_CHECK_AND_EQUAL_INT(8,E_OK , result_inst_5); SCHEDULING_CHECK_INIT(9); result_inst_6 = GetAlarm(Alarm1,&tik); SCHEDULING_CHECK_AND_EQUAL_INT(9,E_OK , result_inst_6); }
void OsTask_InitTasks(void) #endif /* KOS_MEMORY_MAPPING */ { #if defined(OS_FEATURE_AUTOSTART_TASKS) uint8_least i; #endif /* OS_FEATURE_AUTOSTART_TASKS */ OsTask_Init((TaskType)0, FALSE); #if defined(OS_FEATURE_AUTOSTART_TASKS) for (i = (uint8_least)1; i < OS_NUMBER_OF_TASKS; ++i) { OsTask_Init(i, FALSE); if (OS_TaskConf[i].Autostart & GetActiveApplicationMode()) { OsTask_Ready(i); OS_TASK_INCR_ACTIVATIONS(i); } } #endif /* OS_FEATURE_AUTOSTART_TASKS */ }
void test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl( data_port_t * input_data_m1) { StatusType test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_the_proc_modes_the_receiver_m1_runtime_call_ret; test_osek_modes__Integer test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_localVariable; Base_Types__Integer_16 test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_Length = sizeof(test_osek_modes__Integer); StatusType test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_ErrorCode = 0; AppModeType test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_the_receiver_m1_currentMode; test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_behaviorIdentifier_enum whichPortActivated = test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_behaviorIdentifier_enum_default_behavior; while(1) { switch(the_proc_modes_the_receiver_m1_entrypoint_impl_current_state) { case test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_init_state: // Transition id: which_behavior_default_mode if(1) // no execution condition { the_proc_modes_the_receiver_m1_entrypoint_impl_current_state = test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_exec_state; whichPortActivated = test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_behaviorIdentifier_enum_default_behavior; break; } case test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_wait_dispatch_state: // Transition id: dispatch_transition if(1) // no execution condition { the_proc_modes_the_receiver_m1_entrypoint_impl_current_state = test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_exec_state; TerminateTask (); break; } case test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_exec_state: // Transition id: call -- Priority 0 if(whichPortActivated == test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_behaviorIdentifier_enum_default_behavior) { the_proc_modes_the_receiver_m1_entrypoint_impl_current_state = test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_BA_entrypoint_wait_dispatch_state; test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_the_receiver_m1_currentMode = GetActiveApplicationMode (); if (test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_the_receiver_m1_currentMode == m1) { test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_ErrorCode = GetValueDataPort_runtime (input_data_m1, &test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_localVariable); } if (test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_ErrorCode == 0) { receive (test_osek_modes_modes_refined_refined_model__the_proc_modes_the_receiver_m1_entrypoint_impl_input_data_localVariable); } break; } } } }
/*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(); }