[Lcdproc] Cobalt Raq 3 and 4 LCD Garbage text usually but occasionally clear.

David W Studeman avionicsdv@aim.com
Sun Jan 13 23:36:01 2008


--nextPart80042108.Zjv4ie8uLR
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8Bit

 Hello folks. As I mentioned in a previous post. I am working on a project
that uses the IPCop firewall distribution to convert old Raq3 and 4i and r
models to a firewall rather than a server. The Axent Velociraptors which
later became Symantec Velociraptors at least up through model 1100 were
also based on this hardware platform we call Raq Gen III. As some of you
know,these units have a HD44780 compatible KS0066U chip feeding a 16x2
character lcd display with 5x8 dots per character.
 I searched the web and did find a hd44780-cobalt lcdproc driver written by
Duncan Laurie back in 2004 and a patch to patch with. Duncan was one of the
original Cobalt LCD and utility folks, programmer or developer, I'm not
sure. I did get it to compile after running autogen after patching it. The
only error I had originally was in hd44780-cobalt.c where no argument was
given at common_init(p); I later changed that to common_init(p, IF_8BIT);
and it compiled. It is on line 63. Anyway, it compiles and it loads using
the cobalt option rather than winamp etc. It doesn't clear the garbage
though. I've delayed the multi all the way up to 125 where it paints it so
slow it fades in and also played with other parameters. I have had
occasional clearness of text but not this weekend yet. 
 IPCop is based on LFS and the encoding is unicode as near as I can tell.
Patching the kernel to run IPCop on the Raq units was the easy part. And
for lcdproc I simply do not compile the embedded cobalt lcd driver into the
kernel itself as all the cobalt drivers are there and then it frees the
parallel port for lcdproc. I made a developer version of IPCop by compiling
it myself and leaving the build environment intact so I can compile and
install in the raq unit itself and uninstall, build again and so forth with
ease.
 I'm curious as to why this was heavily discussed 4 years ago or so and then
it got quiet with almost no mention of lcdproc on a cobalt raq since.
Duncan gpl'ed what he had and luckily a mirror of his old iceblink.org
still exists so I have the code. They are attached here, the diff is
obviously outdated although I did hack it a bit. There's really only three
files that need editing anyway plus dropping the two driver sources
in /server/drivers.
 Sorry my posts are so freaking long, Thanks for your time!

Dave
 

--nextPart80042108.Zjv4ie8uLR
Content-Type: text/x-csrc; name="hd44780-cobalt.c"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="hd44780-cobalt.c"

/*
 * 8-bit driver module for Hitachi HD44780 compatible KS0066U LCD
 * for Sun Cobalt x86 appliances
 *
 * Duncan Laurie <duncan@iceblink.org>
 *
 * printer port   LCD
 * D0 (2)	  D0 (7)
 * D1 (3)	  D1 (8)
 * D2 (4)	  D2 (9)
 * D3 (5)	  D3 (10)
 * D4 (6)	  D4 (11)
 * D5 (7)	  D5 (12)
 * D6 (8)	  D6 (13)
 * D7 (9)	  D7 (14)
 * nSTRB (1)      EN (6)
 * nLF (14)       RW (5)
 * INIT (16)      RS (4)
 *
 * This file is released under the GNU General Public License. Refer to the
 * COPYING file distributed with this package.
 */

#include "hd44780-cobalt.h"
#include "hd44780-low.h"
#include "lpt-port.h"

#include "port.h"
#include "lcd_sem.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>

void cobalt_HD44780_senddata(PrivateData *p, unsigned char displayID,
			     unsigned char flags, unsigned char ch);
void cobalt_HD44780_backlight(PrivateData *p, unsigned char state);
unsigned char cobalt_HD44780_scankeypad(PrivateData *p);

#define RS	INIT
#define RW	LF
#define EN1	STRB

int hd_init_cobalt(Driver *drvthis)
{
	PrivateData *p = (PrivateData*) drvthis->private_data;
	HD44780_functions *hd44780_functions = p->hd44780_functions;

	port_access(p->port);
	port_access(p->port+1);
	port_access(p->port+2);

	hd44780_functions->senddata = cobalt_HD44780_senddata;
	hd44780_functions->backlight = cobalt_HD44780_backlight;
	hd44780_functions->scankeypad = cobalt_HD44780_scankeypad;

	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
	hd44780_functions->uPause(p, 4100);
	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
	hd44780_functions->uPause(p, 100);
	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT | TWOLINE | SMALLCHAR);
	hd44780_functions->uPause(p, 40);

	common_init(p, IF_8BIT);

	if (p->have_keypad)
		p->stuckinputs = cobalt_HD44780_scankeypad(p);

	return 0;
}

