From 9db867e71f792e6b4d3dbec080fa9696147c7c8b Mon Sep 17 00:00:00 2001 From: marschap Date: Wed, 27 Jul 2005 19:31:08 +0000 Subject: [PATCH] small fixes --- server/drivers/CFontz633.c | 2 +- server/drivers/CFontz633io.c | 17 +++++++++++++---- server/drivers/svgalib_drv.c | 2 +- server/drivers/svgalib_drv.h | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/server/drivers/CFontz633.c b/server/drivers/CFontz633.c index fcd0274..28631ba 100644 --- a/server/drivers/CFontz633.c +++ b/server/drivers/CFontz633.c @@ -402,7 +402,7 @@ CFontz633_flush (Driver *drvthis) out[0] = (unsigned char) (i % p->width); // column out[1] = (unsigned char) (i / p->width); // line out[2] = p->framebuf[i]; // character - send_bytes_message(fd, CF633_Send_Data_to_LCD, 3, out); + send_bytes_message(p->fd, CF633_Send_Data_to_LCD, 3, out); p->backingstore[i] = p->framebuf[i]; } } diff --git a/server/drivers/CFontz633io.c b/server/drivers/CFontz633io.c index c80decb..d3a8a3d 100644 --- a/server/drivers/CFontz633io.c +++ b/server/drivers/CFontz633io.c @@ -165,6 +165,16 @@ send_packet(int fd, COMMAND_PACKET *out) /** calculate CRC over given buffer with given length */ +/* According to the "Painless Guide to CRC error dectectin algorithmsi + * (http://www.repairfaq.org/filipg/LINK/F_crc_v3.html) this is the table driven + * implementation of a CRC with the following parameters: + * - WIDTH: 16 (16 bit CRC) + * - POLY: 0x1021 (generating polynomial) + * - INIT: 0xFFFF (seed value for the register when starting the algorithm) + * - REFIN: TRUE (reflect [i.e. bit-swap] each input byte before being processed) + * - REFOUT: TRUE (reflect [i.e. bit-swap] the result before the XOROUT phase) + * - XOROUT: 0xFFFF (value to xor the result before returning it as crc) + */ static int get_crc(char *buf, int len, int seed) { @@ -210,10 +220,10 @@ get_crc(char *buf, int len, int seed) /* This algorithm is based on the IrDA LAP example */ while (len-- > 0) - newCrc = (newCrc >> 8) ^ crcLookupTable[(newCrc ^ *buf++) & 0xff]; + newCrc = (newCrc >> 8) ^ crcLookupTable[(newCrc ^ *buf++) & 0xFF]; /* Make this crc match the one's complement that is sent in the packet */ - return (~newCrc); + return ((~newCrc) & 0xFFFF); } @@ -395,7 +405,7 @@ test_packet(int fd, unsigned char response) while (is_msg != GIVE_UP) { if (is_msg == GOOD_MSG) { treat_packet(); - // do we need treat_packet at all ? + // do we need treat_packet as separate function ? if (incoming_command.command == response) response_received = 1; } @@ -505,7 +515,6 @@ check_for_packet(int fd, unsigned char expected_length) //Compute the expected CheckSum testcrc = get_crc((unsigned char *) &incoming_command, incoming_command.data_length+2, 0xFFFF); - testcrc = testcrc & 0xFFFF; /* This is TRICKY */ if (incoming_command.crc.as_word == testcrc) { //This is a good packet. I'll be horn swaggled. Remove the packet diff --git a/server/drivers/svgalib_drv.c b/server/drivers/svgalib_drv.c index c53352e..5cbcd6a 100644 --- a/server/drivers/svgalib_drv.c +++ b/server/drivers/svgalib_drv.c @@ -307,7 +307,7 @@ svgalib_drv_init (Driver *drvthis) /* initialize svgalib library */ if (vga_init() != 0) { - report(RPT_ERR, "svga: ivga_niti() failed."); + report(RPT_ERR, "svga: vga_init() failed."); return -1; } diff --git a/server/drivers/svgalib_drv.h b/server/drivers/svgalib_drv.h index 3445a6b..bf9838d 100644 --- a/server/drivers/svgalib_drv.h +++ b/server/drivers/svgalib_drv.h @@ -30,6 +30,8 @@ MODULE_EXPORT int svgalib_drv_init (Driver *drvthis); MODULE_EXPORT void svgalib_drv_close (Driver *drvthis); MODULE_EXPORT int svgalib_drv_width (Driver *drvthis); MODULE_EXPORT int svgalib_drv_height (Driver *drvthis); +MODULE_EXPORT int svgalib_drv_cellwidth (Driver *drvthis); +MODULE_EXPORT int svgalib_drv_cellheight (Driver *drvthis); MODULE_EXPORT void svgalib_drv_clear (Driver *drvthis); MODULE_EXPORT void svgalib_drv_flush (Driver *drvthis); MODULE_EXPORT void svgalib_drv_string (Driver *drvthis, int x, int y, char string[]);