small fixes
This commit is contained in:
@@ -402,7 +402,7 @@ CFontz633_flush (Driver *drvthis)
|
|||||||
out[0] = (unsigned char) (i % p->width); // column
|
out[0] = (unsigned char) (i % p->width); // column
|
||||||
out[1] = (unsigned char) (i / p->width); // line
|
out[1] = (unsigned char) (i / p->width); // line
|
||||||
out[2] = p->framebuf[i]; // character
|
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];
|
p->backingstore[i] = p->framebuf[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,16 @@ send_packet(int fd, COMMAND_PACKET *out)
|
|||||||
|
|
||||||
|
|
||||||
/** calculate CRC over given buffer with given length */
|
/** 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
|
static int
|
||||||
get_crc(char *buf, int len, int seed)
|
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 */
|
/* This algorithm is based on the IrDA LAP example */
|
||||||
while (len-- > 0)
|
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 */
|
/* 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) {
|
while (is_msg != GIVE_UP) {
|
||||||
if (is_msg == GOOD_MSG) {
|
if (is_msg == GOOD_MSG) {
|
||||||
treat_packet();
|
treat_packet();
|
||||||
// do we need treat_packet at all ?
|
// do we need treat_packet as separate function ?
|
||||||
if (incoming_command.command == response)
|
if (incoming_command.command == response)
|
||||||
response_received = 1;
|
response_received = 1;
|
||||||
}
|
}
|
||||||
@@ -505,7 +515,6 @@ check_for_packet(int fd, unsigned char expected_length)
|
|||||||
//Compute the expected CheckSum
|
//Compute the expected CheckSum
|
||||||
testcrc = get_crc((unsigned char *) &incoming_command,
|
testcrc = get_crc((unsigned char *) &incoming_command,
|
||||||
incoming_command.data_length+2, 0xFFFF);
|
incoming_command.data_length+2, 0xFFFF);
|
||||||
testcrc = testcrc & 0xFFFF; /* This is TRICKY */
|
|
||||||
|
|
||||||
if (incoming_command.crc.as_word == testcrc) {
|
if (incoming_command.crc.as_word == testcrc) {
|
||||||
//This is a good packet. I'll be horn swaggled. Remove the packet
|
//This is a good packet. I'll be horn swaggled. Remove the packet
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ svgalib_drv_init (Driver *drvthis)
|
|||||||
|
|
||||||
/* initialize svgalib library */
|
/* initialize svgalib library */
|
||||||
if (vga_init() != 0) {
|
if (vga_init() != 0) {
|
||||||
report(RPT_ERR, "svga: ivga_niti() failed.");
|
report(RPT_ERR, "svga: vga_init() failed.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ MODULE_EXPORT int svgalib_drv_init (Driver *drvthis);
|
|||||||
MODULE_EXPORT void svgalib_drv_close (Driver *drvthis);
|
MODULE_EXPORT void svgalib_drv_close (Driver *drvthis);
|
||||||
MODULE_EXPORT int svgalib_drv_width (Driver *drvthis);
|
MODULE_EXPORT int svgalib_drv_width (Driver *drvthis);
|
||||||
MODULE_EXPORT int svgalib_drv_height (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_clear (Driver *drvthis);
|
||||||
MODULE_EXPORT void svgalib_drv_flush (Driver *drvthis);
|
MODULE_EXPORT void svgalib_drv_flush (Driver *drvthis);
|
||||||
MODULE_EXPORT void svgalib_drv_string (Driver *drvthis, int x, int y, char string[]);
|
MODULE_EXPORT void svgalib_drv_string (Driver *drvthis, int x, int y, char string[]);
|
||||||
|
|||||||
Reference in New Issue
Block a user