#define MODULE
// My address of the parallel port
RT_TASK mytask;
// Period of the square wave
void fun(int t) {
int init_module(void)
per = per * 1.19343;
// this task sets the bit
/ this task resets the bit
// the 2 tasks run periodically with an offset
void cleanup_module(void)
//
// rt_sqr.c
//
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/cons.h>
#include <asm/io.h>
#include <linux/rt_sched.h>
#define LPT 0x378
RT_TASK mytask2;
int per = 40000;
while (1) {
outb(t, LPT);
rt_task_wait();
}
}
{
RTIME now = rt_get_time();
rt_task_init(&mytask, fun, 2, 3000, 4);
rt_task_init(&mytask2, fun, 0, 3000, 5);
rt_task_make_periodic(&mytask, now + 3000, per);
rt_task_make_periodic(&mytask2, now + 3000 + ( per/2 ), per);
return 0;
}
{
rt_task_delete(&mytask);
rt_task_delete(&mytask2);
}