aboutsummaryrefslogtreecommitdiffstats
path: root/HD44780.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-14 16:47:41 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-14 16:47:41 +0000
commit6332ea0ded15b1ec775ffdb94cc7d8c779138356 (patch)
tree9b1198dd01c353eb1f70087c2876467f4bc58d72 /HD44780.c
parent3ede643c6ae5328dddda6c39a9a4c992c8f1fed7 (diff)
downloadlcd4linux-6332ea0ded15b1ec775ffdb94cc7d8c779138356.tar.gz
[lcd4linux @ 2001-03-14 16:47:41 by reinelt]
minor cleanups git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@120 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'HD44780.c')
-rw-r--r--HD44780.c87
1 files changed, 46 insertions, 41 deletions
diff --git a/HD44780.c b/HD44780.c
index 5a1d15a..6589ee1 100644
--- a/HD44780.c
+++ b/HD44780.c
@@ -1,4 +1,4 @@
-/* $Id: HD44780.c,v 1.16 2001/03/14 15:30:53 reinelt Exp $
+/* $Id: HD44780.c,v 1.17 2001/03/14 16:47:41 reinelt Exp $
*
* driver for display modules based on the HD44780 chip
*
@@ -20,6 +20,9 @@
*
*
* $Log: HD44780.c,v $
+ * Revision 1.17 2001/03/14 16:47:41 reinelt
+ * minor cleanups
+ *
* Revision 1.16 2001/03/14 15:30:53 reinelt
*
* make ppdev compatible to earlier kernels
@@ -219,19 +222,18 @@ static void HD_command (unsigned char cmd, int delay)
// wait
udelay(delay);
- } else {
+ } else
#endif
- outb (cmd, Port); // put data on DB1..DB8
- outb (0x02, Port+2); // set Enable = bit 0 invertet
- udelay (1);
- outb (0x03, Port+2); // clear Enable
- udelay (delay);
+ {
+ outb (cmd, Port); // put data on DB1..DB8
+ outb (0x02, Port+2); // set Enable = bit 0 invertet
+ udelay (1);
+ outb (0x03, Port+2); // clear Enable
+ udelay (delay);
-#ifdef WITH_PPDEV
- }
-#endif
+ }
}
static void HD_write (char *string, int len, int delay)
@@ -259,26 +261,27 @@ static void HD_write (char *string, int len, int delay)
udelay(delay);
}
- } else {
+ } else
#endif
- while (len--) {
- outb (*string++, Port); // put data on DB1..DB8
- outb (0x00, Port+2); // set Enable = bit 0 invertet
- udelay (1);
- outb (0x01, Port+2); // clear Enable
- udelay (delay);
+ {
+ while (len--) {
+ outb (*string++, Port); // put data on DB1..DB8
+ outb (0x00, Port+2); // set Enable = bit 0 invertet
+ udelay (1);
+ outb (0x01, Port+2); // clear Enable
+ udelay (delay);
+ }
}
-#ifdef WITH_PPDEV
- }
-#endif
}
+
static void HD_setGPO (int bits)
{
if (Lcd.gpos>0) {
#ifdef WITH_PPDEV
+
if (PPdev) {
// put data on DB1..DB8
@@ -287,25 +290,24 @@ static void HD_setGPO (int bits)
// toggle INIT
HD_toggle(PARPORT_CONTROL_INIT);
- } else {
-#endif
-
- outb (bits, Port); // put data on DB1..DB8
- outb (0x05, Port+2); // set INIT = bit 2 invertet
- udelay (1);
- outb (0x03, Port+2); // clear INIT
- udelay (1);
-
-#ifdef WITH_PPDEV
- }
+ } else
+
#endif
+
+ {
+ outb (bits, Port); // put data on DB1..DB8
+ outb (0x05, Port+2); // set INIT = bit 2 invertet
+ udelay (1);
+ outb (0x03, Port+2); // clear INIT
+ udelay (1);
+ }
}
}
static int HD_open (void)
{
-
#ifdef WITH_PPDEV
+
if (PPdev) {
debug ("using ppdev %s", PPdev);
PPfd=open(PPdev, O_RDWR);
@@ -313,7 +315,9 @@ static int HD_open (void)
error ("open(%s) failed: %s", PPdev, strerror(errno));
return -1;
}
+
#if 0
+ // FIXME: This doesn't work for some reason...
if (ioctl(PPfd, PPEXCL)) {
error ("ioctl(%s, PPEXCL) failed: %s", PPdev, strerror(errno));
return -1;
@@ -323,17 +327,18 @@ static int HD_open (void)
error ("ioctl(%s, PPCLAIM) failed: %s", PPdev, strerror(errno));
return -1;
}
- } else {
-#endif
- debug ("using raw port 0x%x", Port);
- if (ioperm(Port, 3, 1)!=0) {
- error ("HD44780: ioperm(0x%x) failed: %s", Port, strerror(errno));
- return -1;
- }
-#ifdef WITH_PPDEV
- }
+ } else
+
#endif
+ {
+ debug ("using raw port 0x%x", Port);
+ if (ioperm(Port, 3, 1)!=0) {
+ error ("HD44780: ioperm(0x%x) failed: %s", Port, strerror(errno));
+ return -1;
+ }
+ }
+
HD_command (0x30, 4100); // 8 Bit mode, wait 4.1 ms
HD_command (0x30, 100); // 8 Bit mode, wait 100 us
HD_command (0x30, 4100); // 8 Bit mode, wait 4.1 ms