driver for EFN LED modules by Tilman Glötzner

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1137 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
michael
2011-01-02 00:39:10 +00:00
parent 475fdb4397
commit 8dd087e587
9 changed files with 469 additions and 21 deletions
+1
View File
@@ -79,6 +79,7 @@ drv_Curses.c \
drv_Cwlinux.c \
drv_D4D.c \
drv_EA232graphic.c \
drv_EFN.c \
drv_FW8888.c \
drv_G15.c \
drv_GLCD2USB.c glcd2usb.h \
+2
View File
@@ -309,6 +309,7 @@ drv_Curses.c \
drv_Cwlinux.c \
drv_D4D.c \
drv_EA232graphic.c \
drv_EFN.c \
drv_FW8888.c \
drv_G15.c \
drv_GLCD2USB.c glcd2usb.h \
@@ -531,6 +532,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Cwlinux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_D4D.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_EA232graphic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_EFN.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_FW8888.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_G15.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_GLCD2USB.Po@am__quote@
Vendored
+2 -2
View File
@@ -9448,7 +9448,7 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])dnl
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
@@ -9459,7 +9459,7 @@ path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+3
View File
@@ -492,6 +492,9 @@
/* Electronic Assembly RS232 graphic driver */
#undef WITH_EA232graphic
/* Driver for EFN LED modules and EUG 100 ethernet to serial converter */
#undef WITH_EFN
/* Allnet FW8888 driver */
#undef WITH_FW8888
Vendored
+29 -16
View File
@@ -1569,8 +1569,8 @@ Optional Packages:
(try 'all,\!<driver>' if your shell complains...)
possible drivers are:
ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,
EA232Graphic, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C, IRLCD,
LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,
EA232Graphic, EFN, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,
IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,
LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX,
MilfordInstruments, Noritake, NULL, Pertelian, PHAnderson,
PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,
@@ -6357,6 +6357,7 @@ for driver in $drivers; do
CWLINUX="yes"
D4D="yes"
EA232graphic="yes"
EFN="yes"
FW8888="yes"
G15="yes"
GLCD2USB="yes"
@@ -6422,6 +6423,9 @@ for driver in $drivers; do
EA232graphic)
EA232graphic=$val
;;
EFN)
EFN=$val
;;
FW8888)
FW8888=$val
;;
@@ -6665,6 +6669,15 @@ $as_echo "#define WITH_EA232graphic 1" >>confdefs.h
fi
if test "$EFN" = "yes"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_EFN.o"
$as_echo "#define WITH_EFN 1" >>confdefs.h
fi
if test "$FW8888" = "yes"; then
TEXT="yes"
SERIAL="yes"
@@ -12634,13 +12647,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:12637: $ac_compile\"" >&5)
(eval echo "\"\$as_me:12650: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:12640: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:12653: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:12643: output\"" >&5)
(eval echo "\"\$as_me:12656: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -13834,7 +13847,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 13837 "configure"' > conftest.$ac_ext
echo '#line 13850 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -15092,11 +15105,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15095: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15108: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15099: \$? = $ac_status" >&5
echo "$as_me:15112: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -15431,11 +15444,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15434: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15447: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15438: \$? = $ac_status" >&5
echo "$as_me:15451: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -15536,11 +15549,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15539: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15552: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15543: \$? = $ac_status" >&5
echo "$as_me:15556: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15591,11 +15604,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15594: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15607: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15598: \$? = $ac_status" >&5
echo "$as_me:15611: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17975,7 +17988,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 17978 "configure"
#line 17991 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18071,7 +18084,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 18074 "configure"
#line 18087 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+13 -2
View File
@@ -33,8 +33,8 @@ AC_ARG_WITH(
[ (try 'all,\!<driver>' if your shell complains...)]
[ possible drivers are:]
[ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,]
[ EA232Graphic, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C, IRLCD,]
[ LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,]
[ EA232Graphic, EFN, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,]
[ IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,]
[ LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX,]
[ MilfordInstruments, Noritake, NULL, Pertelian, PHAnderson,]
[ PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,]
@@ -68,6 +68,7 @@ for driver in $drivers; do
CWLINUX="yes"
D4D="yes"
EA232graphic="yes"
EFN="yes"
FW8888="yes"
G15="yes"
GLCD2USB="yes"
@@ -133,6 +134,9 @@ for driver in $drivers; do
EA232graphic)
EA232graphic=$val
;;
EFN)
EFN=$val
;;
FW8888)
FW8888=$val
;;
@@ -356,6 +360,13 @@ if test "$EA232graphic" = "yes"; then
AC_DEFINE(WITH_EA232graphic,1,[Electronic Assembly RS232 graphic driver])
fi
if test "$EFN" = "yes"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_EFN.o"
AC_DEFINE(WITH_EFN,1,[Driver for EFN LED modules and EUG 100 ethernet to serial converter])
fi
if test "$FW8888" = "yes"; then
TEXT="yes"
SERIAL="yes"
+4
View File
@@ -55,6 +55,7 @@ extern DRIVER drv_Curses;
extern DRIVER drv_Cwlinux;
extern DRIVER drv_D4D;
extern DRIVER drv_EA232graphic;
extern DRIVER drv_EFN;
extern DRIVER drv_FW8888;
extern DRIVER drv_G15;
extern DRIVER drv_GLCD2USB;
@@ -127,6 +128,9 @@ DRIVER *Driver[] = {
#ifdef WITH_EA232graphic
&drv_EA232graphic,
#endif
#ifdef WITH_EFN
&drv_EFN,
#endif
#ifdef WITH_FW8888
&drv_FW8888,
#endif
+414
View File
@@ -0,0 +1,414 @@
/* $Id: drv_Sample.c 773 2007-02-25 12:39:09Z michael $
* $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/drv_Sample.c $
*
* lcd4linux driver for EFN LED modules (manufacturer: COMFILE/South Korea)
* connected to the ethernet to serial converter EUG 100 (manufacturer ELV/
* Germany)
*
* Up to 256 EFN LED modules listen on a serial bus (9600 BAUD, 1 stop bit,
* no parity) and are controlled by a 3 byte protocol:
* Byte 1: 0xff
* Byte 2: <module address>
* Byte 3: <Ascii value of character to be diplayed>
* The module address of each EFN LED module is set hy solder bridges.
* The driver expects the EFN LED modules to be configured starting
* from address 1. The EFN LED module set to address 1 is the right
* most module.
*
* The EUG 100 is an ethernet to seriell converter. The IP address
* can be set by dhcp. It listens on ports 1000 (data) and 1001
* (configuration). Data received on port 1000 is sent onto the serial bus,
* while data sent to configuration port sets format of the EUG 100's
* serial interface.
* Due to a bug in the firmware, the transmission is interrupted if '\0' (0x00)
* is received on port 1000. Consequently, none of the EFN LED modules shall
* be set to address 0.
*
* Copyright (C) 2010 Tilman Glötzner <tilmanglotzner@hotmail.com>
*
* This file is part of LCD4Linux.
*
* LCD4Linux is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* LCD4Linux is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
*
* exported fuctions:
*
* struct DRIVER drv_EFN
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "debug.h"
#include "cfg.h"
#include "qprintf.h"
#include "udelay.h"
#include "plugin.h"
#include "widget.h"
#include "widget_text.h"
#include "widget_icon.h"
#include "widget_bar.h"
#include "drv.h"
/* text mode display */
#include "drv_generic_text.h"
static char Name[] = "EFN";
char Host[256];
int Port;
int DataSocket;
static void drv_EFN_clear(void);
/****************************************/
/*** hardware dependant functions ***/
/****************************************/
static int drv_EFN_open(const char *section)
{
int sockfd_conf, portno_conf, n;
struct sockaddr_in serv_addr;
struct sockaddr_in conf_addr;
struct hostent *server;
char buffer[5];
/* open tcp sockets to config port to EUG 100 t0 set serial parameter */
/* 9600 BAUD; no parity; 1 stop bit */
// socket to config EUG
portno_conf = Port + 1;
sockfd_conf = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd_conf < 0) {
error("ERROR opening config socket");
return -1;
}
// resolve DNS name of EFN server (= EUG 100)
server = gethostbyname(Host);
if (server == NULL) {
error("ERROR, no such host\n");
return -1;
}
// socket addr for config socket
bzero((char *) &conf_addr, sizeof(struct sockaddr_in));
conf_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr, (char *) &conf_addr.sin_addr.s_addr, server->h_length);
conf_addr.sin_port = htons(portno_conf);
// open config socket
if (connect(sockfd_conf, (struct sockaddr *) &conf_addr, sizeof(struct sockaddr_in)) < 0) {
error("ERROR connecting to config port");
return -1;
}
// sent config message
bzero(buffer, 5);
buffer[0] = '4';
buffer[1] = '0';
buffer[2] = '1';
n = write(sockfd_conf, buffer, 3);
if (n < 0) {
error("ERROR writing to config socket");
close(sockfd_conf);
return -1;
}
close(sockfd_conf);
// open data socket
DataSocket = socket(AF_INET, SOCK_STREAM, 0);
if (DataSocket < 0) {
error("ERROR opening data socket");
return -1;
}
// socket addr for data socket
bzero((char *) &serv_addr, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
bcopy((char *) server->h_addr, (char *) &serv_addr.sin_addr.s_addr, server->h_length);
serv_addr.sin_port = htons(Port);
if (connect(DataSocket, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr_in)) < 0) {
error("ERROR connecting to data socket");
return -1;
}
return 0;
}
static int drv_EFN_close(void)
{
/* close whatever port you've opened */
drv_EFN_clear();
close(DataSocket);
return 0;
}
/* dummy function that sends something to the display */
static void drv_EFN_send(const char *data, const unsigned int len)
{
int n, i;
// transport command stirng to EUG 100
n = write(DataSocket, data, len);
if (n < 0) {
error("%s:drv_EFN_send: Failed to write to data socket\n", Name);
// return(-1);
}
/*
printf("EFN_send: ");
for(i=0;i<n;i++)
{
printf("0x%02x ",data[i]);
}
printf("\n");
*/
}
/* text mode displays only */
static void drv_EFN_clear(void)
{
char *cmd;
int max_char, max_cmd, k;
max_char = DROWS * DCOLS;
max_cmd = 3 * max_char; // each EFN module expects 3 bytes
if ((cmd = malloc(max_cmd)) == NULL) {
error("%s : Failed to allocate memory in drv_Sample_write\n", Name);
// return -1;
} else {
/* do whatever is necessary to clear the display */
for (k = 0; k < max_char; k++) {
cmd[(3 * k) + 0] = 0xff;
cmd[(3 * k) + 1] = k + 1;
cmd[(3 * k) + 2] = ' ';
}
drv_EFN_send(cmd, max_cmd);
drv_EFN_send(cmd, max_cmd);
free(cmd);
//return 0;
}
}
/* text mode displays only */
static void drv_EFN_write(const int row, const int col, const char *data, int len)
{
char *cmd;
int offset, i, k, max_char, max_cmd;
max_char = DROWS * DCOLS;
max_cmd = 3 * max_char; // each LED blocks expects a 3 byte sequence
if ((cmd = (char *) malloc(max_cmd)) == NULL) {
error("%s : Failed to allocate memory in drv_Sample_write\n", Name);
//return -1;
} else {
/* do the cursor positioning here */
offset = ((row) * DCOLS) + col;
for (i = max_char - offset, k = 0; ((i > 0) && (k < len)); i--, k++) {
cmd[(3 * k) + 0] = 0xff;
cmd[(3 * k) + 1] = i;
cmd[(3 * k) + 2] = data[k];
}
/* send string to the display twice (to make transmission
* reliable) */
drv_EFN_send(cmd, 3 * (k));
drv_EFN_send(cmd, 3 * (k));
free(cmd);
// return 0;
}
}
static void drv_EFN_defchar(const int ascii, const unsigned char *matrix)
{
error("%s:drv_EFN_defchar: Function not supported by EFN modules\n", Name);
}
/* start text mode display */
static int drv_EFN_start(const char *section)
{
int rows = -1, cols = -1;
char *s;
s = cfg_get(section, "Host", NULL);
if (s == NULL || *s == '\0') {
error("%s: no '%s.Host' entry from %s", Name, section, cfg_source());
return -1;
}
if (sscanf(s, "%s", &Host) != 1) {
error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
free(s);
return -1;
}
if (cfg_number(section, "Port", 1000, 0, 65535, &Port) < 0)
return -1;
s = cfg_get(section, "Size", NULL);
if (s == NULL || *s == '\0') {
error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
return -1;
}
if (sscanf(s, "%dx%d", &cols, &rows) != 2 || rows < 1 || cols < 1) {
error("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source());
free(s);
return -1;
}
DROWS = rows;
DCOLS = cols;
/* open communication with the display */
if (drv_EFN_open(section) < 0) {
return -1;
}
/* initialize display */
drv_EFN_clear(); /* clear display */
return 0;
}
/****************************************/
/*** plugins ***/
/****************************************/
/****************************************/
/*** widget callbacks ***/
/****************************************/
/****************************************/
/*** exported functions ***/
/****************************************/
/* list models */
int drv_EFN_list(void)
{
printf("EFN LED modules + EUG100 Ethernet to serial convertor");
return 0;
}
/* initialize driver & display */
/* use this function for a text display */
int drv_EFN_init(const char *section, const int quiet)
{
WIDGET_CLASS wc;
int ret;
info("%s: %s", Name, "$Rev: 773 $");
/* display preferences */
/* real worker functions */
drv_generic_text_real_write = drv_EFN_write;
drv_generic_text_real_defchar = drv_EFN_defchar;
/* start display */
if ((ret = drv_EFN_start(section)) != 0)
return ret;
if (!quiet) {
char buffer[40];
qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
sleep(3);
drv_EFN_clear();
}
/* initialize generic text driver */
if ((ret = drv_generic_text_init(section, Name)) != 0)
return ret;
/* register text widget */
wc = Widget_Text;
wc.draw = drv_generic_text_draw;
widget_register(&wc);
return 0;
}
/* close driver & display */
/* use this function for a text display */
int drv_EFN_quit(const int quiet)
{
info("%s: shutting down.", Name);
drv_generic_text_quit();
/* clear display */
drv_EFN_clear();
/* say goodbye... */
if (!quiet) {
drv_generic_text_greet("goodbye!", NULL);
}
debug("closing connection");
drv_EFN_close();
return (0);
}
/* close driver & display */
/* use this one for a text display */
DRIVER drv_EFN = {
.name = Name,
.list = drv_EFN_list,
.init = drv_EFN_init,
.quit = drv_EFN_quit,
};
+1 -1
View File
@@ -9,7 +9,7 @@ rm -f smoketest.log lcd4linux
make distclean
./bootstrap
for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D EA232graphic G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample serdisplib SimpleLCD T6963 Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do
for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D EA232graphic EFN G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample serdisplib SimpleLCD T6963 Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do
make distclean
./configure --with-drivers=$driver