]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2004-03-20 07:31:32 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 20 Mar 2004 07:31:33 +0000 (07:31 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 20 Mar 2004 07:31:33 +0000 (07:31 +0000)
support for HD66712 (which has a different RAM layout)
further threading development

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@405 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_HD44780.c
thread.c
thread.h

index ba5c91232fe2937e671be36cc1f41fd154bc521e..38c62a2c0ddb72779da61992aa2497866c220ac3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_HD44780.c,v 1.17 2004/03/19 09:17:46 reinelt Exp $
+/* $Id: drv_HD44780.c,v 1.18 2004/03/20 07:31:32 reinelt Exp $
  *
  * new style driver for HD44780-based displays
  *
  *
  *
  * $Log: drv_HD44780.c,v $
+ * Revision 1.18  2004/03/20 07:31:32  reinelt
+ * support for HD66712 (which has a different RAM layout)
+ * further threading development
+ *
  * Revision 1.17  2004/03/19 09:17:46  reinelt
  *
  * removed the extra 'goto' function, row and col are additional parameters
@@ -199,11 +203,13 @@ typedef struct {
 
 #define CAP_BRIGHTNESS (1<<0)
 #define CAP_BUSY4BIT   (1<<1)
+#define CAP_HD66712    (1<<2)
 
 static MODEL Models[] = {
   { 0x01, "generic",  0 },
   { 0x02, "Noritake", CAP_BRIGHTNESS },
   { 0x03, "Soekris",  CAP_BUSY4BIT },
+  { 0x04, "HD66712",  CAP_HD66712 },
   { 0xff, "Unknown",  0 }
 };
 
@@ -474,13 +480,17 @@ static void drv_HD_goto (int row, int col)
     col-=8;
   }
   
-  // 16x4 Displays use a slightly different layout
-  if (DCOLS==16 && DROWS==4) {
-    pos=(row%2)*64+(row/2)*16+col;
-  } else {  
-    pos=(row%2)*64+(row/2)*20+col;
+  if (Capabilities & CAP_HD66712) {
+    // the HD66712 doesn't have a braindamadged RAM layout
+    pos = row*32 + col;
+  } else {
+    // 16x4 Displays use a slightly different layout
+    if (DCOLS==16 && DROWS==4) {
+      pos = (row%2)*64+(row/2)*16+col;
+    } else {  
+      pos = (row%2)*64+(row/2)*20+col;
+    }
   }
-  
   drv_HD_command (currController, (0x80|pos), T_EXEC);
 }
 
@@ -664,6 +674,12 @@ static int drv_HD_start (char *section)
   drv_HD_command (allControllers, 0x0c, T_CLEAR); // Display on, cursor off, blink off, wait 1.64 ms
   drv_HD_command (allControllers, 0x06, T_EXEC);  // curser moves to right, no shift
 
+  if ((Capabilities & CAP_HD66712) && DROWS > 2) {
+    drv_HD_command (allControllers, Bits==8?0x3c:0x2c, T_EXEC); // set extended register enable bit
+    drv_HD_command (allControllers, 0x09,              T_EXEC); // set 4-line mode
+    drv_HD_command (allControllers, Bits==8?0x38:0x28, T_EXEC); // clear extended register enable bit
+  }
+
   drv_HD_command (allControllers, 0x01, T_CLEAR); // clear *both* displays
   drv_HD_command (allControllers, 0x03, T_CLEAR); // return home
   
index 86673ba0759ca61518edb37cd67e8a93e23064bf..8e4e8e49570b6562be54dad27f45690f5f0ff93b 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.1 2004/03/19 06:37:47 reinelt Exp $
+/* $Id: thread.c,v 1.2 2004/03/20 07:31:33 reinelt Exp $
  *
  * thread handling (mutex, shmem, ...)
  *
  *
  *
  * $Log: thread.c,v $
+ * Revision 1.2  2004/03/20 07:31:33  reinelt
+ * support for HD66712 (which has a different RAM layout)
+ * further threading development
+ *
  * Revision 1.1  2004/03/19 06:37:47  reinelt
  * asynchronous thread handling started
  *
@@ -142,28 +146,24 @@ void shm_destroy (int shmid)
 }
 
 
-int thread_create (void (*thread)(void))
+int thread_create (char *name, void (*thread)(char *name))
 {
-  /*
+  pid_t pid, ppid;
+
   ppid=getpid();
 
-  switch(async_updater_pid=fork()) {
+  switch (pid = fork()) {
   case -1:
-    error ("X11: fork() failed: %s", strerror(errno));
+    error ("fatal error: fork(%s) failed: %s", name, strerror(errno));
     return -1;
-
   case 0:
-    async_update();
-    error ("X11: async_update failed");
-    kill(ppid,SIGTERM);
-    exit(-1);
-    
+    info ("thread %s starting...", name);
+    thread(name);
+    info ("thread %s ended.", name);
+    exit (0);
   default:
-    break;
+    info ("forked process %d for thread %s", pid, name);
   }
-
-  signal(SIGCHLD,quit_updater);
-  atexit(quit_updater);
-  */
-  return 0;
+  
+  return pid;
 }
index 62a35d5a250ff4e03e64bd30a02f61a962cdd05b..a15a9f3aca1c478f34aff24356e7fc18dbc456cc 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -1,4 +1,4 @@
-/* $Id: thread.h,v 1.1 2004/03/19 06:37:47 reinelt Exp $
+/* $Id: thread.h,v 1.2 2004/03/20 07:31:33 reinelt Exp $
  *
  * thread handling (mutex, shmem, ...)
  *
  *
  *
  * $Log: thread.h,v $
+ * Revision 1.2  2004/03/20 07:31:33  reinelt
+ * support for HD66712 (which has a different RAM layout)
+ * further threading development
+ *
  * Revision 1.1  2004/03/19 06:37:47  reinelt
  * asynchronous thread handling started
  *
@@ -42,6 +46,6 @@ void mutex_destroy (int semid);
 int  shm_create    (void **buffer, int size);
 void shm_destroy   (int shmid);
 
-int thread_create (void (*thread)(void));
+int thread_create (char *name, void (*thread)(char *name));
 
 #endif