]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2006-08-13 06:46:51 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 13 Aug 2006 06:46:51 +0000 (06:46 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 13 Aug 2006 06:46:51 +0000 (06:46 +0000)
T6963 soft-timing & enhancements; indent

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

15 files changed:
drv_G15.c
drv_Image.c
drv_LEDMatrix.c
drv_M50530.c
drv_T6963.c
drv_USBHUB.c
drv_X11.c
drv_generic.c
drv_generic.h
drv_generic_graphic.c
drv_generic_i2c.h
lcd4linux.c
lcd4linux.conf.sample
udelay.c
widget_bar.h

index 53511e977c05fc09243494f9659fb4a4fc4532ae..13ef51d2186a8d6ea87c42fb844fc85bd0c5ff73 100644 (file)
--- a/drv_G15.c
+++ b/drv_G15.c
@@ -1,4 +1,4 @@
-/* $Id: drv_G15.c,v 1.9 2006/07/12 21:01:41 reinelt Exp $
+/* $Id: drv_G15.c,v 1.10 2006/08/13 06:46:51 reinelt Exp $
  *
  * Driver for Logitech G-15 keyboard LCD screen
  *
@@ -24,6 +24,9 @@
  *
  *
  * $Log: drv_G15.c,v $
+ * Revision 1.10  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.9  2006/07/12 21:01:41  reinelt
  * thread_destroy, minor cleanups
  *
@@ -422,8 +425,8 @@ static void drv_G15_blit(const int row, const int col, const int height, const i
 
     DEBUG("entered");
 
-    for (r = row; r < row + height && r < DROWS; r++) {
-       for (c = col; c < col + width && c < DCOLS; c++) {
+    for (r = row; r < row + height; r++) {
+       for (c = col; c < col + width; c++) {
            g15_image[r * 160 + c] = drv_generic_graphic_black(r, c);
        }
     }
@@ -539,7 +542,7 @@ int drv_G15_init(const char *section, const int quiet)
 {
     int ret;
 
-    info("%s: %s", Name, "$Revision: 1.9 $");
+    info("%s: %s", Name, "$Revision: 1.10 $");
 
     DEBUG("entered");
 
index d74f0434bc23e65b335e1a921ffed0f2d88d60a1..8518de80c0420dc82cb115b1d9024506cd86ecd2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_Image.c,v 1.18 2006/06/21 05:12:43 reinelt Exp $
+/* $Id: drv_Image.c,v 1.19 2006/08/13 06:46:51 reinelt Exp $
  *
  * new style Image (PPM/PNG) Driver for LCD4Linux 
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_Image.c,v $
+ * Revision 1.19  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.18  2006/06/21 05:12:43  reinelt
  * added checks for libgd version 2 (thanks to Sam)
  *
@@ -351,8 +354,8 @@ static void drv_IMG_blit(const int row, const int col, const int height, const i
 {
     int r, c;
 
-    for (r = row; r < row + height && r < DROWS; r++) {
-       for (c = col; c < col + width && c < DCOLS; c++) {
+    for (r = row; r < row + height; r++) {
+       for (c = col; c < col + width; c++) {
            RGBA p1 = drv_IMG_FB[r * DCOLS + c];
            RGBA p2 = drv_generic_graphic_rgb(r, c);
            if (p1.R != p2.R || p1.G != p2.G || p1.B != p2.B) {
@@ -489,7 +492,7 @@ int drv_IMG_init(const char *section, const __attribute__ ((unused))
 {
     int ret;
 
-    info("%s: %s", Name, "$Revision: 1.18 $");
+    info("%s: %s", Name, "$Revision: 1.19 $");
 
     /* real worker functions */
     drv_generic_graphic_real_blit = drv_IMG_blit;
index 7bd453ddf379d6a5bd5df08832578c29bac0c24e..34f9f480c383d1137bcef4b37ce6b5334ed8af26 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_LEDMatrix.c,v 1.3 2006/08/09 17:25:34 harbaum Exp $
+/* $Id: drv_LEDMatrix.c,v 1.4 2006/08/13 06:46:51 reinelt Exp $
  *
  * LED matrix driver for LCD4Linux 
  * (see http://www.harbaum.org/till/ledmatrix for hardware)
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_LEDMatrix.c,v $
+ * Revision 1.4  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.3  2006/08/09 17:25:34  harbaum
  * Better bar color support and new bold font
  *
@@ -64,7 +67,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/select.h>
-#include <netdb.h> 
+#include <netdb.h>
 
 #include "debug.h"
 #include "cfg.h"
 
 #define DSP_MEM (80 * 32 * 2 / 8)
 
-#define DEFAULT_X_OFFSET   1  // with a font width of 6
+#define DEFAULT_X_OFFSET   1   // with a font width of 6
 
 static char Name[] = "LEDMatrix";
 static char *IPAddress = NULL;
 static int sock = -1;
 static struct sockaddr_in dsp_addr;
-static unsigned char tx_buffer[DSP_MEM+1];
+static unsigned char tx_buffer[DSP_MEM + 1];
 static int port = DSP_DEFAULT_PORT;
 
 static void drv_LEDMatrix_blit(const int row, const int col, const int height, const int width)
@@ -108,21 +111,21 @@ static void drv_LEDMatrix_blit(const int row, const int col, const int height, c
 
            unsigned char color = 0;
            RGBA p = drv_generic_graphic_rgb(r, c);
-           if( p.G >= 128 ) color |= 0x80;
-           if( p.R >= 128 ) color |= 0x40;
+           if (p.G >= 128)
+               color |= 0x80;
+           if (p.R >= 128)
+               color |= 0x40;
            /* ignore blue ... */
 
-           tx_buffer[1 + 20*r + c/4] &=  ~(0xc0>>(2*(c&3)));
-           tx_buffer[1 + 20*r + c/4] |=   color>>(2*(c&3));
+           tx_buffer[1 + 20 * r + c / 4] &= ~(0xc0 >> (2 * (c & 3)));
+           tx_buffer[1 + 20 * r + c / 4] |= color >> (2 * (c & 3));
        }
     }
 
     // scan entire display
     tx_buffer[0] = DSP_CMD_IMAGE;
