X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mart%2Fxenomai%2Fex11%2Fex11.c;h=3b95b92c63a9d27396dcf487d358074f6fd9bca6;hb=efecf8ba85d5b20f6a551fb3e90ae11013cef62d;hp=0dbd214e254d309a8c7d15eb5def3d1f450a9d78;hpb=0cf9f37fd6cc5daeaf41c11f683a868a1d9208a3;p=des2015.git diff --git a/mart/xenomai/ex11/ex11.c b/mart/xenomai/ex11/ex11.c index 0dbd214..3b95b92 100644 --- a/mart/xenomai/ex11/ex11.c +++ b/mart/xenomai/ex11/ex11.c @@ -12,16 +12,19 @@ #define LPT1IRQ 7 #define TICKS 5 -#define MAXX 16 +#define BANNERWIDTH 10000 +#define MSGMAX 1000 +#define MAXX 20 RT_TASK intrtask, drawtask; RTIME ticks[TICKS+1]; RTIME tocks[TICKS+1]; -unsigned char data[MAXX] = { - 1, 2, 4, 8, 16, 32, 64, 128, 256, - 1, 2, 4, 8, 16, 32, 64, 128, 256 -}; +unsigned char data[BANNERWIDTH]; +char message[MSGMAX]; +char inputmsg[MSGMAX]; +unsigned int pointer = 0; +unsigned int msglen; void add_tick(RTIME *t, RTIME tnew) { @@ -32,7 +35,7 @@ void add_tick(RTIME *t, RTIME tnew) t[TICKS] += t[i]; } t[0] = tnew; - t[TICKS] = t[TICKS]/TICKS; + t[TICKS] = (t[TICKS]+t[0])/TICKS; } void taskd(void *arg) @@ -41,19 +44,17 @@ void taskd(void *arg) RTIME step = time/(2*MAXX+2); unsigned int i; - //To the right outb(0x00, 0x378); rt_task_sleep(step*2); for(i=0; i msglen ? 0 : pointer+1; } void taski(void *arg) @@ -61,7 +62,6 @@ void taski(void *arg) //Register as interrupt handler RT_INTR intr; rt_intr_create(&intr, NULL, LPT1IRQ, 0); - rt_printf("Interrupt created\n"); //Initialize and declare the timer variables RTIME tick = rt_timer_read(); @@ -78,7 +78,6 @@ void taski(void *arg) rt_task_create(&drawtask, NULL, 0, 50, 0); period = ticks[TICKS]+tocks[TICKS]; rt_task_start(&drawtask, &taskd, &period); - rt_printf("tocks is the short stretch\n"); } rt_intr_wait(&intr, TM_INFINITE); @@ -92,27 +91,177 @@ void taski(void *arg) rt_task_create(&drawtask, NULL, 0, 50, 0); period = ticks[TICKS]+tocks[TICKS]; rt_task_start(&drawtask, &taskd, &period); - rt_printf("ticks is the short stretch\n"); } rt_intr_wait(&intr, TM_INFINITE); - //Print average - //rt_printf("avgtick: %lluns, avgtock: %lluns, avgticktock: %lluns\n", - // ticks[TICKS], tocks[TICKS], (ticks[TICKS]+tocks[TICKS])/2); } } +void make_message(char *msg) +{ + unsigned int i; + for(i=0; i