#define LPT1IRQ 7
#define TICKS 5
-#define MAXX 16
+#define BANNERWIDTH 10000
+#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;
+unsigned int pointer = 0;
+unsigned int msglen;
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)
outb(0x00, 0x378);
rt_task_sleep(step*2);
for(i=0; i<MAXX; i++){
- outb(data[i], 0x378);
- rt_task_sleep(step/2);
+ outb(data[i+pointer], 0x378);
+ rt_task_sleep(step);
outb(0x00, 0x378);
- rt_task_sleep(step/2);
}
rt_task_sleep(step);
outb(0x00, 0x378);
- //rt_printf("Every x has %.2fms\n", step/1000/1000.0);
+ pointer = pointer > msglen ? 0 : pointer+1;
}
void taski(void *arg)
int main(int argc, char* argv[])
{
+ if(argc != 2){
+ printf("Usage: %s \"Message\"\n", argv[0]);
+ return 1;
+ }
+ message = argv[1];
rt_print_auto_init(1);
mlockall(MCL_CURRENT | MCL_FUTURE);
+ unsigned int i;
+ for(i=0; i<BANNERWIDTH; i++){
+ data[i] = 0;
+ }
+
+ i=20;
+ unsigned char s = 0;
+ while(i<BANNERWIDTH && s < strlen(message)){
+ char c = message[s];
+ printf("processing: '%c'\n", c);
+ switch(c){
+ case 'A':
+ case 'a':
+ data[i++] = 0x1e; data[i++] = 0x5; data[i++] = 0x1e; break;
+ case 'B':
+ case 'b':
+ data[i++] = 0x1f; data[i++] = 0x15; data[i++] = 0xe; break;
+ case 'C':
+ case 'c':
+ data[i++] = 0xe; data[i++] = 0x11; break;
+ case 'D':
+ case 'd':
+ data[i++] = 0x1f; data[i++] = 0x11; data[i++] = 0xe; break;
+ case 'E':
+ case 'e':
+ data[i++] = 0x1f; data[i++] = 0x15; break;
+ case 'F':
+ case 'f':
+ data[i++] = 0x1f; data[i++] = 0x05; break;
+ case 'G':
+ case 'g':
+ data[i++] = 0xe; data[i++] = 0x11, data[i++] = 0x1d; break;
+ case 'H':
+ case 'h':
+ data[i++] = 0x1f; data[i++] = 0x4, data[i++] = 0x1f; break;
+ case 'I':
+ case 'i':
+ data[i++] = 0x1f; break;
+ case 'J':
+ case 'j':
+ data[i++] = 0x10; data[i++] = 0x1f; break;
+ case 'K':
+ case 'k':
+ data[i++] = 0x1f; data[i++] = 0x04; data[i++] = 0x1b; break;
+ case 'L':
+ case 'l':
+ data[i++] = 0x1f; data[i++] = 0x10; break;
+ case 'M':
+ case 'm':
+ data[i++] = 0x1f; data[i++] = 0x2; data[i++] = 0x7; data[i++] = 0x2; data[i++] = 0x1f; break;
+ case 'N':
+ case 'n':
+ data[i++] = 0x1f; data[i++] = 0x2; data[i++] = 0x4; data[i++] = 0x1f; break;
+ case 'O':
+ case 'o':
+ data[i++] = 0xe; data[i++] = 0x11; data[i++] = 0xe; break;
+ case 'P':
+ case 'p':
+ data[i++] = 0x1f; data[i++] = 0x5; data[i++] = 0x2; break;
+ case 'Q':
+ case 'q':
+ data[i++] = 0xe; data[i++] = 0x11; data[i++] = 0x19; data[i++] = 0x1e; break;
+ case 'R':
+ case 'r':
+ data[i++] = 0x1f; data[i++] = 0x5; data[i++] = 0x1a; break;
+ case 'S':
+ case 's':
+ data[i++] = 0x12; data[i++] = 0x15; data[i++] = 0xd; break;
+ case 'T':
+ case 't':
+ data[i++] = 0x1; data[i++] = 0x1f; data[i++] = 0x1; break;
+ case 'U':
+ case 'u':
+ data[i++] = 0x1f; data[i++] = 0x10; data[i++] = 0x1f; break;
+ case 'V':
+ case 'v':
+ data[i++] = 0xf; data[i++] = 0x10; data[i++] = 0xf; break;
+ case 'W':
+ case 'w':
+ data[i++] = 0xf; data[i++] = 0x10; data[i++] = 0xc; data[i++] = 0x10; data[i++] = 0xf; break;
+ case 'X':
+ case 'x':
+ data[i++] = 0x11; data[i++] = 0xe; data[i++] = 0x11; break;
+ case 'Y':
+ case 'y':
+ data[i++] = 0x17; data[i++] = 0x14; data[i++] = 0xf; break;
+ case 'Z':
+ case 'z':
+ data[i++] = 0x19; data[i++] = 0x15; data[i++] = 0x13; break;
+ case '.':
+ data[i++] = 0x10; break;
+ case ',':
+ data[i++] = 0x10; data[i++] = 0x8; break;
+ case '\'':
+ case '"':
+ data[i++] = 0x1; break;
+ case ' ':
+ i++;
+ break;
+ case '!':
+ data[i++] = 0x17; break;
+ default:
+ break;
+ }
+ i++;
+ s++;
+ }
+ msglen = i;
+
// Get permission to write to parallel port
ioperm(0x37A, 1, 1);
ioperm(0x378, 1, 1);