-    if((sendto(sock, tx_buffer, DSP_MEM+1, 0, 
-              (struct sockaddr *)&dsp_addr, 
-              sizeof(dsp_addr))) != DSP_MEM+1)
-      error("%s: sendto error on socket", Name);
+    if ((sendto(sock, tx_buffer, DSP_MEM + 1, 0, (struct sockaddr *) &dsp_addr, sizeof(dsp_addr))) != DSP_MEM + 1)
+       error("%s: sendto error on socket", Name);
 }
 
 static int drv_LEDMatrix_start(const char *section)
@@ -140,10 +143,10 @@ static int drv_LEDMatrix_start(const char *section)
     }
 
     if (cfg_number(section, "Port", 0, 0, 65535, &val) > 0) {
-        info("%s: port set to %d", Name, val);
-        port = val;
+       info("%s: port set to %d", Name, val);
+       port = val;
     } else {
-        info("%s: using default port", Name, port);
+       info("%s: using default port", Name, port);
     }
 
     /* display size is hard coded */
@@ -159,38 +162,39 @@ static int drv_LEDMatrix_start(const char *section)
 
     s = cfg_get(section, "fontstyle", NULL);
     if (s != NULL) {
-        if(strstr(s, "bold") != NULL) FONT_STYLE |= FONT_STYLE_BOLD;
+       if (strstr(s, "bold") != NULL)
+           FONT_STYLE |= FONT_STYLE_BOLD;
     }
 
     /* contact display */
     info("%s: contacting %s", Name, IPAddress);
 
     /* try to resolve as a hostname */
-    if((hp = gethostbyname(IPAddress)) == NULL) {
-        error("%s: unable to resolve hostname %s: %s", Name, IPAddress, strerror(errno));
+    if ((hp = gethostbyname(IPAddress)) == NULL) {
+       error("%s: unable to resolve hostname %s: %s", Name, IPAddress, strerror(errno));
        return -1;
     }
 
     /* open datagram socket */
-    if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-        error("%s: could not create socket: %s", Name, strerror(errno));
+    if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+       error("%s: could not create socket: %s", Name, strerror(errno));
        return -1;
-    } 
-    
+    }
+
     memset((char *) &dsp_addr, 0, sizeof(dsp_addr));
     dsp_addr.sin_family = AF_INET;
-    dsp_addr.sin_addr.s_addr = *(int*)hp->h_addr;
+    dsp_addr.sin_addr.s_addr = *(int *) hp->h_addr;
     dsp_addr.sin_port = htons(port);
-    
+
     cli_addr.sin_family = AF_INET;
     cli_addr.sin_addr.s_addr = htons(INADDR_ANY);
     cli_addr.sin_port = htons(port);
-    
+
     if (bind(sock, (struct sockaddr *) &cli_addr, sizeof(cli_addr)) < 0) {
-        error("%s: can't bind local address: %s", Name, strerror(errno));
+       error("%s: can't bind local address: %s", Name, strerror(errno));
        return -1;
     }
-    
+
     memset(tx_buffer, 0, sizeof(tx_buffer));
 
     return 0;
