/* MessageLibBaseline2::Send_P041 */
void Send_P041_MessageLibBaseline2(
  /* MessageLibBaseline2::Send_P041::B_data_in */CompressedPackets_T_Common_Types_Pkg *B_data_in,
  /* MessageLibBaseline2::Send_P041::P041 */P041_trackside_int_T_TM *P041,
  outC_Send_P041_MessageLibBaseline2 *outC)
{
  static CompressedPackets_T_Common_Types_Pkg tmp;
  static kcg_bool tmp1;
  static kcg_bool noname;
  
  kcg_copy_P041_trackside_int_T_TM(&outC->_L4, P041);
  outC->_L5 = outC->_L4.valid;
  outC->tmp = outC->_L5;
  kcg_copy_CompressedPackets_T_Common_Types_Pkg(&outC->_L3, B_data_in);
  if (outC->tmp) {
    /* 1 */ Write_P041_TM_trackside(&outC->_L4, &outC->_L3, &outC->Context_1);
    tmp1 = outC->Context_1.Error;
    kcg_copy_CompressedPackets_T_Common_Types_Pkg(
      &tmp,
      &outC->Context_1.RadioPacketsOut);
    kcg_copy_CompressedPackets_T_Common_Types_Pkg(&outC->_L7, &tmp);
  }
  else {
    kcg_copy_CompressedPackets_T_Common_Types_Pkg(&outC->_L7, &outC->_L3);
  }
  outC->_L8 = kcg_false;
  if (outC->tmp) {
    outC->_L6 = tmp1;
  }
  else {
    outC->_L6 = outC->_L8;
  }
  noname = outC->_L6;
  kcg_copy_CompressedPackets_T_Common_Types_Pkg(&outC->B_data_out, &outC->_L7);
}
/* Internal_Tests::TestP041_specific */
void TestP041_specific_Internal_Tests(void)
{
  static P41_LevelTransistionOrders_T_Packet_Types_Pkg tmp;
  static kcg_bool noname;
  
  kcg_copy_P041_trackside_int_T_TM(
    &Ctxt_TestP041_specific_Internal_Tests._L5,
    (P041_trackside_int_T_TM *) &BG356_P041_Packets426);
  kcg_copy_CompressedPackets_T_Common_Types_Pkg(
    &Ctxt_TestP041_specific_Internal_Tests._L4,
    (CompressedPackets_T_Common_Types_Pkg *)
      &DEFAULT_CompressedPackets_Internal_Tests);
  /* 1 */
  Write_P041_TM_trackside(
    &Ctxt_TestP041_specific_Internal_Tests._L5,
    &Ctxt_TestP041_specific_Internal_Tests._L4,
    &Ctxt_TestP041_specific_Internal_Tests.Context_1);
  Ctxt_TestP041_specific_Internal_Tests._L2 =
    Ctxt_TestP041_specific_Internal_Tests.Context_1.Error;
  kcg_copy_CompressedPackets_T_Common_Types_Pkg(
    &Ctxt_TestP041_specific_Internal_Tests._L3,
    &Ctxt_TestP041_specific_Internal_Tests.Context_1.RadioPacketsOut);
  /* 1 */
  Read_P041_TM(
    &Ctxt_TestP041_specific_Internal_Tests._L3,
    &Ctxt_TestP041_specific_Internal_Tests._1_Context_1);
  Ctxt_TestP041_specific_Internal_Tests._L1 =
    Ctxt_TestP041_specific_Internal_Tests._1_Context_1.received;
  kcg_copy_P041_OBU_T_TM(
    &Ctxt_TestP041_specific_Internal_Tests._L6,
    &Ctxt_TestP041_specific_Internal_Tests._1_Context_1.P041_OBU_out);
  Ctxt_TestP041_specific_Internal_Tests.tmp =
    Ctxt_TestP041_specific_Internal_Tests._L1;
  if (Ctxt_TestP041_specific_Internal_Tests.tmp) {
    /* 1 */
    C_P041_to_legacy_t_TM_conversions(
      &Ctxt_TestP041_specific_Internal_Tests._L6,
      &Ctxt_TestP041_specific_Internal_Tests._2_Context_1);
    kcg_copy_P41_LevelTransistionOrders_T_Packet_Types_Pkg(
      &tmp,
      &Ctxt_TestP041_specific_Internal_Tests._2_Context_1.P041_legacy_out);
    kcg_copy_P41_LevelTransistionOrders_T_Packet_Types_Pkg(
      &Ctxt_TestP041_specific_Internal_Tests._L7,
      &tmp);
  }
  else {
    kcg_copy_P41_LevelTransistionOrders_T_Packet_Types_Pkg(
      &Ctxt_TestP041_specific_Internal_Tests._L7,
      (P41_LevelTransistionOrders_T_Packet_Types_Pkg *)
        &DEFAULT_P041_legacy_TM_specific);
  }
  kcg_copy_P41_LevelTransistionOrders_T_Packet_Types_Pkg(
    &PacketOut,
    &Ctxt_TestP041_specific_Internal_Tests._L7);
  noname = Ctxt_TestP041_specific_Internal_Tests._L2;
}