From 0ab3148268982d93183f3643d3c2a874faddc65e Mon Sep 17 00:00:00 2001 From: ddouthitt Date: Tue, 25 Sep 2001 21:18:40 +0000 Subject: [PATCH] Updated svgalib driver, lb216 driver, and bayrad driver: * Remove all references to lcd.* * Remove all references to base driver functions --- server/drivers/bayrad.c | 40 ++++++++++++++++++------------------ server/drivers/lb216.c | 38 +++++++++++++++++----------------- server/drivers/svgalib_drv.c | 30 ++++++++++++++++----------- 3 files changed, 57 insertions(+), 51 deletions(-) diff --git a/server/drivers/bayrad.c b/server/drivers/bayrad.c index d35480b..30a0514 100644 --- a/server/drivers/bayrad.c +++ b/server/drivers/bayrad.c @@ -474,10 +474,10 @@ int bayrad_init(struct lcd_logical_driver *driver, char *args) void bayrad_close() { - if(lcd.framebuf != NULL) - free(lcd.framebuf); + if(bayrad->framebuf != NULL) + free(bayrad->framebuf); - lcd.framebuf = NULL; + bayrad->framebuf = NULL; write(fd, "\x8e\x00", 2); // Backlight OFF //fprintf(stderr, "\nClosing BayRAD.\n"); @@ -490,7 +490,7 @@ void bayrad_close() // void bayrad_clear() { - memset(lcd.framebuf, ' ', lcd.wid*lcd.hgt); + memset(bayrad->framebuf, ' ', bayrad->wid*bayrad->hgt); } @@ -504,9 +504,9 @@ void bayrad_flush() //fprintf(stderr, "\nBayRAD flush"); write(fd, "\x80\x1e", 2); //sync, home - write(fd, lcd.framebuf, 20); + write(fd, bayrad->framebuf, 20); write(fd, "\x1e\x0a", 2); //home, LF - write(fd, lcd.framebuf+20, 20); + write(fd, bayrad->framebuf+20, 20); return; } @@ -528,7 +528,7 @@ void bayrad_string(int x, int y, char string[]) for(i=0; string[i]; i++) { // Check for buffer overflows... - if((y*lcd.wid) + x + i > (lcd.wid*lcd.hgt)) + if((y*bayrad->wid) + x + i > (bayrad->wid*bayrad->hgt)) break; c = (unsigned char) string[i]; @@ -545,7 +545,7 @@ void bayrad_string(int x, int y, char string[]) c += 0x98; /* as 0x07 makes a beep instead of printing a character */ - lcd.framebuf[(y*lcd.wid) + x + i] = c; + bayrad->framebuf[(y*bayrad->wid) + x + i] = c; } } @@ -571,7 +571,7 @@ void bayrad_chr(int x, int y, char c) /* No shifting the custom chars here, so bayrad_chr() can beep */ - lcd.framebuf[(y*lcd.wid) + x] = ch; + bayrad->framebuf[(y*bayrad->wid) + x] = ch; } ////////////////////////////////////////////////////////////////////// @@ -672,13 +672,13 @@ void bayrad_set_char(int n, char *dat) snprintf(out, sizeof(out), "\x88%c", n); write(fd, out, 2); - for(row=0; rowcellhgt; row++) { letter = 0; - for(col=0; colcellwid; col++) { letter <<= 1; - letter |= (dat[(row*lcd.cellwid) + col] > 0); + letter |= (dat[(row*bayrad->cellwid) + col] > 0); } write(fd, &letter, 1); } @@ -698,17 +698,17 @@ void bayrad_vbar(int x, int len) //fprintf(stderr, "\nVbar at %i, length %i", x, len); - if(len >= lcd.cellhgt) + if(len >= bayrad->cellhgt) { bayrad_chr(x, y, 0xFF); - len -= lcd.cellhgt; + len -= bayrad->cellhgt; y = 1; } if(!len) return; - if(len > lcd.cellhgt) + if(len > bayrad->cellhgt) { bayrad_chr(x, y, '^'); /* Show we've gone off the chart */ return; @@ -731,16 +731,16 @@ void bayrad_hbar(int x, int y, int len) //fprintf(stderr, "\nHbar at %i,%i; length %i", x, y, len); - while((x <= lcd.wid) && (len > 0)) + while((x <= bayrad->wid) && (len > 0)) { - if(len < lcd.cellwid) + if(len < bayrad->cellwid) { bayrad_chr(x, y, 0x98 + len); break; } bayrad_chr(x, y, 0xFF); - len -= lcd.cellwid; + len -= bayrad->cellwid; x++; } @@ -783,9 +783,9 @@ void bayrad_draw_frame(char *dat) //fprintf(stderr, "\nBayRAD draw frame"); write(fd, "\x80\x1e", 2); // NOP, home - write(fd, lcd.framebuf, 20); + write(fd, bayrad->framebuf, 20); write(fd, "\n", 1); - write(fd, lcd.framebuf+20, 20); + write(fd, bayrad->framebuf+20, 20); } diff --git a/server/drivers/lb216.c b/server/drivers/lb216.c index 5abbf65..adfcdff 100644 --- a/server/drivers/lb216.c +++ b/server/drivers/lb216.c @@ -211,8 +211,8 @@ int LB216_init(lcd_logical_driver *driver, char *args) driver->icon = LB216_icon; driver->draw_frame = LB216_draw_frame; - lcd.cellwid = 5; - lcd.cellhgt = 8; + LB216->cellwid = 5; + LB216->cellhgt = 8; debug("LB216: foo!\n"); @@ -236,7 +236,7 @@ void LB216_close() void LB216_flush() { - LB216_draw_frame(lcd.framebuf); + LB216_draw_frame(LB216->framebuf); } @@ -251,7 +251,7 @@ void LB216_chr(int x, int y, char c) // x--; //if(c < 32 && c >= 0) c += 128; -// lcd.framebuf[(y*lcd.wid) + x] = c; +// LB216->framebuf[(y*LB216->wid) + x] = c; char chr[1]; snprintf (chr, sizeof(chr), "%c", c); LB216_string (x, y, chr); @@ -301,7 +301,7 @@ static void LB216_reboot() ///////////////////////////////////////////////////////////// // Blasts a single frame onscreen, to the lcd... // -// Input is a character array, sized lcd.wid*lcd.hgt +// Input is a character array, sized LB216->wid*LB216->hgt // void LB216_draw_frame(char *dat) { @@ -313,15 +313,15 @@ void LB216_draw_frame(char *dat) snprintf (out, sizeof(out), "%c%c", 254,80); write(fd, out, 2); - for(j=0; jhgt; j++) { if (j>=2) { snprintf (out, sizeof(out),"%c%c",254,148+(64*(j-2))); } else { snprintf (out, sizeof(out),"%c%c",254,128+(64*(j))); } write(fd, out, 2); - for(i=0; iwid; i++) { + snprintf (out, sizeof(out),"%c",dat[i+(j*LB216->wid)]); write(fd, out, 1); } } @@ -341,13 +341,13 @@ void LB216_string (int x, int y, char string[]) { case '\254': c = '#'; break; } - lcd.framebuf[(y*lcd.wid) + x+i] = c; + LB216->framebuf[(y*LB216->wid) + x+i] = c; } } ///////////////////////////////////////////////////////////////// -// Sets up for vertical bars. Call before lcd.vbar() +// Sets up for vertical bars. Call before LB216->vbar() // void LB216_init_vbar() { @@ -510,12 +510,12 @@ void LB216_vbar(int x, int len) int y; - for(y=lcd.hgt; y > 0 && len>0; y--) + for(y=LB216->hgt; y > 0 && len>0; y--) { - if(len >= lcd.cellhgt) LB216_chr(x, y, 255); + if(len >= LB216->cellhgt) LB216_chr(x, y, 255); else LB216_chr(x, y, map[len]); - len -= lcd.cellhgt; + len -= LB216->cellhgt; } } @@ -527,13 +527,13 @@ void LB216_hbar(int x, int y, int len) { char map[7] = { 32, 1, 2, 3, 4, 5 }; - for(; x<=lcd.wid && len>0; x++) + for(; x<=LB216->wid && len>0; x++) { - if(len >= lcd.cellwid) LB216_chr(x,y,map[5]); + if(len >= LB216->cellwid) LB216_chr(x,y,map[5]); else LB216_chr(x, y, map[len]); //printf ("%d,",len); - len -= lcd.cellwid; + len -= LB216->cellwid; } // printf ("\n"); @@ -561,13 +561,13 @@ void LB216_set_char(int n, char *dat) snprintf (out, sizeof(out), "%c%c", 254, n); write(fd, out, 2); - for(row=0; rowcellhgt; row++) { letter = 1; - for(col=0; colcellwid; col++) { letter <<= 1; - letter |= (dat[(row*lcd.cellwid) + col] > 0); + letter |= (dat[(row*LB216->cellwid) + col] > 0); } snprintf (out, sizeof(out),"%c",letter); write(fd, out, 1); diff --git a/server/drivers/svgalib_drv.c b/server/drivers/svgalib_drv.c index e76e2eb..7d3428a 100644 --- a/server/drivers/svgalib_drv.c +++ b/server/drivers/svgalib_drv.c @@ -282,9 +282,9 @@ svgalib_drv_init (struct lcd_logical_driver *driver, char *args) driver->string = svgalib_drv_string; driver->chr = svgalib_drv_chr; driver->vbar = svgalib_drv_vbar; - driver->init_vbar = NULL; + //driver->init_vbar = NULL; driver->hbar = svgalib_drv_hbar; - driver->init_hbar = NULL; + //driver->init_hbar = NULL; driver->num = svgalib_drv_num; driver->init_num = svgalib_drv_init_num; @@ -292,9 +292,9 @@ svgalib_drv_init (struct lcd_logical_driver *driver, char *args) driver->close = svgalib_drv_close; driver->flush = svgalib_drv_flush; driver->flush_box = svgalib_drv_flush_box; - driver->contrast = NULL; - driver->backlight = NULL; - driver->set_char = NULL; + //driver->contrast = NULL; + //driver->backlight = NULL; + //driver->set_char = NULL; driver->icon = svgalib_drv_icon; driver->draw_frame = svgalib_drv_draw_frame; @@ -308,11 +308,17 @@ svgalib_drv_init (struct lcd_logical_driver *driver, char *args) return 1; } +///////////////////////////////////////////////////////////////// +// Close down driver +// void svgalib_drv_close () { vga_setmode (TEXT); - drv_base_close (); + if (svgalib_drv->framebuf != NULL) + free (svgalib_drv->framebuf); + + svgalib_drv->framebuf = NULL; } void @@ -401,13 +407,13 @@ svgalib_drv_vbar (int x, int len) char map[] = "_.,,ooO8"; int y; - for (y = lcd.hgt; y > 0 && len > 0; y--) { - if (len >= lcd.cellhgt) + for (y = svgalib_drv->hgt; y > 0 && len > 0; y--) { + if (len >= svgalib_drv->cellhgt) svgalib_drv_chr (x, y, '8'); else svgalib_drv_chr (x, y, map[len - 1]); - len -= lcd.cellhgt; + len -= svgalib_drv->cellhgt; } } @@ -417,13 +423,13 @@ svgalib_drv_vbar (int x, int len) void svgalib_drv_hbar (int x, int y, int len) { - for (; x <= lcd.wid && len > 0; x++) { - if (len >= lcd.cellwid) + for (; x <= svgalib_drv->wid && len > 0; x++) { + if (len >= svgalib_drv->cellwid) svgalib_drv_chr (x, y, '='); else svgalib_drv_chr (x, y, '-'); - len -= lcd.cellwid; + len -= svgalib_drv->cellwid; } }