RT_INTR keypress;
RT_TASK key_isr;
-#define KEYBOARD_IRQ 1
+#define PARPORT_IRQ 7
+
+unsigned char byte;
void key_handler(void *arg)
{
//startup code
void startup()
{
- rt_intr_create(&keypress, NULL, KEYBOARD_IRQ, I_PROPAGATE);
+ rt_intr_create(&keypress, NULL, PARPORT_IRQ, I_PROPAGATE);
+ enable_interupt();
rt_task_create(&key_isr, NULL,0,50,0);
rt_task_start(&key_isr, &key_handler, NULL);
+
}
void init_xenomai() {
rt_print_auto_init(1);
}
+void enable_interupt()
+{
+ ioperm(0x37A, 1, 1);
+ byte = inb(0x37A);
+ byte = byte | 0x10; /* hex 10 = 00010000 */
+ outb(byte, 0x37A);
+}
+
+void disable_interupt()
+{
+ byte = inb(0x37A);
+ byte = byte & 0xEF; /* hex EF = binary 11101111 */
+ outb(byte, 0x37A);
+}
+
int main(int argc, char* argv[])
{
printf("\nType CTRL-C to end this program\n\n" );
// wait for CTRL-c is typed to end the program
pause();
-}
\ No newline at end of file
+
+ disable_interupt();
+}