aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <>2006-08-13 06:46:51 +0000
committerreinelt <>2006-08-13 06:46:51 +0000
commitd3e904dd6fcaf98d8163c3584eba575e179d3ac4 (patch)
tree884ac9ec162cce83712ba2ea8d921f90e04b9307
parente2fbd64db36bc3da8e53d8e04ce1a13e269083dd (diff)
downloadlcd4linux-d3e904dd6fcaf98d8163c3584eba575e179d3ac4.tar.gz
[lcd4linux @ 2006-08-13 06:46:51 by reinelt]
T6963 soft-timing & enhancements; indent
-rw-r--r--drv_G15.c11
-rw-r--r--drv_Image.c11
-rw-r--r--drv_LEDMatrix.c66
-rw-r--r--drv_M50530.c35
-rw-r--r--drv_T6963.c75
-rw-r--r--drv_USBHUB.c163
-rw-r--r--drv_X11.c11
-rw-r--r--drv_generic.c7
-rw-r--r--drv_generic.h7
-rw-r--r--drv_generic_graphic.c43
-rw-r--r--drv_generic_i2c.h7
-rw-r--r--lcd4linux.c6
-rw-r--r--lcd4linux.conf.sample18
-rw-r--r--udelay.c7
-rw-r--r--widget_bar.h9
15 files changed, 280 insertions, 196 deletions
diff --git a/drv_G15.c b/drv_G15.c
index 53511e9..13ef51d 100644
--- 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");
diff --git a/drv_Image.c b/drv_Image.c
index d74f043..8518de8 100644
--- a/drv_Image.c
+++ b/drv_Image.c
@@ -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;
diff --git a/drv_LEDMatrix.c b/drv_LEDMatrix.c
index 7bd453d..34f9f48 100644
--- a/drv_LEDMatrix.c
+++ b/drv_LEDMatrix.c
@@ -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"
@@ -89,13 +92,13 @@
#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);
}
diff --git a/drv_M50530.c b/drv_M50530.c
index fcf6d25..8387b6b 100644
--- a/drv_M50530.c
+++ b/drv_M50530.c
@@ -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 */
diff --git a/drv_T6963.c b/drv_T6963.c
index a77be5a..9ca4c54 100644
--- a/drv_T6963.c
+++ b/drv_T6963.c
@@ -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;
diff --git a/drv_USBHUB.c b/drv_USBHUB.c
index 871850a..55e80ca 100644
--- a/drv_USBHUB.c
+++ b/drv_USBHUB.c
@@ -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);
}
diff --git a/drv_X11.c b/drv_X11.c
index 82e9492..99ba6bb 100644
--- 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)
diff --git a/drv_generic.c b/drv_generic.c
index 1a873a8..fb36911 100644
--- a/drv_generic.c
+++ b/drv_generic.c
@@ -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;
diff --git a/drv_generic.h b/drv_generic.h
index 43c32a0..ee34452 100644
--- a/drv_generic.h
+++ b/drv_generic.h
@@ -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);
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
index ea0d2d3..816f716 100644
--- a/drv_generic_graphic.c
+++ b/drv_generic_graphic.c
@@ -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;
diff --git a/drv_generic_i2c.h b/drv_generic_i2c.h
index 579fcbe..543da04 100644
--- a/drv_generic_i2c.h
+++ b/drv_generic_i2c.h
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_i2c.h,v 1.7 2006/07/31 03:48:09 reinelt Exp $
+/* $Id: drv_generic_i2c.h,v 1.8 2006/08/13 06:46:51 reinelt Exp $
*
* generic driver helper for i2c displays
*
@@ -23,6 +23,9 @@
*
*
* $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
*
@@ -85,4 +88,4 @@
void drv_generic_i2c_data(const unsigned char data);
void drv_generic_i2c_command(const unsigned char command, const unsigned char *data, const unsigned char length);
-#endif /* */
+#endif /* */
diff --git a/lcd4linux.c b/lcd4linux.c
index 3cbb583..1e33e7c 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -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);
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 7bb7919..17e88fa 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -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'
diff --git a/udelay.c b/udelay.c
index 14ccee9..b30507d 100644
--- 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);
diff --git a/widget_bar.h b/widget_bar.h
index 81d4b58..11fa9f8 100644
--- a/widget_bar.h
+++ b/widget_bar.h
@@ -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;