/* Produce a rectangular wave on output 0 of a parallel port */ #define MODULE #include #include #include #include #include #include /* the address of the parallel port -- you probably should change this */ #define LPT 0x278 RT_TASK mytask; RT_TASK mytask2; void fun(int t) { int i; for (i=0; i < 100000; i++) { outb(t, LPT); /* write on the parallel port */ rt_task_wait(); } } int init_module(void) { RTIME now = rt_get_time(); /* this task will be setting the bit */ rt_task_init(&mytask, fun, 1, 3000, 4); /* this task will be resetting the bit */ rt_task_init(&mytask2, fun, 0, 3000, 5); /* the 2 tasks run periodically with an offset of 200 time units */ rt_task_make_periodic(&mytask, now + 3000, 500); rt_task_make_periodic(&mytask2, now + 3200, 500); return 0; } void cleanup_module(void) { rt_task_delete(&mytask); rt_task_delete(&mytask2); }