aboutsummaryrefslogtreecommitdiffstats
path: root/parport.c
diff options
context:
space:
mode:
authorreinelt <>2003-08-19 05:23:55 +0000
committerreinelt <>2003-08-19 05:23:55 +0000
commit9f9bddb50ffeba95221a917d24dedbefee5b9ab5 (patch)
treeb2923058ed8ed56bca14935c259947c5edff82d4 /parport.c
parentbc0c578f70d4df6ff809471479be6552c6a209b3 (diff)
downloadlcd4linux-9f9bddb50ffeba95221a917d24dedbefee5b9ab5.tar.gz
[lcd4linux @ 2003-08-19 05:23:55 by reinelt]
HD44780 dual-controller patch from Jesse Brook Kovach
Diffstat (limited to 'parport.c')
-rw-r--r--parport.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/parport.c b/parport.c
index a5ba3c2..db633b7 100644
--- a/parport.c
+++ b/parport.c
@@ -1,4 +1,4 @@
-/* $Id: parport.c,v 1.4 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: parport.c,v 1.5 2003/08/19 05:23:55 reinelt Exp $
*
* generic parallel port handling
*
@@ -20,6 +20,9 @@
*
*
* $Log: parport.c,v $
+ * Revision 1.5 2003/08/19 05:23:55 reinelt
+ * HD44780 dual-controller patch from Jesse Brook Kovach
+ *
* Revision 1.4 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -340,7 +343,6 @@ void parport_control (unsigned char mask, unsigned char value)
// Strobe, Select and AutoFeed are inverted!
value = mask & (value ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
- // value ^= PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD;
#ifdef WITH_PPDEV
if (PPdev) {
@@ -358,45 +360,50 @@ void parport_control (unsigned char mask, unsigned char value)
}
-void parport_toggle (unsigned char bit, int level, int delay)
+void parport_toggle (unsigned char bits, int level, int delay)
{
+ unsigned char value1, value2;
// any signal affected?
// Note: this may happen in case a signal is hardwired to GND
- if (bit==0) return;
+ if (bits==0) return;
+ // prepare value
+ value1=level?bits:0;
+ value2=level?0:bits;
+
// Strobe, Select and AutoFeed are inverted!
- if (bit & (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD)) {
- level=!level;
- }
+ value1 = bits & (value1 ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
+ value2 = bits & (value1 ^ (PARPORT_CONTROL_STROBE|PARPORT_CONTROL_SELECT|PARPORT_CONTROL_AUTOFD));
+
#ifdef WITH_PPDEV
if (PPdev) {
struct ppdev_frob_struct frob;
- frob.mask=bit;
+ frob.mask=bits;
// rise
- frob.val=level?bit:0;
+ frob.val=value1;
ioctl (PPfd, PPFCONTROL, &frob);
// pulse width
ndelay(delay);
// lower
- frob.val=level?0:bit;
+ frob.val=value2;
ioctl (PPfd, PPFCONTROL, &frob);
} else
#endif
{
// rise
- ctr = (ctr & ~bit) ^ (level?bit:0);
+ ctr = (ctr & ~bits) ^ value1;
outb (ctr, Port+2);
// pulse width
ndelay(delay);
// lower
- ctr = (ctr & ~bit) ^ (level?0:bit);
+ ctr = (ctr & ~bits) ^ value2;
outb (ctr, Port+2);
}
}