/* -----------------------------------------------------------------------------------*/ void ProcessMT_Master(void){ LOCK_LEVEL_TYPE lock; APEX_BYTE data[MAX_LENGTH]; long int len; RETURN_CODE_TYPE retCode; PROCESS_ID_TYPE procMainId1; char sal_code[MAX_CAD]; PARTITION_STATUS_TYPE statusp; BLACKBOARD_ID_TYPE bbId; printf("Process Master starts ...\n"); GET_PARTITION_STATUS(&statusp, &retCode); CHECK_CODE(": GET_PARTITION_STATUS", retCode, sal_code); printf("%s\n", sal_code); /* Make sure the preemption is enabled, lock == 0 */ if (statusp.LOCK_LEVEL>0){ UNLOCK_PREEMPTION(&lock, &retCode); while (lock!=0){ UNLOCK_PREEMPTION(&lock, &retCode); } }else if (statusp.LOCK_LEVEL<0){ LOCK_PREEMPTION(&lock, &retCode); while (lock!=0){ LOCK_PREEMPTION(&lock, &retCode); } } /* To get the procMainId1 value */ GET_PROCESS_ID("tProc1", &procMainId1, &retCode); CHECK_CODE(": GET_PROCESS_ID Process 1", retCode, sal_code); printf("%s\n", sal_code); START(procMainId1 ,&retCode); CHECK_CODE(": START Process 1 ", retCode, sal_code); printf("%s\n", sal_code); /* Process P1 pre-empts Master_Test */ /* Call service READ_BLACKBOARD B1 */ GET_BLACKBOARD_ID(BLACKBOARD_NAME_0, &bbId, &retCode); CHECK_CODE(": GET_BLACKBOARD_ID_0 by ProcessMT_Master", retCode, sal_code); printf("%s\n", sal_code); READ_BLACKBOARD (bbId, 0, data, &len, &retCode); CHECK_CODE(": READ_BLACKBOARD B1", retCode, sal_code); printf("%s Read data: %s\n", sal_code, data); /* Call service READ_BLACKBOARD B2 */ GET_BLACKBOARD_ID(BLACKBOARD_NAME_1, &bbId, &retCode); CHECK_CODE(": GET_BLACKBOARD_ID_1 by ProcessMT_Master", retCode, sal_code); printf("%s\n", sal_code); READ_BLACKBOARD (bbId, 0, data, &len, &retCode); CHECK_CODE(": READ_BLACKBOARD B2", retCode, sal_code); printf("%s Read data: %s\n", sal_code, data); STOP_SELF(); }
void PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl( BLACKBOARD_ID_TYPE * delayed_PongIn, SAMPLING_PORT_ID_TYPE * PortCnx6_PingOut, SAMPLING_PORT_ID_TYPE * PortCnx8_badSequenceNumber, SAMPLING_PORT_ID_TYPE * mode_aadlKeywords, SEQ * seqNb, PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_currentState * Parent_BA_currentState_Access, Base_Types__Integer_16 * PingOut_freshnessIndicator_access) { PingPongMessage PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_localVariable; MESSAGE_SIZE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_Length = sizeof(PingPongMessage); PingPong_refined_model__PingPongMessage_freshness_t_impl PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_localVariable; MESSAGE_SIZE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_Length = sizeof(PingPong_refined_model__PingPongMessage_freshness_t_impl); Exception PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_badSequenceNumber_localVariable; MESSAGE_SIZE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_badSequenceNumber_Length = sizeof(Exception); ROLE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_localVariable; MESSAGE_SIZE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_Length = sizeof(ROLE); RETURN_CODE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_ErrorCode = 0; RETURN_CODE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_ErrorCode = 0; VALIDITY_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_Validity; SYSTEM_TIME_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_TimeOut = 0; RETURN_CODE_TYPE PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret; PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_behaviorIdentifier_enum whichPortActivated = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_behaviorIdentifier_enum_default_behavior; while(1) { switch(S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_current_state) { case PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_init_state: // Transition id: which_behavior_default_mode if(1) // no execution condition { S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_current_state = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_exec_state; whichPortActivated = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_behaviorIdentifier_enum_default_behavior; break; } case PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_wait_dispatch_state: // Transition id: dispatch_transition if(1) // no execution condition { S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_current_state = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_exec_state; PERIODIC_WAIT (&PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret); break; } case PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_exec_state: // Transition id: behavior_specification_1 -- Priority 0 if(whichPortActivated == PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_behaviorIdentifier_enum_default_behavior) { S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_current_state = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_BA_entrypoint_wait_dispatch_state; if ((*Parent_BA_currentState_Access) == PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_currentState_switch) { READ_BLACKBOARD ((*delayed_PongIn), PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_TimeOut, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_localVariable, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_Length, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret); READ_SAMPLING_MESSAGE ((*mode_aadlKeywords), &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_localVariable, PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_Length, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_Validity, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret); if (PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_mode_aadlKeywords_localVariable == E_ROLE_CPING) { IPingOrPong_Cping_ping (&PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_delayed_PongIn_localVariable, &(PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_localVariable.pvalue), &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_badSequenceNumber_localVariable, seqNb, seqNb); } PingOut_freshnessIndicator_access = PingOut_freshnessIndicator_access + 1; PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_localVariable.fresh_ba = PingOut_freshnessIndicator_access; (*Parent_BA_currentState_Access) = PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_currentState_switch; WRITE_SAMPLING_MESSAGE ((*PortCnx6_PingOut), &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_localVariable, PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_PingOut_Length, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret); WRITE_SAMPLING_MESSAGE ((*PortCnx8_badSequenceNumber), &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_badSequenceNumber_localVariable, PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_badSequenceNumber_Length, &PingPong_refined_model__S2_inst_IPingOrPong_Cping_ping_entrypoint_impl_S2_inst_IPingOrPong_Cping_ping_runtime_call_ret); } break; } } } }