@@ -229,7 +233,7 @@ int drv_LEDMatrix_list(void)
 
 /* initialize driver & display */
 int drv_LEDMatrix_init(const char *section, const __attribute__ ((unused))
-                int quiet)
+                      int quiet)
 {
     WIDGET_CLASS wc;
     int ret;
@@ -270,14 +274,14 @@ int drv_LEDMatrix_init(const char *section, const __attribute__ ((unused))
 
 /* close driver & display */
 int drv_LEDMatrix_quit(const __attribute__ ((unused))
-                int quiet)
+                      int quiet)
 {
 
     info("%s: shutting down.", Name);
     drv_generic_graphic_quit();
 
-    if(sock != -1)
-        close(sock);
+    if (sock != -1)
+       close(sock);
 
     return (0);
 }
index fcf6d2517e9fb220458959889859327d5c021888..8387b6b40b7b77de6aca243cbe3b8d8d9d00e659 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_M50530.c,v 1.23 2006/08/11 11:59:29 reinelt Exp $
+/* $Id: drv_M50530.c,v 1.24 2006/08/13 06:46:51 reinelt Exp $
  *
  * new style driver for M50530-based displays
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_M50530.c,v $
+ * Revision 1.24  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.23  2006/08/11 11:59:29  reinelt
  * M50530 minor fixes
  *
@@ -208,10 +211,10 @@ static void drv_M5_busy(void)
 
     /* set data-lines to input */
     drv_generic_parport_direction(1);
-    
+
     /* clear I/OC1 and I/OC2, set R/W */
     drv_generic_parport_control(SIGNAL_IOC1 | SIGNAL_IOC2 | SIGNAL_RW, SIGNAL_RW);
-    
+
     /* Control data setup time */
     ndelay(T_SU);
 
@@ -223,19 +226,19 @@ static void drv_M5_busy(void)
 
        /* data output delay time */
        ndelay(T_D);
-       
+
        /* read the busy flag */
        data = drv_generic_parport_read();
 
        /* lower enable */
        /* as T_D is larger than T_W, we don't need to delay again */
        drv_generic_parport_control(SIGNAL_EX, 0);
-       
+
        if ((data & busymask) == 0) {
            errors = 0;
            break;
        }
-       
+
        /* make sure we don't wait forever
         * - but only check after 5 iterations
         * that way, we won't slow down normal mode
@@ -273,7 +276,7 @@ static void drv_M5_busy(void)
     drv_generic_parport_control(SIGNAL_RW, 0);
 
     /* honour data hold time */
-    ndelay (T_H);
+    ndelay(T_H);
 
     /* set data-lines to output */
     drv_generic_parport_direction(0);
@@ -304,7 +307,7 @@ static void drv_M5_command(const unsigned int cmd, const int delay)
 
     if (UseBusy) {
        /* honour data hold time */
-       ndelay (T_H);
+       ndelay(T_H);
     } else {
        /* wait for command completion */
        udelay(delay);
@@ -498,10 +501,10 @@ static int drv_M5_start(const char *section, const int quiet)
      * modification from the config file.
      */
 
-    T_SU = timing(Name, section, "SU", 200, "ns"); /* control data setup time */
-    T_W = timing(Name, section, "W", 500, "ns"); /* EX signal pulse width */
-    T_D = timing(Name, section, "D", 300, "ns"); /* Data output delay time */
-    T_H = timing(Name, section, "H", 100, "ns"); /* Data hold time */
+    T_SU = timing(Name, section, "SU", 200, "ns");     /* control data setup time */
+    T_W = timing(Name, section, "W", 500, "ns");       /* EX signal pulse width */
+    T_D = timing(Name, section, "D", 300, "ns");       /* Data output delay time */
+    T_H = timing(Name, section, "H", 100, "ns");       /* Data hold time */
 
     /* GPO timing */
     if (SIGNAL_GPO != 0) {
@@ -517,9 +520,9 @@ static int drv_M5_start(const char *section, const int quiet)
      * modification from the config file.
      */
 
-    T_EXEC = timing(Name, section, "EXEC", 20, "us"); /* normal execution time */
-    T_CLEAR = timing(Name, section, "CLEAR", 1250, "us"); /* 'clear display' execution time */
-    T_INIT = timing(Name, section, "INIT", 2000, "us"); /* mysterious initialization time */
+    T_EXEC = timing(Name, section, "EXEC", 20, "us");  /* normal execution time */
+    T_CLEAR = timing(Name, section, "CLEAR", 1250, "us");      /* 'clear display' execution time */
+    T_INIT = timing(Name, section, "INIT", 2000, "us");        /* mysterious initialization time */
 
 
     /* maybe use busy-flag from now on  */
@@ -688,7 +691,7 @@ int drv_M5_init(const char *section, const int quiet)
     WIDGET_CLASS wc;
     int ret;
 
-    info("%s: %s", Name, "$Revision: 1.23 $");
+    info("%s: %s", Name, "$Revision: 1.24 $");
 
     /* display preferences */
     XRES = -1;                 /* pixel width of one char  */
index a77be5a1af88272c03b5ffd68a2a885fb6b4bd45..9ca4c54bb93788bf4ceba604824b3a2c7a940a8c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_T6963.c,v 1.20 2006/02/27 06:14:46 reinelt Exp $
+/* $Id: drv_T6963.c,v 1.21 2006/08/13 06:46:51 reinelt Exp $
  *
  * new style driver for T6963-based displays
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_T6963.c,v $
+ * Revision 1.21  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.20  2006/02/27 06:14:46  reinelt
  * graphic bug resulting in all black pixels solved
  *
@@ -147,6 +150,10 @@ static MODEL Models[] = {
 };
 
 
+/* Timings */
+static int T_ACC, T_OH, T_PW, T_DH, T_CDS;
+
+/* soft-wiring */
 static unsigned char SIGNAL_CE;
 static unsigned char SIGNAL_CD;
 static unsigned char SIGNAL_RD;
@@ -172,8 +179,8 @@ static void drv_T6_status1(void)
     /* lower CE and RD */
     drv_generic_parport_control(SIGNAL_CE | SIGNAL_RD, 0);
 
-    /* Access Time: 150 ns  */
-    ndelay(150);
+    /* Access Time */
+    ndelay(T_ACC);
 
     /* wait for STA0=1 and STA1=1 */
     n = 0;
@@ -189,8 +196,8 @@ static void drv_T6_status1(void)
     /* rise RD and CE */
     drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, SIGNAL_RD | SIGNAL_CE);
 
-    /* Output Hold Time: 50 ns  */
-    ndelay(50);
+    /* Output Hold Time */
+    ndelay(T_OH);
 
     /* turn on data line drivers */
     drv_generic_parport_direction(0);
@@ -208,8 +215,8 @@ static void drv_T6_status2(void)
     /* lower RD and CE */
     drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, 0);
 
-    /* Access Time: 150 ns  */
-    ndelay(150);
+    /* Access Time */
+    ndelay(T_ACC);
 
     /* wait for STA3=1 */
     n = 0;
@@ -225,8 +232,8 @@ static void drv_T6_status2(void)
     /* rise RD and CE */
     drv_generic_parport_control(SIGNAL_RD | SIGNAL_CE, SIGNAL_RD | SIGNAL_CE);
 
-    /* Output Hold Time: 50 ns  */
-    ndelay(50);
+    /* Output Hold Time */
+    ndelay(T_OH);
 
     /* turn on data line drivers */
     drv_generic_parport_direction(0);
@@ -245,13 +252,13 @@ static void drv_T6_write_cmd(const unsigned char cmd)
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
 
     /* Pulse width */
-    ndelay(80);
+    ndelay(T_PW);
 
     /* rise WR and CE */
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
 
     /* Data Hold Time */
-    ndelay(40);
+    ndelay(T_DH);
 }
 
 
