aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-01-06 16:54:54 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-01-06 16:54:54 +0000
commit9fa6b4f5e9722ae9c3a453b851d0f1b0590b9ac0 (patch)
treeda86e873b3e9f272b2065eefb8f5a44d894418a4
parentf10ba1a7ffe9c280fd4a3654e8ea972e280a1953 (diff)
downloadlcd4linux-9fa6b4f5e9722ae9c3a453b851d0f1b0590b9ac0.tar.gz
[lcd4linux @ 2005-01-06 16:54:53 by reinelt]
M50530 fixes git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@499 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_M50530.c55
-rw-r--r--drv_generic_parport.c24
-rw-r--r--lcd4linux.conf.sample12
3 files changed, 51 insertions, 40 deletions
diff --git a/drv_M50530.c b/drv_M50530.c
index 2132c55..4c399ac 100644
--- a/drv_M50530.c
+++ b/drv_M50530.c
@@ -1,4 +1,4 @@
-#/* $Id: drv_M50530.c,v 1.14 2004/06/26 12:04:59 reinelt Exp $
+#/* $Id: drv_M50530.c,v 1.15 2005/01/06 16:54:53 reinelt Exp $
*
* new style driver for M50530-based displays
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_M50530.c,v $
+ * Revision 1.15 2005/01/06 16:54:53 reinelt
+ * M50530 fixes
+ *
* Revision 1.14 2004/06/26 12:04:59 reinelt
*
* uh-oh... the last CVS log message messed up things a lot...
@@ -156,13 +159,13 @@ static void drv_M5_command (const unsigned int cmd, const int delay)
{
/* put data on DB1..DB8 */
- drv_generic_parport_data (cmd&0xff);
-
+ drv_generic_parport_data (cmd & 0xff);
+
/* set I/OC1 */
/* set I/OC2 */
- drv_generic_parport_control (SIGNAL_IOC1|SIGNAL_IOC2,
- (cmd&0x200?SIGNAL_IOC1:0) |
- (cmd&0x100?SIGNAL_IOC2:0));
+ drv_generic_parport_control (SIGNAL_IOC1 | SIGNAL_IOC2,
+ (cmd & 0x100 ? SIGNAL_IOC1 : 0) |
+ (cmd & 0x200 ? SIGNAL_IOC2 : 0));
/* Control data setup time */
ndelay(200);
@@ -195,8 +198,8 @@ static void drv_M5_write (const int row, const int col, const char *data, const
drv_M5_command (0x300 | pos, 20);
while (l--) {
- cmd = *data++;
- drv_M5_command (0x100 | cmd, 20);
+ cmd = *(unsigned char*)data++;
+ drv_M5_command (0x200 | cmd, 20);
}
}
@@ -205,12 +208,12 @@ static void drv_M5_defchar (const int ascii, const unsigned char *matrix)
{
int i;
- drv_M5_command (0x300+192+8*(ascii-CHAR0), 20);
+ drv_M5_command (0x300 + 192 + 8 * (ascii - CHAR0), 20);
/* Fixme: looks like the M50530 cannot control the bottom line */
/* therefore we have only 7 bytes here */
- for (i=0; i<7; i++) {
- drv_M5_command (0x100|(matrix[i] & 0x3f), 20);
+ for (i = 0; i < 7; i++) {
+ drv_M5_command (0x200 | (matrix[i] & 0x3f), 20);
}
}
@@ -282,11 +285,14 @@ static int drv_M5_start (const char *section, const int quiet)
if ((SIGNAL_EX = drv_generic_parport_wire_ctrl ("EX", "STROBE"))==0xff) return -1;
if ((SIGNAL_IOC1 = drv_generic_parport_wire_ctrl ("IOC1", "SELECT"))==0xff) return -1;
if ((SIGNAL_IOC2 = drv_generic_parport_wire_ctrl ("IOC2", "AUTOFD"))==0xff) return -1;
- if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl ("GPO", "INIT" ))==0xff) return -1;
+ if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl ("GPO", "GND" ))==0xff) return -1;
/* clear all signals */
drv_generic_parport_control (SIGNAL_EX|SIGNAL_IOC1|SIGNAL_IOC2|SIGNAL_GPO, 0);
-
+
+ /* for any mysterious reason, this delay is necessary... */
+ udelay(2000);
+
/* set direction: write */
drv_generic_parport_direction (0);
@@ -362,37 +368,37 @@ int drv_M5_init (const char *section, const int quiet)
/* start display */
- if ((ret=drv_M5_start (section, quiet))!=0)
+ if ((ret = drv_M5_start (section, quiet)) != 0)
return ret;
/* initialize generic text driver */
- if ((ret=drv_generic_text_init(section, Name))!=0)
+ if ((ret = drv_generic_text_init(section, Name)) != 0)
return ret;
/* initialize generic icon driver */
- if ((ret=drv_generic_text_icon_init())!=0)
+ if ((ret = drv_generic_text_icon_init()) != 0)
return ret;
/* initialize generic bar driver */
- if ((ret=drv_generic_text_bar_init(0))!=0)
+ if ((ret = drv_generic_text_bar_init(0)) != 0)
return ret;
/* add fixed chars to the bar driver */
- drv_generic_text_bar_add_segment (0,0,255,32); /* ASCII 32 = blank */
+ drv_generic_text_bar_add_segment (0, 0, 255, 32); /* ASCII 32 = blank */
/* register text widget */
- wc=Widget_Text;
- wc.draw=drv_generic_text_draw;
+ wc = Widget_Text;
+ wc.draw = drv_generic_text_draw;
widget_register(&wc);
/* register icon widget */
- wc=Widget_Icon;
- wc.draw=drv_generic_text_icon_draw;
+ wc = Widget_Icon;
+ wc.draw = drv_generic_text_icon_draw;
widget_register(&wc);
/* register bar widget */
- wc=Widget_Bar;
- wc.draw=drv_generic_text_bar_draw;
+ wc = Widget_Bar;
+ wc.draw = drv_generic_text_bar_draw;
widget_register(&wc);
/* register plugins */
@@ -420,6 +426,7 @@ int drv_M5_quit (const int quiet) {
/* clear all signals */
drv_generic_parport_control (SIGNAL_EX|SIGNAL_IOC1|SIGNAL_IOC2|SIGNAL_GPO, 0);
+ /* close port */
drv_generic_parport_close();
return (0);
diff --git a/drv_generic_parport.c b/drv_generic_parport.c
index 5ec6bbd..945a573 100644
--- a/drv_generic_parport.c
+++ b/drv_generic_parport.c
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_parport.c,v 1.11 2004/09/18 15:58:57 reinelt Exp $
+/* $Id: drv_generic_parport.c,v 1.12 2005/01/06 16:54:54 reinelt Exp $
*
* generic driver helper for serial and parport access
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_generic_parport.c,v $
+ * Revision 1.12 2005/01/06 16:54:54 reinelt
+ * M50530 fixes
+ *
* Revision 1.11 2004/09/18 15:58:57 reinelt
* even more HD44780 cleanups, hardwiring for LCM-162
*
@@ -426,11 +429,11 @@ void drv_generic_parport_toggle (const unsigned char bits, const int level, cons
/* any signal affected? */
/* Note: this may happen in case a signal is hardwired to GND */
- if (bits==0) return;
+ if (bits == 0) return;
/* prepare value */
- value1=level?bits:0;
- value2=level?0:bits;
+ value1 = level ? bits : 0;
+ value2 = level ? 0 : bits;
/* Strobe, Select and AutoFeed are inverted! */
value1 = bits & (value1 ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
@@ -440,18 +443,19 @@ void drv_generic_parport_toggle (const unsigned char bits, const int level, cons
#ifdef WITH_PPDEV
if (PPdev) {
struct ppdev_frob_struct frob;
- frob.mask=bits;
-
+ frob.mask = bits;
+
/* rise */
- frob.val=value1;
+ frob.val = value1;
ioctl (PPfd, PPFCONTROL, &frob);
-
+
/* pulse width */
ndelay(delay);
-
+
/* lower */
- frob.val=value2;
+ frob.val = value2;
ioctl (PPfd, PPFCONTROL, &frob);
+
} else
#endif
{
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 09ea972..567cf92 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -126,7 +126,7 @@ Display HD44780-I2C {
Display M50530-24x8 {
Driver 'M50530'
- Port '/dev/parports/0'
+ Port '/dev/parport0'
# Port '0x378'
Size '24x8'
Wire.EX 'STROBE'
@@ -301,7 +301,7 @@ Widget Disk {
# expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2
# with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat
# therefore you have to use another function called 'diskstats':
- expression diskstats('.*', 'read_sectors', 500) + diskstats('.*', 'write_sectors', 500)
+ expression diskstats('hd.', 'read_sectors', 500) + diskstats('hd.', 'write_sectors', 500)
prefix 'disk'
postfix ' '
width 10
@@ -315,8 +315,8 @@ Widget DiskBar {
#expression proc_stat::disk('.*', 'rblk', 500)
#expression2 proc_stat::disk('.*', 'wblk', 500)
# for kernel 2.6:
- expression diskstats('.*', 'read_sectors', 500)
- expression2 diskstats('.*', 'write_sectors', 500)
+ expression diskstats('hd.', 'read_sectors', 500)
+ expression2 diskstats('hd.', 'write_sectors', 500)
length 14
direction 'E'
update tack
@@ -687,10 +687,10 @@ Layout testMySQL {
#Display 'SC1602D'
#Display 'LCM-162'
#Display 'CF631'
-Display 'CF632'
+#Display 'CF632'
#Display 'CF633'
#Display 'Curses'
-#Display 'M50530-24x8'
+Display 'M50530-24x8'
#Display 'CT20x4'
#Display 'T6963-240x64'
#Display 'XWindow'