final commit
[des2015.git] / natanael / ex09 / ex09a1.c
index 86c80e6..cb7257d 100644 (file)
@@ -8,9 +8,7 @@
 
 RT_INTR keypress;
 RT_TASK key_isr;
-#define PARPORT_IRQ 7
-
-unsigned char byte;
+#define KEYBOARD_IRQ 1
 
 void key_handler(void *arg)
 {
@@ -28,12 +26,10 @@ void key_handler(void *arg)
 //startup code
 void startup()
 {
-    rt_intr_create(&keypress, NULL, PARPORT_IRQ, I_PROPAGATE);
-    enable_interupt();
+       rt_intr_create(&keypress, NULL, KEYBOARD_IRQ, I_PROPAGATE);
 
        rt_task_create(&key_isr, NULL,0,50,0);
        rt_task_start(&key_isr, &key_handler, NULL);
-
 }
 
 void init_xenomai() {
@@ -44,21 +40,6 @@ 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" );
@@ -71,6 +52,4 @@ int main(int argc, char* argv[])
 
   // wait for CTRL-c is typed to end the program
   pause();
-
-  disable_interupt();
-}
+}
\ No newline at end of file