@@ -267,19 +274,19 @@ static void drv_T6_write_data(const unsigned char data)
     drv_generic_parport_control(SIGNAL_CD, 0);
 
     /* C/D Setup Time */
-    ndelay(20);
+    ndelay(T_CDS);
 
     /* lower WR and CE */
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
 
     /* Pulse Width */
-    ndelay(80);
+    ndelay(T_PW);
 
     /* rise WR and CE */
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
 
     /* Data Hold Time */
-    ndelay(40);
+    ndelay(T_DH);
 
     /* rise CD */
     drv_generic_parport_control(SIGNAL_CD, SIGNAL_CD);
@@ -298,19 +305,19 @@ static void drv_T6_write_auto(const unsigned char data)
     drv_generic_parport_control(SIGNAL_CD, 0);
 
     /* C/D Setup Time */
-    ndelay(20);
+    ndelay(T_CDS);
 
     /* lower WR and CE */
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, 0);
 
     /* Pulse Width */
-    ndelay(80);
+    ndelay(T_PW);
 
     /* rise WR and CE */
     drv_generic_parport_control(SIGNAL_WR | SIGNAL_CE, SIGNAL_WR | SIGNAL_CE);
 
     /* Data Hold Time */
-    ndelay(40);
+    ndelay(T_DH);
 
     /* rise CD */
     drv_generic_parport_control(SIGNAL_CD, SIGNAL_CD);
@@ -470,23 +477,17 @@ static int drv_T6_start(const char *section)
        return -1;
     }
 
