update master
authordopefishh <mart@martlubbers.net>
Fri, 2 Oct 2015 08:24:29 +0000 (10:24 +0200)
committerdopefishh <mart@martlubbers.net>
Fri, 2 Oct 2015 08:24:29 +0000 (10:24 +0200)
mart/ex10/ex10dmaster.c

index bf4551a..ad9ea10 100644 (file)
@@ -21,12 +21,13 @@ void lpt1_handler(void *arg)
        RT_INTR intr;
        rt_intr_create(&intr, "lpt1 handler", LPT1IRQ, 0);
        rt_task_set_periodic(NULL, TM_NOW, 1e5);
+    rt_printf("Sending\n");
 
        unsigned int i;
        for(i = 0; i<SAMPLES; i++){
                times[i] = rt_timer_read();     
-        outb(inb(0x37A) & 0xEF, 0x37A);
-        outb(inb(0x37A) | 0x01, 0x37A);
+        outb(inb(0x378) & 0xEF, 0x378);
+        outb(inb(0x378) | 0x01, 0x378);
         // Signal other machine
         rt_intr_wait(&intr, TM_INFINITE);
         times[i] = rt_timer_read()-times[i];
@@ -39,6 +40,7 @@ void lpt1_handler(void *arg)
                fprintf(file, "%u,%llu\n", i, times[i]);
        }
        fclose(file);
+    rt_printf("Done, you can press CRTL+C now\n");
 }
 
 int main(int argc, char* argv[])
@@ -47,10 +49,13 @@ int main(int argc, char* argv[])
        mlockall(MCL_CURRENT | MCL_FUTURE);
 
     ioperm(0x37A, 1, 1);
+    ioperm(0x378, 1, 1);
     outb(inb(0x37A) | 0x01, 0x37A);
+    outb(inb(0x378) | 0x01, 0x378);
 
        rt_task_create(&task, "task", 0, 50, 0);
        rt_task_start(&task, &lpt1_handler, 0);
 
-    sleep(5);
+    pause();
+    outb(inb(0x37A) & 0xEF, 0x37A);
 }