예제 #1
0
/**
 * Makes task wait for next period
 * @param i task index
 */
void wait_for_period(int i)
{
	clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &(tp[i].at), NULL);

	time_add_ms(&(tp[i].at), tp[i].period);
	time_add_ms(&(tp[i].dl), tp[i].period);
}
예제 #2
0
void wait_for_period(task_par_t *tp)
{
	clock_nanosleep(CLOCK_MONOTONIC,
	TIMER_ABSTIME, &(tp->at), NULL);
	time_add_ms(&(tp->at), tp->period);
	time_add_ms(&(tp->dl), tp->period);
}
예제 #3
0
void set_period(task_par_t *tp)
{
	struct timespec t;
	clock_gettime(CLOCK_MONOTONIC, &t);
	time_copy(&(tp->at), t);
	time_copy(&(tp->dl), t);
	time_add_ms(&(tp->at), tp->period);
	time_add_ms(&(tp->dl), tp->deadline);
}
예제 #4
0
/**
 * Sets next activation time. Here absolute deadlines are considered
 * @param i task index to be activated
 */
void set_next_activation(int i)
{
	struct timespec t;

	clock_gettime(CLOCK_MONOTONIC, &t);
	time_copy(&(tp[i].at), t);
	time_copy(&(tp[i].dl), t);
	time_add_ms(&(tp[i].at), tp[i].period);
	time_add_ms(&(tp[i].dl), tp[i].deadline);
}
예제 #5
0
void set_period_ms(struct timespec *at, struct timespec *dl,
    long period, long deadline, const struct timespec *t0, long phase) {
  struct timespec t;

  if (t0 == NULL)
    clock_gettime(CLOCK_MONOTONIC, &t);
  else
    time_cpy(&t, t0);

  time_add_ms(&t, phase);

  time_cpy(at, &t);
  time_cpy(dl, &t);

  time_add_ms(dl, deadline - period);
}
예제 #6
0
void wait_for_period_ms(struct timespec *at, struct timespec *dl, long period) {
  clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, at, NULL);
  time_add_ms(at, period);
  time_add_ms(dl, period);
}