2010-09-22 15:10:42 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <hwtimer.h>
|
|
|
|
#include <swtimer.h>
|
2010-10-28 11:22:57 +02:00
|
|
|
#include <sched.h>
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
hwtimer_init();
|
|
|
|
swtimer_init();
|
|
|
|
|
|
|
|
puts("Hello world!\n");
|
|
|
|
|
|
|
|
swtimer_t t;
|
|
|
|
|
|
|
|
puts("Setting timer...\n");
|
2010-10-28 11:22:57 +02:00
|
|
|
swtimer_set_wakeup(&t, 10000000L, active_thread->pid);
|
2010-09-22 15:10:42 +02:00
|
|
|
puts("Small delay...\n");
|
|
|
|
hwtimer_wait(200000);
|
|
|
|
puts("Removing timer...\n");
|
|
|
|
swtimer_remove(&t);
|
|
|
|
puts("Done.\n");
|
|
|
|
|
|
|
|
swtimer_t t2;
|
|
|
|
puts("Setting timer...\n");
|
2010-10-28 11:22:57 +02:00
|
|
|
swtimer_set_wakeup(&t, 10000000L, active_thread->pid);
|
2010-09-22 15:10:42 +02:00
|
|
|
puts("Setting timer 2...\n");
|
2010-10-28 11:22:57 +02:00
|
|
|
swtimer_set_wakeup(&t2, 50000000L, active_thread->pid);
|
2010-09-22 15:10:42 +02:00
|
|
|
puts("Small delay...\n");
|
|
|
|
hwtimer_wait(200000);
|
|
|
|
puts("Removing timer 1...\n");
|
|
|
|
swtimer_remove(&t);
|
|
|
|
puts("Removing timer 2...\n");
|
|
|
|
swtimer_remove(&t2);
|
|
|
|
puts("Done.\n");
|
|
|
|
|
|
|
|
puts("Setting timer...\n");
|
2010-10-28 11:22:57 +02:00
|
|
|
swtimer_set_wakeup(&t, 10000000L, active_thread->pid);
|
2010-09-22 15:10:42 +02:00
|
|
|
puts("Setting timer 2...\n");
|
2010-10-28 11:22:57 +02:00
|
|
|
swtimer_set_wakeup(&t2, 50000000L, active_thread->pid);
|
2010-09-22 15:10:42 +02:00
|
|
|
puts("Small delay...\n");
|
|
|
|
hwtimer_wait(200000);
|
|
|
|
puts("Removing timer 2...\n");
|
|
|
|
swtimer_remove(&t2);
|
|
|
|
puts("Removing timer 1...\n");
|
|
|
|
swtimer_remove(&t);
|
|
|
|
puts("Done.\n");
|
|
|
|
|
|
|
|
|
|
|
|
while(1);
|
|
|
|
}
|