Exemplo n.º 1
0
void baseRateTask(void *arg)
{
  baseRateInfo_t info = *((baseRateInfo_t *)arg);
  MW_setTaskPeriod(info.period, info.signo);
  while ((rtmGetErrorStatus(Serial_M) == (NULL)) && !rtmGetStopRequested
         (Serial_M) ) {
    /* Wait for the next timer interrupt */
    MW_sigWait(&info.sigMask);

    /* External mode */
    {
      boolean_T rtmStopReq = false;
      rtExtModePauseIfNeeded(Serial_M->extModeInfo, 2, &rtmStopReq);
      if (rtmStopReq) {
        rtmSetStopRequested(Serial_M, true);
      }

      if (rtmGetStopRequested(Serial_M) == true) {
        rtmSetErrorStatus(Serial_M, "Simulation finished");
        break;
      }
    }

    /* External mode */
    {
      boolean_T rtmStopReq = false;
      rtExtModeOneStep(Serial_M->extModeInfo, 2, &rtmStopReq);
      if (rtmStopReq) {
        rtmSetStopRequested(Serial_M, true);
      }
    }

    Serial_output();

    /* Get model outputs here */

    /* External mode */
    rtExtModeUploadCheckTrigger(2);

    {                                  /* Sample time: [0.0s, 0.0s] */
      rtExtModeUpload(0, Serial_M->Timing.t[0]);
    }

    {                                  /* Sample time: [0.05s, 0.0s] */
      rtExtModeUpload(1, ((Serial_M->Timing.clockTick1) * 0.05));
    }

    Serial_update();
    rtExtModeCheckEndTrigger();
  }                                    /* while */

  sem_post(&stopSem);
}
Exemplo n.º 2
0
void baseRateTask(void *arg)
{
  baseRateInfo_t info = *((baseRateInfo_t *)arg);
  MW_setTaskPeriod(info.period, info.signo);
  while ((rtmGetErrorStatus(raspberrypi_audioequalizer_M) == (NULL)) &&
         !rtmGetStopRequested(raspberrypi_audioequalizer_M) ) {
    /* Wait for the next timer interrupt */
    MW_sigWait(&info.sigMask);

    /* External mode */
    {
      boolean_T rtmStopReq = FALSE;
      rtExtModePauseIfNeeded(raspberrypi_audioequalizer_M->extModeInfo, 1,
        &rtmStopReq);
      if (rtmStopReq) {
        rtmSetStopRequested(raspberrypi_audioequalizer_M, TRUE);
      }

      if (rtmGetStopRequested(raspberrypi_audioequalizer_M) == TRUE) {
        rtmSetErrorStatus(raspberrypi_audioequalizer_M, "Simulation finished");
        break;
      }
    }

    /* External mode */
    {
      boolean_T rtmStopReq = FALSE;
      rtExtModeOneStep(raspberrypi_audioequalizer_M->extModeInfo, 1, &rtmStopReq);
      if (rtmStopReq) {
        rtmSetStopRequested(raspberrypi_audioequalizer_M, TRUE);
      }
    }

    raspberrypi_audioequalizer_output();

    /* Get model outputs here */

    /* External mode */
    rtExtModeUploadCheckTrigger(1);

    {                                  /* Sample time: [0.1s, 0.0s] */
      rtExtModeUpload(0, raspberrypi_audioequalizer_M->Timing.taskTime0);
    }

    raspberrypi_audioequalizer_update();
    rtExtModeCheckEndTrigger();
  }                                    /* while */

  sem_post(&stopSem);
}
Exemplo n.º 3
0
void baseRateTask(void *arg)
{
  baseRateInfo_t info = *((baseRateInfo_t *)arg);
  MW_setTaskPeriod(info.period, info.signo);
  while (rtmGetErrorStatus(testA_M) == (NULL) ) {
    /* Wait for the next timer interrupt */
    MW_sigWait(&info.sigMask);
    testA_output();

    /* Get model outputs here */
    testA_update();
  }                                    /* while */

  sem_post(&stopSem);
}
Exemplo n.º 4
0
void baseRateTask(void *arg)
{
  baseRateInfo_t info = *((baseRateInfo_t *)arg);
  MW_setTaskPeriod(info.period, info.signo);
  while ((rtmGetErrorStatus(beagleboard_communication_M) == (NULL)) &&
         !rtmGetStopRequested(beagleboard_communication_M) ) {
    /* Wait for the next timer interrupt */
    MW_sigWait(&info.sigMask);
    beagleboard_communication_output();

    /* Get model outputs here */
    beagleboard_communication_update();
  }                                    /* while */

  sem_post(&stopSem);
}
Exemplo n.º 5
0
int MW_sigWaitWithOverrunDetection(sigset_t *sigMask)
{
  struct timespec timeout;
  int ret, overrun = 0;
  timeout.tv_sec = 0;
  timeout.tv_nsec = 0;
  ret = sigtimedwait(sigMask, NULL, &timeout);
  if (ret == -1) {
    if (errno == EAGAIN) {
      MW_sigWait(sigMask);
    } else {
      printf("Call to sigwaitinfo returned error.\n");
      perror("sigtimedwait");
      fflush(stdout);
      exit(EXIT_FAILURE);
    }
  } else {
    overrun = 1;
  }

  return overrun;
}