-    s = cfg_get(section, "Font", "6x8");
-    if (s == NULL || *s == '\0') {
-       error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+    if (sscanf(s = cfg_get(section, "font", "6x8"), "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+       error("%s: bad %s.Font '%s' from %s", Name, section, s, cfg_source());
+       free(s);
        return -1;
     }
+    free(s);
 
-    XRES = -1;
-    YRES = -1;
-    if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
-       error("%s: bad Font '%s' from %s", Name, s, cfg_source());
-       return -1;
-    }
-
-    /* Fixme: provider other fonts someday... */
-    if (XRES != 6 && YRES != 8) {
-       error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
-       return -1;
+    s = cfg_get(section, "fontstyle", NULL);
+    if (s != NULL) {
+       if (strstr(s, "bold") != NULL)
+           FONT_STYLE |= FONT_STYLE_BOLD;
     }
 
     TROWS = DROWS / YRES;      /* text rows */
@@ -498,7 +499,6 @@ static int drv_T6_start(const char *section)
        return -1;
     }
 
-    debug("malloc buffer 2 (%d*%d)=%d", TCOLS, DROWS, TCOLS * DROWS);
     Buffer2 = malloc(TCOLS * DROWS);
     if (Buffer2 == NULL) {
        error("%s: framebuffer #2 could not be allocated: malloc() failed", Name);
@@ -513,6 +513,7 @@ static int drv_T6_start(const char *section)
        return -1;
     }
 
+    /* soft-wiring */
     if ((SIGNAL_CE = drv_generic_parport_wire_ctrl("CE", "STROBE")) == 0xff)
        return -1;
     if ((SIGNAL_CD = drv_generic_parport_wire_ctrl("CD", "SLCTIN")) == 0xff)
@@ -522,6 +523,14 @@ static int drv_T6_start(const char *section)
     if ((SIGNAL_WR = drv_generic_parport_wire_ctrl("WR", "INIT")) == 0xff)
        return -1;
 
+    /* timings */
+    T_ACC = timing(Name, section, "ACC", 150, "ns");   /* Access Time */
+    T_OH = timing(Name, section, "OH", 50, "ns");      /* Output Hold Time */
+    T_PW = timing(Name, section, "PW", 80, "ns");      /* CE, RD, WR Pulse Width */
+    T_DH = timing(Name, section, "DH", 40, "ns");      /* Data Hold Time */
+    T_CDS = timing(Name, section, "CDS", 100, "ns");   /* C/D Setup Time */
+
+
     /* rise CE, CD, RD and WR */
     drv_generic_parport_control(SIGNAL_CE | SIGNAL_CD | SIGNAL_RD | SIGNAL_WR,
                                SIGNAL_CE | SIGNAL_CD | SIGNAL_RD | SIGNAL_WR);
@@ -591,7 +600,7 @@ int drv_T6_init(const char *section, const int quiet)
 {
     int ret;
 
-    info("%s: %s", Name, "$Revision: 1.20 $");
+    info("%s: %s", Name, "$Revision: 1.21 $");
 
     /* real worker functions */
     drv_generic_graphic_real_blit = drv_T6_blit;
index 871850ac4d1ac93f102152729dbdb76922984213..55e80ca9960cb81573685a99fcdb944a098a0551 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_USBHUB.c,v 1.1 2006/08/08 19:35:22 reinelt Exp $
+/* $Id: drv_USBHUB.c,v 1.2 2006/08/13 06:46:51 reinelt Exp $
  *
  * new style driver for USBLCD displays
  *
@@ -25,6 +25,9 @@
  *
  *
  * $Log: drv_USBHUB.c,v $
+ * Revision 1.2  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.1  2006/08/08 19:35:22  reinelt
  * USBHUB driver from Ernst Bachmann
  *
@@ -67,15 +70,15 @@ static char Name[] = "USBHUB";
  * no Vendor/Product specified in config.
  */
 
-static int hubVendor=0x0409;
-static int hubProduct=0x0058;
+static int hubVendor = 0x0409;
+static int hubProduct = 0x0058;
 
-static usb_dev_handle *hub=NULL;
+static usb_dev_handle *hub = NULL;
 
 typedef struct _usb_hub_descriptor {
-    u_int8_t  bLength;
-    u_int8_t  bDescriptorType;
-    u_int8_t  nNbrPorts;
+    u_int8_t bLength;
+    u_int8_t bDescriptorType;
+    u_int8_t nNbrPorts;
     u_int8_t wHubCharacteristicLow;
     u_int8_t wHubCharacteristicHigh;
     u_int8_t bPwrOn2PwrGood;
@@ -96,7 +99,7 @@ static int drv_UH_open(void)
 
     hub = NULL;
 
-    info("%s: scanning for an USB HUB (0x%04x:0x%04x)...", Name,hubVendor,hubProduct);
+    info("%s: scanning for an USB HUB (0x%04x:0x%04x)...", Name, hubVendor, hubProduct);
 
     usb_init();
     usb_find_busses();
@@ -105,18 +108,17 @@ static int drv_UH_open(void)
 
     for (bus = busses; bus; bus = bus->next) {
        for (dev = bus->devices; dev; dev = dev->next) {
-           if ((dev->descriptor.idVendor == hubVendor) &&
-               (dev->descriptor.idProduct == hubProduct)) {
+           if ((dev->descriptor.idVendor == hubVendor) && (dev->descriptor.idProduct == hubProduct)) {
 
                unsigned int v = dev->descriptor.bcdDevice;
 
                info("%s: found USBHUB V%1d%1d.%1d%1d on bus %s device %s", Name,
                     (v & 0xF000) >> 12, (v & 0xF00) >> 8, (v & 0xF0) >> 4, (v & 0xF), bus->dirname, dev->filename);
 
-               if (dev->descriptor.bDeviceClass != USB_CLASS_HUB) {
-                   error("%s: the specified device claims to be no HUB");
-                  return -1;
-               }
+               if (dev->descriptor.bDeviceClass != USB_CLASS_HUB) {
+                   error("%s: the specified device claims to be no HUB");
+                   return -1;
+               }
 
                hub = usb_open(dev);
                if (!hub) {
@@ -154,82 +156,83 @@ static int drv_UH_close(void)
  *
  */
 
-static int drv_UH_set(const int num, const int val) {
-  int ret;
+static int drv_UH_set(const int num, const int val)
+{
+    int ret;
 
-  if (!hub)
-    return -1;
+    if (!hub)
+       return -1;
 
-  if (val <0 || val > 3) {
-    info("%s: value %d out of range (0..3)",Name,val);
-    return -1;
-  }
+    if (val < 0 || val > 3) {
+       info("%s: value %d out of range (0..3)", Name, val);
+       return -1;
+    }
 
-  if((ret=usb_control_msg(hub,
-                         HUB_CONTROL_PORT,
-                          HUB_SET_FEATURE,
-                         HUB_SET_INDICATOR, (val << 8) | (num+1), NULL, 0, 1000)) != 0) {
-    info("%s: usb_control_msg failed with %d",Name,ret);
-    return -1;
-  }
+    if ((ret = usb_control_msg(hub,
+                              HUB_CONTROL_PORT,
+                              HUB_SET_FEATURE, HUB_SET_INDICATOR, (val << 8) | (num + 1), NULL, 0, 1000)) != 0) {
+       info("%s: usb_control_msg failed with %d", Name, ret);
+       return -1;
+    }
 
-  return 0;
+    return 0;
 }
 
 
 static int drv_UH_start(const char *section, const int quiet)
-{ 
-    char * buf;
+{
+    char *buf;
 
     usb_hub_descriptor hub_desc;
     int ret;
 
 
-    buf=cfg_get(section,"Vendor",NULL);
+    buf = cfg_get(section, "Vendor", NULL);
     if (buf) {
-      if (!*buf) {
-         error("%s: Strange Vendor Specification");
-         return -1;
-      }
-      if (sscanf(buf,"0x%x",&hubVendor) != 1) {
-         error("%s: Strange Vendor Specification: [%s]",buf);
-         return -1;
-      }
+       if (!*buf) {
+           error("%s: Strange Vendor Specification");
+           return -1;
+       }
+       if (sscanf(buf, "0x%x", &hubVendor) != 1) {
+           error("%s: Strange Vendor Specification: [%s]", buf);
+           return -1;
+       }
     }
 
-    buf=cfg_get(section,"Product",NULL);
+    buf = cfg_get(section, "Product", NULL);
     if (buf) {
-      if (!*buf) {
-         error("%s: Strange Product Specification");
-         return -1;
-      }
-      if (sscanf(buf,"0x%x",&hubProduct) != 1) {
-         error("%s: Strange Product Specification: [%s]",buf);
-         return -1;
-      }
+       if (!*buf) {
+           error("%s: Strange Product Specification");
+           return -1;
+       }
+       if (sscanf(buf, "0x%x", &hubProduct) != 1) {
+           error("%s: Strange Product Specification: [%s]", buf);
+           return -1;
+       }
     }
 
     if (drv_UH_open() < 0) {
-        return -1;
+       return -1;
     }
 
 
-    if ((ret=usb_control_msg(hub, 
-                       USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE,
-                       USB_REQ_GET_DESCRIPTOR,USB_DT_HUB << 8,0,(char *)&hub_desc,sizeof(hub_desc),1000)) <= 8) {
-      error("%s: hub_get_descriptor failed with %d",Name,ret);
-      drv_UH_close();
-      return -1;
+    if ((ret = usb_control_msg(hub,
+                              USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE,
+                              USB_REQ_GET_DESCRIPTOR, USB_DT_HUB << 8, 0, (char *) &hub_desc, sizeof(hub_desc),
+                              1000)) <= 8) {
+       error("%s: hub_get_descriptor failed with %d", Name, ret);
+       drv_UH_close();
+       return -1;
     }
-    GPOS=hub_desc.nNbrPorts;
-    debug("%s: HUB claims to have %d ports. Configuring them as GPOs",Name,GPOS);
+    GPOS = hub_desc.nNbrPorts;
+    debug("%s: HUB claims to have %d ports. Configuring them as GPOs", Name, GPOS);
     if (!(hub_desc.wHubCharacteristicLow & 0x80)) {
-      error("%s: HUB claims to have no Indicator LEDs (Characteristics 0x%04x). Bailing out.",Name,
-          (hub_desc.wHubCharacteristicHigh << 8) | hub_desc.wHubCharacteristicLow); 
-     /* The HUB Tells us that there are no LEDs to control. Breaking? Maybe don't trust it and continue anyways? */
-     drv_UH_close();
-     return -1;
-     
+       error("%s: HUB claims to have no Indicator LEDs (Characteristics 0x%04x). Bailing out.", Name,
+             (hub_desc.wHubCharacteristicHigh << 8) | hub_desc.wHubCharacteristicLow);
+       /* The HUB Tells us that there are no LEDs to control. Breaking? Maybe don't trust it and continue anyways? */
+       drv_UH_close();
+       return -1;
+
     }
 
     return 0;
@@ -272,7 +275,7 @@ int drv_UH_init(const char *section, const int quiet)
     int ret;
     int i;
 
-    info("%s: %s", Name, "$Revision: 1.1 $");
+    info("%s: %s", Name, "$Revision: 1.2 $");
 
 
 
@@ -282,7 +285,7 @@ int drv_UH_init(const char *section, const int quiet)
 
 
     /* real worker functions */
-    drv_generic_gpio_real_set=drv_UH_set;
+    drv_generic_gpio_real_set = drv_UH_set;
 
 
     /* initialize generic GPIO driver */
@@ -296,14 +299,14 @@ int drv_UH_init(const char *section, const int quiet)
 
     /* greeting */
     if (!quiet) {
-      /* Light all LEDS green for a greeting */
-      for (i=0; i < GPOS; ++i) {
-         drv_UH_set(i,2);
-      }
-      sleep(1);
-      for (i=0; i < GPOS; ++i) {
-         drv_UH_set(i,3); // OFF
-      }
+       /* Light all LEDS green for a greeting */
+       for (i = 0; i < GPOS; ++i) {
+           drv_UH_set(i, 2);
+       }
+       sleep(1);
+       for (i = 0; i < GPOS; ++i) {
+           drv_UH_set(i, 3);   // OFF
+       }
     }
 
 
@@ -319,11 +322,11 @@ int drv_UH_quit(const int quiet)
 
     /* say goodbye... */
     if (!quiet) {
-      /* Light all LEDS amber for a goodbye */
-      for (i=0; i < GPOS; ++i) {
-         drv_UH_set(i,1);
-      }
-      sleep(1);
+       /* Light all LEDS amber for a goodbye */
+       for (i = 0; i < GPOS; ++i) {
+           drv_UH_set(i, 1);
+       }
+       sleep(1);
 
     }
 
index 82e94920158b50c20bd86b6f1d70804a365d0c64..99ba6bb78db734ade6958dd0b06104523f84c3fa 100644 (file)
--- a/drv_X11.c
+++ b/drv_X11.c
@@ -1,4 +1,4 @@
-/* $Id: drv_X11.c,v 1.16 2006/02/08 04:55:05 reinelt Exp $
+/* $Id: drv_X11.c,v 1.17 2006/08/13 06:46:51 reinelt Exp $
  *
  * new style X11 Driver for LCD4Linux 
  *
@@ -26,6 +26,9 @@
  *
  *
  * $Log: drv_X11.c,v $
+ * Revision 1.17  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.16  2006/02/08 04:55:05  reinelt
  * moved widget registration to drv_generic_graphic
  *
@@ -167,9 +170,9 @@ static void drv_X11_blit(const int row, const int col, const int height, const i
     int r, c;
     int dirty = 0;
 
-    for (r = row; r < row + height && r < DROWS; r++) {
+    for (r = row; r < row + height; r++) {
        int y = border + (r / YRES) * rgap + r * (pixel + pgap);
-       for (c = col; c < col + width && c < DCOLS; c++) {
+       for (c = col; c < col + width; c++) {
            int x = border + (c / XRES) * cgap + c * (pixel + pgap);
            RGBA p1 = drv_X11_FB[r * DCOLS + c];
            RGBA p2 = drv_generic_graphic_rgb(r, c);
@@ -375,7 +378,7 @@ int drv_X11_init(const char *section, const int quiet)
 {
     int ret;
 
-    info("%s: %s", Name, "$Revision: 1.16 $");
+    info("%s: %s", Name, "$Revision: 1.17 $");
 
     /* start display */
     if ((ret = drv_X11_start(section)) != 0)
index 1a873a835d6ee395bcaf8ff392f3404b619904ac..fb3691127c788b2ce6437129bdc12bffd3a938db 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic.c,v 1.5 2006/08/09 17:25:34 harbaum Exp $
+/* $Id: drv_generic.c,v 1.6 2006/08/13 06:46:51 reinelt Exp $
  *
  * generic driver helper
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_generic.c,v $
+ * Revision 1.6  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.5  2006/08/09 17:25:34  harbaum
  * Better bar color support and new bold font
  *
@@ -66,7 +69,7 @@ int DCOLS = 20;                       /* display size: columns */
 int XRES = 6;                  /* pixel widtht of one char */
 int YRES = 8;                  /* pixel height of one char */
 
-int FONT_STYLE = 0;             /* font style (default = plain) */
+int FONT_STYLE = 0;            /* font style (default = plain) */
 
 void (*drv_generic_blit) () = NULL;
 
index 43c32a08d24b13f57df0fb21b112b905eb72e018..ee344522c50d98b66f7e364e31b83d42aa0df072 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic.h,v 1.5 2006/08/09 17:25:34 harbaum Exp $
+/* $Id: drv_generic.h,v 1.6 2006/08/13 06:46:51 reinelt Exp $
  *
  * generic driver helper
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_generic.h,v $
+ * Revision 1.6  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.5  2006/08/09 17:25:34  harbaum
  * Better bar color support and new bold font
  *
@@ -44,7 +47,7 @@ extern int LROWS, LCOLS;      /* layout size */
 extern int DROWS, DCOLS;       /* display size */
 
 extern int XRES, YRES;         /* pixel width/height of one char */
-extern int FONT_STYLE;          /* font style */
+extern int FONT_STYLE;         /* font style */
 
 /* these function must be implemented by the generic driver */
 extern void (*drv_generic_blit) (const int row, const int col, const int height, const int width);
index ea0d2d3d551bb3c8ebf0772605537baff6bbb542..816f716d4e367a228bfc70c58a2115ddb57a5485 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_graphic.c,v 1.31 2006/08/09 17:25:34 harbaum Exp $
+/* $Id: drv_generic_graphic.c,v 1.32 2006/08/13 06:46:51 reinelt Exp $
  *
  * generic driver helper for graphic displays
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: drv_generic_graphic.c,v $
+ * Revision 1.32  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.31  2006/08/09 17:25:34  harbaum
  * Better bar color support and new bold font
  *
@@ -251,16 +254,42 @@ static void drv_generic_graphic_resizeFB(int rows, int cols)
 
     LCOLS = cols;
     LROWS = rows;
+
 }
 
+static void drv_generic_graphic_window(int pos, int size, int max, int *wpos, int *wsize)
+{
+    int p1 = pos;
+    int p2 = pos + size;
+
+    *wpos = 0;
+    *wsize = 0;
+
+    if (p1 > max || p2 < 0 || size < 1)
+       return;
+
+    if (p1 < 0)
+       p1 = 0;
+
+    if (p2 > max)
+       p2 = max;
+
+    *wpos = p1;
+    *wsize = p2 - p1;
+}
 
 static void drv_generic_graphic_blit(const int row, const int col, const int height, const int width)
 {
-    if (drv_generic_graphic_real_blit)
-       drv_generic_graphic_real_blit(row, col, height, width);
+    if (drv_generic_graphic_real_blit) {
+       int r, c, h, w;
+       drv_generic_graphic_window(row, height, DROWS, &r, &h);
+       drv_generic_graphic_window(col, width, DCOLS, &c, &w);
+       if (h > 0 && w > 0) {
+           drv_generic_graphic_real_blit(r, c, h, w);
+       }
+    }
 }
 
-
 static RGBA drv_generic_graphic_blend(const int row, const int col)
 {
     int l;
@@ -314,9 +343,9 @@ static void drv_generic_graphic_render(const int layer, const int row, const int
 
     /* render text into layout FB */
     while (*txt != '\0') {
-        unsigned char *chr;
+       unsigned char *chr;
 
-        if( FONT_STYLE & FONT_STYLE_BOLD )
+       if (FONT_STYLE & FONT_STYLE_BOLD)
            chr = Font_6x8_bold[(int) *txt];
        else
            chr = Font_6x8[(int) *txt];
@@ -535,7 +564,7 @@ int drv_generic_graphic_bar_draw(WIDGET * W)
        for (y = 0; y < YRES; y++) {
            int val = y < YRES / 2 ? val1 : val2;
            RGBA bcol = y < YRES / 2 ? bar[0] : bar[1];
-           
+
            for (x = 0; x < max; x++) {
                if (x < val)
                    drv_generic_graphic_FB[layer][(row + y) * LCOLS + col + x] = rev ? bg : bcol;
index 579fcbe7135023e7266ead9ab51eaeb9f4b9eb53..543da042af4e11e11b4537492537e516743eed91 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_i2c.h,v 1.7 2006/07/31 03:48:09 reinelt Exp $\r
+/* $Id: drv_generic_i2c.h,v 1.8 2006/08/13 06:46:51 reinelt Exp $\r
  *\r
  * generic driver helper for i2c displays\r
  *\r
@@ -23,6 +23,9 @@
  *\r
  *\r
  * $Log: drv_generic_i2c.h,v $
+ * Revision 1.8  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.7  2006/07/31 03:48:09  reinelt
  * preparations for scrolling
  *\r
@@ -85,4 +88,4 @@
 \rvoid drv_generic_i2c_data(const unsigned char data);
 \rvoid drv_generic_i2c_command(const unsigned char command, const unsigned char *data, const unsigned char length);
 \r\r
-#endif /* \r */
+#endif                         /* \r */
index 3cbb583390dd7bac944bb06acb1fb718c028a8db..1e33e7cef371b3c87f228e4a21d15feebe543e8f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.80 2006/01/23 06:17:18 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.81 2006/08/13 06:46:51 reinelt Exp $
  *
  * LCD4Linux
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: lcd4linux.c,v $
+ * Revision 1.81  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.80  2006/01/23 06:17:18  reinelt
  * timer widget added
  *
@@ -681,6 +684,7 @@ int main(int argc, char *argv[])
 
     debug("starting main loop");
 
+
     /* now install our own signal handler */
     signal(SIGHUP, handler);
     signal(SIGINT, handler);
index 7bb79194432ca9ef533620a6a8333fb3000866eb..17e88fa8b82c27b2e1e81b657acc7f40db5399f1 100644 (file)
@@ -357,6 +357,8 @@ Display T6963-240x64 {
     Driver 'T6963'
     Port '/dev/parports/0'
     Size '240x64'
+    Font '6x8'
+    FontStyle 'bold'
     Wire.CE 'STROBE'
     Wire.CD 'SLCTIN'
     Wire.RD 'AUTOFD'
@@ -810,7 +812,7 @@ Widget Test {
 Widget Test1 {
     class 'Text'
     expression 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
-    width 20
+    width 80
     align 'M'
     speed 100
 }
@@ -818,7 +820,7 @@ Widget Test1 {
 Widget Test2 {
     class 'Text'
     expression '1234567890abcdefghijklmnopqrstuvwxyz'
-    width 20
+    width 80
     align 'M'
     speed 150
 }
@@ -1045,6 +1047,12 @@ Layout testMySQL {
        }
 }
 
+Layout Debug {
+    #Row09.Col1 'Test'
+    Row09.Col1 'Heartbeat'
+}
+
+
 
 #Display 'SerDispLib'
 #Display 'LCD-Linux'
@@ -1063,12 +1071,12 @@ Layout testMySQL {
 #Display 'CF632'
 #Display 'CF633'
 #Display 'Curses'
-Display 'M50530-24x8'
+#Display 'M50530-24x8'
 #Display 'LCDTerm'
 #Display 'SimpleLCD'
 #Display 'BA63'
 #Display 'CT20x4'
-#Display 'T6963-240x64'
+Display 'T6963-240x64'
 #Display 'XWindow'
 #Display 'USBLCD'
 #Display 'BWCT'
@@ -1090,5 +1098,5 @@ Layout 'Default'
 #Layout 'Test'
 #Layout 'Test2'
 #Layout 'TestGPO'
-
+#Layout 'Debug'
 
index 14ccee9146472cfcc4f76eacd7a319df9d2df163..b30507da42ab3772594d1f4e499ab6687431e732 100644 (file)
--- a/udelay.c
+++ b/udelay.c
@@ -1,4 +1,4 @@
-/* $Id: udelay.c,v 1.22 2006/08/10 19:06:52 reinelt Exp $
+/* $Id: udelay.c,v 1.23 2006/08/13 06:46:51 reinelt Exp $
  *
  * short delays
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: udelay.c,v $
+ * Revision 1.23  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.22  2006/08/10 19:06:52  reinelt
  * new 'fuzz' parameter for timings
  *
@@ -244,7 +247,7 @@ unsigned long timing(const char *driver, const char *section, const char *name,
 
     cfg_number(sec, name, defval, 0, -1, &val);
     val = val * fuzz / 100;
-    
+
     if (val != defval) {
        if (fuzz != 100) {
            info("%s: timing: %6s = %5d %s (default %d %s, fuzz %d)", driver, name, val, unit, defval, unit, fuzz);
index 81d4b58c0019cadb84f8c3ff9101b274a6840a4e..11fa9f86d43fc76c36ccc93f608020289e01c91c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: widget_bar.h,v 1.9 2006/08/09 17:25:34 harbaum Exp $
+/* $Id: widget_bar.h,v 1.10 2006/08/13 06:46:51 reinelt Exp $
  *
  * bar widget handling
  *
@@ -23,6 +23,9 @@
  *
  *
  * $Log: widget_bar.h,v $
+ * Revision 1.10  2006/08/13 06:46:51  reinelt
+ * T6963 soft-timing & enhancements; indent
+ *
  * Revision 1.9  2006/08/09 17:25:34  harbaum
  * Better bar color support and new bold font
  *
@@ -84,8 +87,8 @@ typedef struct WIDGET_BAR {
     double val2;               /* bar value, 0.0 ... 1.0 */
     double min;                        /* minimum value */
     double max;                        /* maximum value */
-    RGBA color[2];              /* bar colors */
-    int color_valid[2];         /* bar color is valid */
+    RGBA color[2];             /* bar colors */
+    int color_valid[2];                /* bar color is valid */
 } WIDGET_BAR;