1 /* scrolly_drv.c - kernel module driver for the scrolling LED display */
13 #define LPT 0x278 /* the address of the parallel port */
14 #define STACK_SIZE 4096
16 #define bash_port(data) outb(~((char) (data)), LPT)
18 /* parts of the parallel port we use */
28 static int row_count = 0; /* the number of the next row to be output */
30 /*****************************************************************************/
32 void output_row(unsigned char *rp) {
34 static unsigned char mask;
36 mask = 0x80 >> row_count;
38 for (i = ROW_LENGTH - 1; i >= 0; i--) {
39 if ((rp[i] & mask) > 0)
40 { /* clock a 1 through */
42 bash_port(SRDTA + SRCLK);
45 { /* clock a 0 through*/
51 /* If we just sent the first row then do a reset+load */
55 bash_port(RESET + LOAD);
65 /* Update row_count */
67 if (row_count == NUM_ROWS)
71 /*****************************************************************************/
73 void drv_loop(int dummy)
75 unsigned char row[ROW_LENGTH];
78 /* Empty the buffer */
79 for (i = 0; i < ROW_LENGTH; i++)
82 /* Start the refresh */
85 /* Check for row data */
87 rtf_get(1, row, sizeof(row));
92 /* Suspend until re-started by the rt-kernel */
97 /*****************************************************************************/
101 rtf_create(1, ROW_LENGTH * 100); /* FIFO for row data */
103 outb(0x80, (LPT + 3)); /* set all pins as outputs */
107 rt_task_init(&mytask, drv_loop, 0, STACK_SIZE, PRIORITY);
109 rt_task_make_periodic(&mytask, rt_get_time(),
110 (RT_TICKS_PER_SEC * 1.5) / 1000);
115 /*****************************************************************************/
117 void cleanup_module(void)
119 rt_task_delete(&mytask);