RT_INTR intr;
rt_intr_create(&intr, "lpt1 handler", LPT1IRQ, 0);
rt_task_set_periodic(NULL, TM_NOW, 1e5);
- rt_printf("Sending\n");
+ rt_printf("Sending\n");
unsigned int i;
for(i = 0; i<SAMPLES; i++){
times[i] = rt_timer_read();
- 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];
+ 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];
rt_task_wait_period(NULL);
}
rt_print_auto_init(1);
mlockall(MCL_CURRENT | MCL_FUTURE);
- ioperm(0x37A, 1, 1);
- ioperm(0x378, 1, 1);
- outb(inb(0x37A) | 0x01, 0x37A);
- outb(inb(0x378) | 0x01, 0x378);
+ 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);
rt_intr_create(&intr, "lpt1 handler", LPT1IRQ, 0);
rt_printf("Listening...\n");
- rt_intr_wait(&intr, TM_INFINITE);
- outb(inb(0x378) & 0xEF, 0x378);
- outb(inb(0x378) | 0x01, 0x378);
- rt_printf("Received an interrupt\n");
while(1){
- rt_intr_wait(&intr, TM_INFINITE);
- outb(inb(0x37A) & 0xEF, 0x37A);
- outb(inb(0x37A) | 0x01, 0x37A);
+ rt_intr_wait(&intr, TM_INFINITE);
+ outb(inb(0x378) & 0xEF, 0x378);
+ outb(inb(0x378) | 0x01, 0x378);
}
}
rt_print_auto_init(1);
mlockall(MCL_CURRENT | MCL_FUTURE);
- ioperm(0x37A, 1, 1);
- ioperm(0x378, 1, 1);
- outb(inb(0x37A) | 0x01, 0x37A);
- outb(inb(0x378) | 0x01, 0x378);
+ 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);
+a = figure;
+set(a,'visible','off');
d = csvread("ex10ab.csv")(:,2) ./ 1000;
dmax = max(d);
dmin = min(d);
text(100, dmax-stepsize*4, sprintf("Max: %d", dmax));
print -dpng "-S1200,1200" ex10ab.png
-d = csvread("ex10d.csv")(:,2);
-dmax = max(d);
-dmin = min(d);
-davg = mean(d);
-ddev = std(d);
-figure;
-plot(d, '@k');
-title("Measurements on interrupt latency via LPT1");
-xlabel("Number of the measurement");
-ylabel("Time till next measurement in nanoseconds");
-stepsize = (dmax+dmin)/25;
-text(100, dmax-stepsize, sprintf("Min: %d", dmin));
-text(100, dmax-stepsize*2, sprintf("Mean: %.2f", davg));
-text(100, dmax-stepsize*3, sprintf("Std: %.2f", ddev));
-text(100, dmax-stepsize*4, sprintf("Max: %d", dmax));
-print -dpng "-S1200,1200" ex10ab.png
+%set(a,'visible','off');
+%d = csvread("ex10d.csv")(:,2);
+%dmax = max(d);
+%dmin = min(d);
+%davg = mean(d);
+%ddev = std(d);
+%figure;
+%plot(d, '@k');
+%title("Measurements on interrupt latency via LPT1");
+%xlabel("Number of the measurement");
+%ylabel("Time till next measurement in nanoseconds");
+%stepsize = (dmax+dmin)/25;
+%text(100, dmax-stepsize, sprintf("Min: %d", dmin));
+%text(100, dmax-stepsize*2, sprintf("Mean: %.2f", davg));
+%text(100, dmax-stepsize*3, sprintf("Std: %.2f", ddev));
+%text(100, dmax-stepsize*4, sprintf("Max: %d", dmax));
+%print -dpng "-S1200,1200" ex10ab.png