void cobalt_HD44780_backlight(PrivateData *p, unsigned char state) {}

void cobalt_HD44780_senddata(PrivateData *p, unsigned char displayID,
			     unsigned char flags, unsigned char ch)
{
	unsigned char pctl = 0;

	if (flags == RS_DATA)
		pctl = RS;

	/* 40 nS setup time for RS valid to EN high, so set RS */
	port_out(p->port + 2, pctl ^ OUTMASK);

	/* Output the actual data */
	port_out(p->port, ch);
	if (p->delayBus)
		p->hd44780_functions->uPause(p, 1);

	/* then set EN high */
	port_out(p->port + 2, (pctl|EN1) ^ OUTMASK);
	if (p->delayBus)
		p->hd44780_functions->uPause(p, 1);

	/* set EN to low and we're done */
	port_out(p->port + 2, pctl ^ OUTMASK);
}

enum BUTTON_CODES
{
    BUTTON_RESET  = 0x02,
    BUTTON_LEFT   = 0x04,
    BUTTON_UP     = 0x08,
    BUTTON_DOWN   = 0x10,
    BUTTON_RIGHT  = 0x20,
    BUTTON_ENTER  = 0x40,
    BUTTON_SELECT = 0x80,
};

unsigned char cobalt_HD44780_scankeypad(PrivateData *p)
{
	unsigned char val;

	port_out(p->port + 2, 0x29);
	if (p->delayBus)
		p->hd44780_functions->uPause(p, 1);

	val = port_in(p->port) ^ 0xfe;

	if (val == p->stuckinputs)
		return 0;

	if (val & BUTTON_SELECT)
		return 1;
	else if (val & BUTTON_ENTER)
		return 2;
	else if (val & BUTTON_LEFT || val & BUTTON_UP)
		return 3;
	else if (val & BUTTON_RIGHT || val & BUTTON_DOWN)
		return 4;

	return 0;
}



--nextPart80042108.Zjv4ie8uLR
Content-Type: text/x-chdr; name="hd44780-cobalt.h"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="hd44780-cobalt.h"

#ifndef HD_COBALT_H

#define HD_COBALT_H



#include "lcd.h"



int hd_init_cobalt(Driver *drvthis);



#endif

--nextPart80042108.Zjv4ie8uLR
Content-Type: text/x-diff; name="lcdproc.diff"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="lcdproc.diff"

--- acinclude.m4	22 Oct 2002 14:11:40 -0000	1.41
+++ acinclude.m4	24 Feb 2003 00:52:42 -0000
@@ -186,7 +186,7 @@
 			;;
 		hd44780)
 			if test "$ac_cv_port_have_lpt" = yes ; then
-				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
+				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-cobalt.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
 			fi
 			if test "$enable_libusb" = yes ; then
 				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o hd44780-hd44780-lcd2usb.o"
--- server/drivers/Makefile.am	22 Oct 2002 14:14:25 -0000	1.26
+++ server/drivers/Makefile.am	24 Feb 2003 00:52:42 -0000
@@ -71,7 +71,7 @@
 glcdlib_SOURCES =    lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
 glk_SOURCES =        lcd.h glk.c glk.h glkproto.c glkproto.h report.h
 hd44780_SOURCES =    lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
-EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h port.h lpt-port.h timing.h
+EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-cobalt.c hd44780-cobalt.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h port.h lpt-port.h timing.h
 
 icp_a106_SOURCES =   lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
 imon_SOURCES =       lcd.h lcd_lib.h imon.h imon.c report.h
--- server/drivers/hd44780-drivers.h	6 May 2002 21:14:14 -0000	1.6
+++ server/drivers/hd44780-drivers.h	24 Feb 2003 00:52:42 -0000
@@ -16,6 +16,7 @@
 // hd44780 specific header files
 #ifdef HAVE_PCSTYLE_LPT_CONTROL
 # include "hd44780-4bit.h"
+# include "hd44780-cobalt.h"
 # include "hd44780-ext8bit.h"
 # include "hd44780-serialLpt.h"
 # include "hd44780-winamp.h"
@@ -37,6 +37,7 @@
 #ifdef HAVE_PCSTYLE_LPT_CONTROL
 	{ "4bit",          hd_init_4bit,      "\tnone\n" },
 	{ "8bit",          hd_init_ext8bit,   "\tnone\n" },
+	{ "cobalt",        hd_init_cobalt,    "\tnone\n" },
 	{ "serialLpt",     hd_init_serialLpt, "\tnone\n" },
 	{ "winamp",        hd_init_winamp,    "\tnone\n" },
 #endif

--nextPart80042108.Zjv4ie8uLR--