/* Model initialize function */
void beagleboard_communication_initialize(void)
{
  /* Registration code */

  /* initialize real-time model */
  (void) memset((void *)beagleboard_communication_M, 0,
                sizeof(RT_MODEL_beagleboard_communicat));

  /* block I/O */
  (void) memset(((void *) &beagleboard_communication_B), 0,
                sizeof(BlockIO_beagleboard_communicati));

  /* states (dwork) */
  (void) memset((void *)&beagleboard_communication_DWork, 0,
                sizeof(D_Work_beagleboard_communicatio));

  {
    char_T *sErr;

    /* Start for S-Function (sdspToNetwork): '<Root>/UDP Send' */
    sErr = GetErrorBuffer(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]);
    CreateUDPInterface(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]);
    if (*sErr == 0) {
      LibCreate_Network(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U],
                        1, "255.255.255.255", -1, "192.168.1.35", 25000, 8192, 8,
                        0);
    }

    if (*sErr == 0) {
      LibStart(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]);
    }

    if (*sErr != 0) {
      DestroyUDPInterface(&beagleboard_communication_DWork.UDPSend_NetworkLib[0U]);
      if (*sErr != 0) {
        rtmSetErrorStatus(beagleboard_communication_M, sErr);
        rtmSetStopRequested(beagleboard_communication_M, 1);
      }
    }

    /* End of Start for S-Function (sdspToNetwork): '<Root>/UDP Send' */
  }
}
Example #2
0
/* Model initialize function */
void udpRead_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize real-time model */
  (void) memset((void *)udpRead_M, 0,
                sizeof(RT_MODEL_udpRead_T));
  rtmSetTFinal(udpRead_M, -1);
  udpRead_M->Timing.stepSize0 = 0.001;

  /* External mode info */
  udpRead_M->Sizes.checksums[0] = (597430241U);
  udpRead_M->Sizes.checksums[1] = (1019470990U);
  udpRead_M->Sizes.checksums[2] = (4143940322U);
  udpRead_M->Sizes.checksums[3] = (93090447U);

  {
    static const sysRanDType rtAlwaysEnabled = SUBSYS_RAN_BC_ENABLE;
    static RTWExtModeInfo rt_ExtModeInfo;
    static const sysRanDType *systemRan[5];
    udpRead_M->extModeInfo = (&rt_ExtModeInfo);
    rteiSetSubSystemActiveVectorAddresses(&rt_ExtModeInfo, systemRan);
    systemRan[0] = &rtAlwaysEnabled;
    systemRan[1] = (sysRanDType *)&udpRead_DW.ForIteratorSubsystem_SubsysRanB;
    systemRan[2] = (sysRanDType *)&udpRead_DW.ForIteratorSubsystem1_SubsysRan;
    systemRan[3] = (sysRanDType *)&udpRead_DW.EnabledSubsystem_SubsysRanBC;
    systemRan[4] = &rtAlwaysEnabled;
    rteiSetModelMappingInfoPtr(udpRead_M->extModeInfo,
      &udpRead_M->SpecialInfo.mappingInfo);
    rteiSetChecksumsPtr(udpRead_M->extModeInfo, udpRead_M->Sizes.checksums);
    rteiSetTPtr(udpRead_M->extModeInfo, rtmGetTPtr(udpRead_M));
  }

  /* block I/O */
  (void) memset(((void *) &udpRead_B), 0,
                sizeof(B_udpRead_T));

  /* states (dwork) */
  (void) memset((void *)&udpRead_DW, 0,
                sizeof(DW_udpRead_T));

  /* data type transition information */
  {
    static DataTypeTransInfo dtInfo;
    (void) memset((char_T *) &dtInfo, 0,
                  sizeof(dtInfo));
    udpRead_M->SpecialInfo.mappingInfo = (&dtInfo);
    dtInfo.numDataTypes = 14;
    dtInfo.dataTypeSizes = &rtDataTypeSizes[0];
    dtInfo.dataTypeNames = &rtDataTypeNames[0];

    /* Block I/O transition table */
    dtInfo.B = &rtBTransTable;

    /* Parameters transition table */
    dtInfo.P = &rtPTransTable;
  }

  {
    char_T *sErr;

    /* Start for S-Function (sdspFromNetwork): '<Root>/UDP Receive' */
    sErr = GetErrorBuffer(&udpRead_DW.UDPReceive_NetworkLib[0U]);
    CreateUDPInterface(&udpRead_DW.UDPReceive_NetworkLib[0U]);
    if (*sErr == 0) {
      LibCreate_Network(&udpRead_DW.UDPReceive_NetworkLib[0U], 0, "0.0.0.0",
                        25000, "0.0.0.0", -1, 8192, 4, 0);
    }

    if (*sErr == 0) {
      LibStart(&udpRead_DW.UDPReceive_NetworkLib[0U]);
    }

    if (*sErr != 0) {
      DestroyUDPInterface(&udpRead_DW.UDPReceive_NetworkLib[0U]);
      if (*sErr != 0) {
        rtmSetErrorStatus(udpRead_M, sErr);
        rtmSetStopRequested(udpRead_M, 1);
      }
    }

    /* End of Start for S-Function (sdspFromNetwork): '<Root>/UDP Receive' */

    /* InitializeConditions for UnitDelay: '<S3>/FixPt Unit Delay2' */
    udpRead_DW.FixPtUnitDelay2_DSTATE =
      udpRead_P.FixPtUnitDelay2_InitialConditio;

    /* InitializeConditions for UnitDelay: '<S3>/FixPt Unit Delay1' */
    udpRead_DW.FixPtUnitDelay1_DSTATE = udpRead_P.UnitDelayResettable_vinit;
  }
}