#include #include #include #include #include #include #include #include #include #include #include #include #include #include "periodic_tasks.h" #include "cyclic_test.h" int main(int argc, char *argv[]) { int res, dummy, pmin; struct periodic_task *t; struct sched_param sp; pmin = sched_get_priority_min(SCHED_FIFO); res = fork(); if (res ==0) { /* Shortest period -> highest priority */ sp.sched_priority = pmin + 3; sched_setscheduler(0, SCHED_FIFO, &sp); t = start_periodic_timer(2000000, 50000); while (1) { wait_next_activation(t); task1(); } } res = fork(); if (res == 0) { sp.sched_priority = pmin + 2; sched_setscheduler(0, SCHED_FIFO, &sp); t = start_periodic_timer(2000000, 100000); while (1) { wait_next_activation(t); task2(); } } res = fork(); if (res == 0) { /* Longest period -> lowest priority */ sp.sched_priority = pmin + 1; sched_setscheduler(0, SCHED_FIFO, &sp); t = start_periodic_timer(2000000, 150000); while (1) { wait_next_activation(t); task3(); } } wait(&dummy); wait(&dummy); wait(&dummy); return 0; }