aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2012-01-08 08:25:54 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2012-01-08 08:25:54 +0000
commit33d1f71e7eb46279fd57c4a7ae853c78d0a6bdfb (patch)
tree4d1379e4019266836a07db56f2cd7d24d4c2293f
parent0b52f082263265ed4118ebc8cc2a9c80d920df5c (diff)
downloadlcd4linux-33d1f71e7eb46279fd57c4a7ae853c78d0a6bdfb.tar.gz
DPF driver by Stefan Kuhne 8note that you need libdpf)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1168 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in4
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure37
-rw-r--r--configure.in3
-rw-r--r--drivers.m418
-rw-r--r--drv.c4
-rw-r--r--drv_dpf.c266
-rwxr-xr-xsmoketest.sh2
9 files changed, 337 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index cd7d5b4..b1a4ed2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,6 +78,7 @@ drv_Crystalfontz.c \
drv_Curses.c \
drv_Cwlinux.c \
drv_D4D.c \
+drv_dpf.c \
drv_EA232graphic.c \
drv_EFN.c \
drv_FW8888.c \
diff --git a/Makefile.in b/Makefile.in
index d165ccc..597812f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -251,7 +251,7 @@ AM_CFLAGS = -D_GNU_SOURCE -Wall -Wextra -fno-strict-aliasing
ACLOCAL_AMFLAGS = -I m4
# use this for lots of warnings
#AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing
-lcd4linux_LDFLAGS =
+lcd4linux_LDFLAGS = "-Wl,--as-needed"
lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
lcd4linux_SOURCES = \
@@ -310,6 +310,7 @@ drv_Crystalfontz.c \
drv_Curses.c \
drv_Cwlinux.c \
drv_D4D.c \
+drv_dpf.c \
drv_EA232graphic.c \
drv_EFN.c \
drv_FW8888.c \
@@ -570,6 +571,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_USBLCD.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_WincorNixdorf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_X11.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_dpf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_gpio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_generic_graphic.Po@am__quote@
diff --git a/config.h.in b/config.h.in
index 82a2f97..97c3e84 100644
--- a/config.h.in
+++ b/config.h.in
@@ -67,6 +67,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <libdpf/libdpf.h> header file. */
+#undef HAVE_LIBDPF_LIBDPF_H
+
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
@@ -492,6 +495,9 @@
/* Define if using the dmalloc debugging malloc package */
#undef WITH_DMALLOC
+/* DPF driver */
+#undef WITH_DPF
+
/* Electronic Assembly RS232 graphic driver */
#undef WITH_EA232graphic
diff --git a/configure b/configure
index c2669bf..8e6bf0b 100755
--- a/configure
+++ b/configure
@@ -1442,7 +1442,7 @@ Optional Packages:
drivers may be excluded with 'all,!<driver>',
(try 'all,\!<driver>' if your shell complains...)
possible drivers are:
- ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,
+ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D, DPF
EA232Graphic, EFN, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,
IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,
LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,
@@ -5690,6 +5690,22 @@ fi
done
+# check for libdpf libs
+for ac_header in libdpf/libdpf.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "libdpf/libdpf.h" "ac_cv_header_libdpf_libdpf_h" "$ac_includes_default"
+if test "x$ac_cv_header_libdpf_libdpf_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDPF_LIBDPF_H 1
+_ACEOF
+ has_libdpf="true"
+else
+ has_libdpf="false"
+fi
+
+done
+
+
# check for vncserver libs
for ac_header in rfb/rfb.h
do :
@@ -6261,6 +6277,7 @@ for driver in $drivers; do
CURSES="yes"
CWLINUX="yes"
D4D="yes"
+ DPF="yes"
EA232graphic="yes"
EFN="yes"
FW8888="yes"
@@ -6327,6 +6344,9 @@ for driver in $drivers; do
D4D)
D4D=$val
;;
+ DPF)
+ DPF=$val
+ ;;
EA232graphic)
EA232graphic=$val
;;
@@ -6573,6 +6593,20 @@ $as_echo "#define WITH_D4D 1" >>confdefs.h
fi
+if test "$DPF" = "yes"; then
+ if test "$has_libdpf" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_dpf.o"
+ DRVLIBS="$DRVLIBS -Llibdpf -ldpf -lusb"
+
+$as_echo "#define WITH_DPF 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdpf.h not found: DPF driver disabled" >&5
+$as_echo "$as_me: WARNING: libdpf.h not found: DPF driver disabled" >&2;}
+ fi
+fi
+
if test "$EA232graphic" = "yes"; then
GRAPHIC="yes"
SERIAL="yes"
@@ -7030,6 +7064,7 @@ $as_echo "$as_me: WARNING: st2205.h not found: st2205 driver disabled" >&2;}
fi
fi
+
if test "$T6963" = "yes"; then
if test "$has_parport" = "true"; then
GRAPHIC="yes"
diff --git a/configure.in b/configure.in
index a820ae6..23aff72 100644
--- a/configure.in
+++ b/configure.in
@@ -84,6 +84,9 @@ AC_CHECK_HEADERS(serdisplib/serdisp.h, [has_serdisplib="true"], [has_serdisplib=
# check for st2205 libs
AC_CHECK_HEADERS(st2205.h, [has_st2205="true"], [has_st2205="false"])
+# check for libdpf libs
+AC_CHECK_HEADERS(libdpf/libdpf.h, [has_libdpf="true"], [has_libdpf="false"])
+
# check for vncserver libs
AC_CHECK_HEADERS(rfb/rfb.h, [has_vncserverlib="true"], [has_vncserverlib="false"])
diff --git a/drivers.m4 b/drivers.m4
index 234c25f..09bd152 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -32,7 +32,7 @@ AC_ARG_WITH(
[ drivers may be excluded with 'all,!<driver>',]
[ (try 'all,\!<driver>' if your shell complains...)]
[ possible drivers are:]
- [ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,]
+ [ ASTUSB, BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D, DPF]
[ EA232Graphic, EFN, FW8888, G15, GLCD2USB, HD44780, HD44780-I2C,]
[ IRLCD, LCD2USB, LCDLinux, LEDMatrix, LCDTerm, LPH7508, LUIse,]
[ LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,]
@@ -67,6 +67,7 @@ for driver in $drivers; do
CURSES="yes"
CWLINUX="yes"
D4D="yes"
+ DPF="yes"
EA232graphic="yes"
EFN="yes"
FW8888="yes"
@@ -133,6 +134,9 @@ for driver in $drivers; do
D4D)
D4D=$val
;;
+ DPF)
+ DPF=$val
+ ;;
EA232graphic)
EA232graphic=$val
;;
@@ -361,6 +365,17 @@ if test "$D4D" = "yes"; then
AC_DEFINE(WITH_D4D,1,[D4D driver])
fi
+if test "$DPF" = "yes"; then
+ if test "$has_libdpf" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_dpf.o"
+ DRVLIBS="$DRVLIBS -Llibdpf -ldpf -lusb"
+ AC_DEFINE(WITH_DPF,1,[DPF driver])
+ else
+ AC_MSG_WARN(libdpf.h not found: DPF driver disabled)
+ fi
+fi
+
if test "$EA232graphic" = "yes"; then
GRAPHIC="yes"
SERIAL="yes"
@@ -725,6 +740,7 @@ if test "$ST2205" = "yes"; then
fi
fi
+
if test "$T6963" = "yes"; then
if test "$has_parport" = "true"; then
GRAPHIC="yes"
diff --git a/drv.c b/drv.c
index d68069f..32883a8 100644
--- a/drv.c
+++ b/drv.c
@@ -54,6 +54,7 @@ extern DRIVER drv_Crystalfontz;
extern DRIVER drv_Curses;
extern DRIVER drv_Cwlinux;
extern DRIVER drv_D4D;
+extern DRIVER drv_DPF;
extern DRIVER drv_EA232graphic;
extern DRIVER drv_EFN;
extern DRIVER drv_FW8888;
@@ -127,6 +128,9 @@ DRIVER *Driver[] = {
#ifdef WITH_D4D
&drv_D4D,
#endif
+#ifdef WITH_DPF
+ &drv_DPF,
+#endif
#ifdef WITH_EA232graphic
&drv_EA232graphic,
#endif
diff --git a/drv_dpf.c b/drv_dpf.c
new file mode 100644
index 0000000..a5d5c50
--- /dev/null
+++ b/drv_dpf.c
@@ -0,0 +1,266 @@
+/* $Id: drv_dpf.c 980 2009-01-28 21:18:52Z michux $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_dpf.c $
+ *
+ * Very basic hacked picture frame driver. Uses external libdpf.
+ * This is a first working approach for AX206 based DPFs. In future,
+ * more DPFs might be covered by that library. Work in progress.
+ *
+ * See http://picframe.spritesserver.nl/ for more info.
+ *
+ * Copyright (C) 2008 Jeroen Domburg <picframe@spritesmods.com>
+ * Modified from sample code by:
+ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * 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_DPF
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <libdpf/libdpf.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"
+
+#include "drv_generic_graphic.h"
+
+static char Name[] = "DPF";
+
+static DPFContext *g_h;
+
+/* Display data */
+static unsigned char *g_fb;
+
+static int drv_dpf_open(const char *section)
+{
+ int error;
+ char *dev;
+
+ // Currently, the Port specification is unused.
+
+ dev = cfg_get(section, "Port", NULL);
+ if (dev == NULL || *dev == '\0') {
+ error("dpf: no '%s.Port' entry from %s", section, cfg_source());
+ return -1;
+ }
+
+ error = dpf_open(NULL, &g_h);
+ if (error < 0) {
+ error("dpf: cannot open dpf device %s", dev);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int drv_dpf_close(void)
+{
+ dpf_close(g_h);
+
+ return 0;
+}
+
+#define _RGB565_0(p) \
+ (( ((p.R) & 0xf8) ) | (((p.G) & 0xe0) >> 5))
+#define _RGB565_1(p) \
+ (( ((p.G) & 0x1c) << 3 ) | (((p.B) & 0xf8) >> 3))
+
+static void drv_dpf_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+ short rect[4];
+ unsigned long i;
+ RGBA p;
+ unsigned char *pix;
+
+ pix = g_fb;
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ p = drv_generic_graphic_rgb(r, c);
+ *pix++ = _RGB565_0(p);
+ *pix++ = _RGB565_1(p);
+ }
+ }
+ rect[0] = col;
+ rect[1] = row;
+ rect[2] = col + width;
+ rect[3] = row + height;
+ dpf_screen_blit(g_h, g_fb, rect);
+}
+
+
+/* start graphic display */
+static int drv_dpf_start2(const char *section)
+{
+ char *s;
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ 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;
+ }
+
+
+ /* open communication with the display */
+ if (drv_dpf_open(section) < 0) {
+ return -1;
+ }
+
+ /* you surely want to allocate a framebuffer or something... */
+ g_fb = malloc(g_h->height * g_h->width * g_h->bpp);
+
+ /* set width/height from dpf firmware specs */
+ DROWS = g_h->height;
+ DCOLS = g_h->width;
+
+ return 0;
+}
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_backlight(RESULT * result, RESULT * arg1)
+{
+ int bl_on;
+ bl_on = (R2N(arg1) == 0 ? 0 : 1);
+ dpf_backlight(g_h, bl_on);
+ SetResult(&result, R_NUMBER, &bl_on);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_dpf_list(void)
+{
+ printf("generic hacked photo frame");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_dpf_init2(const char *section, const int quiet)
+{
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_dpf_blit;
+
+ /* start display */
+ if ((ret = drv_dpf_start2(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register plugins */
+ AddFunction("LCD::backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_dpf_quit2(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ drv_dpf_close();
+
+ return (0);
+}
+
+
+DRIVER drv_DPF = {
+ .name = Name,
+ .list = drv_dpf_list,
+ .init = drv_dpf_init2,
+ .quit = drv_dpf_quit2,
+};
diff --git a/smoketest.sh b/smoketest.sh
index 8fecf1e..0077b86 100755
--- a/smoketest.sh
+++ b/smoketest.sh
@@ -9,7 +9,7 @@ rm -f smoketest.log lcd4linux
make distclean
./bootstrap
-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
+for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D DPF 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