aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-20 07:31:33 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-20 07:31:33 +0000
commit9288c604585993b787b4552b3f7f3f5ad1cd1c81 (patch)
treeab24bff16e3bfdfb0d3214d1f3ae2eac95d133aa
parent42fbc61ad0f0f9d165c19a0e8aa33b9d5f7f303b (diff)
downloadlcd4linux-9288c604585993b787b4552b3f7f3f5ad1cd1c81.tar.gz
[lcd4linux @ 2004-03-20 07:31:32 by reinelt]
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
-rw-r--r--drv_HD44780.c30
-rw-r--r--thread.c34
-rw-r--r--thread.h8
3 files changed, 46 insertions, 26 deletions
diff --git a/drv_HD44780.c b/drv_HD44780.c
index ba5c912..38c62a2 100644
--- a/drv_HD44780.c
+++ b/drv_HD44780.c
@@ -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
*
@@ -29,6 +29,10 @@
*
*
* $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
diff --git a/thread.c b/thread.c
index 86673ba..8e4e8e4 100644
--- 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, ...)
*
@@ -26,6 +26,10 @@
*
*
* $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;
}
diff --git a/thread.h b/thread.h
index 62a35d5..a15a9f3 100644
--- 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, ...)
*
@@ -26,6 +26,10 @@
*
*
* $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