86c80e6d342e168e379684ad919ba64da10a8203
5 #include <native/intr.h>
7 #include <native/task.h>
15 void key_handler(void *arg
)
18 int nr_interrupts_waiting
;
20 rt_printf("%d\n",count
++);
21 nr_interrupts_waiting
= rt_intr_wait(&keypress
,TM_INFINITE
);
22 if (nr_interrupts_waiting
>0)
31 rt_intr_create(&keypress
, NULL
, PARPORT_IRQ
, I_PROPAGATE
);
34 rt_task_create(&key_isr
, NULL
,0,50,0);
35 rt_task_start(&key_isr
, &key_handler
, NULL
);
40 /* Avoids memory swapping for this program */
41 mlockall(MCL_CURRENT
|MCL_FUTURE
);
43 /* Perform auto-init of rt_print buffers if the task doesn't do so */
44 rt_print_auto_init(1);
47 void enable_interupt()
51 byte
= byte
| 0x10; /* hex 10 = 00010000 */
55 void disable_interupt()
58 byte
= byte
& 0xEF; /* hex EF = binary 11101111 */
62 int main(int argc
, char* argv
[])
64 printf("\nType CTRL-C to end this program\n\n" );
66 // code to set things to run xenomai
72 // wait for CTRL-c is typed to end the program