]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Added empty hardware module for fx2lafw
authorJoel Holdsworth <redacted>
Sat, 11 Feb 2012 12:08:49 +0000 (12:08 +0000)
committerJoel Holdsworth <redacted>
Sat, 25 Feb 2012 09:11:53 +0000 (09:11 +0000)
configure.ac
hardware/Makefile.am
hardware/fx2lafw/Makefile.am [new file with mode: 0644]
hardware/fx2lafw/fx2lafw.c [new file with mode: 0644]
hardware/fx2lafw/fx2lafw.h [new file with mode: 0644]
hwplugin.c

index cd2ebe865d92c6a61288688fdc461b70b047d6f1..9a6cd53808df0e161ee2bc0f18912509042e5cda 100644 (file)
@@ -99,6 +99,16 @@ if test "x$LA_CHRONOVU_LA8" = "xyes"; then
        AC_DEFINE(HAVE_LA_CHRONOVU_LA8, 1, [ChronoVu LA8 support])
 fi
 
+# Disabled by default, unfinished.
+AC_ARG_ENABLE(fx2lafw, AC_HELP_STRING([--enable-fx2lafw],
+             [enable open source fx2lafw driver support for fx2 devices. [default=no]]),
+             [LA_FX2LAFW="$enableval"],
+             [LA_FX2LAFW=no])
+AM_CONDITIONAL(LA_FX2LAFW, test x$LA_FX2LAFW = xyes)
+if test "x$LA_FX2LAFW" = "xyes"; then
+       AC_DEFINE(HAVE_LA_FX2LAFW, 1, [fx2lafw support])
+fi
+
 AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
              [enable demo driver support [default=yes]]),
              [LA_DEMO="$enableval"],
@@ -167,7 +177,8 @@ PKG_CHECK_MODULES([gthread], [gthread-2.0 >= 2.22.0],
 if test "x$LA_SALEAE_LOGIC" != xno \
    -o "x$LA_ASIX_SIGMA" != xno \
    -o "x$LA_CHRONOVU_LA8" != xno \
-   -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno; then
+   -o "x$LA_ZEROPLUS_LOGIC_CUBE" != xno \
+   -o "x$LA_FX2LAFW" != xno; then
        case "$build" in
        *freebsd*)
                # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
@@ -280,6 +291,7 @@ AC_CONFIG_FILES([Makefile
                 hardware/chronovu-la8/Makefile
                 hardware/common/Makefile
                 hardware/demo/Makefile
+                hardware/fx2lafw/Makefile
                 hardware/link-mso19/Makefile
                 hardware/openbench-logic-sniffer/Makefile
                 hardware/saleae-logic/Makefile
@@ -320,6 +332,7 @@ echo
 echo "  - ASIX SIGMA...................... $LA_ASIX_SIGMA"
 echo "  - ChronoVu LA8.................... $LA_CHRONOVU_LA8"
 echo "  - Demo driver..................... $LA_DEMO"
+echo "  - fx2lafw......................... $LA_FX2LAFW"
 echo "  - Link MSO-19..................... $LA_LINK_MSO19"
 echo "  - Openbench Logic Sniffer......... $LA_OLS"
 echo "  - Saleae Logic.................... $LA_SALEAE_LOGIC"
index 3aa0e87f12a0a60c7189cb7afeec42354a8eea21..17622448f201de3a4cf92573fcd7da27cbf9f82a 100644 (file)
@@ -23,6 +23,7 @@ SUBDIRS = \
        chronovu-la8 \
        common \
        demo \
+       fx2lafw \
        link-mso19 \
        openbench-logic-sniffer \
        saleae-logic \
@@ -47,6 +48,10 @@ if LA_CHRONOVU_LA8
 libsigrokhardware_la_LIBADD += chronovu-la8/libsigrokhwchronovula8.la
 endif
 
+if LA_FX2LAFW
+libsigrokhardware_la_LIBADD += fx2lafw/libsigrokhwfx2lafw.la
+endif
+
 if LA_DEMO
 libsigrokhardware_la_LIBADD += demo/libsigrokhwdemo.la
 endif
diff --git a/hardware/fx2lafw/Makefile.am b/hardware/fx2lafw/Makefile.am
new file mode 100644 (file)
index 0000000..5713fe1
--- /dev/null
@@ -0,0 +1,35 @@
+##
+## This file is part of the sigrok project.
+##
+## Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+##
+## This program 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 3 of the License, or
+## (at your option) any later version.
+##
+## This program 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, see <http://www.gnu.org/licenses/>.
+##
+
+if LA_FX2LAFW
+
+AM_CPPFLAGS = -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
+
+# Local lib, this is NOT meant to be installed!
+noinst_LTLIBRARIES = libsigrokhwfx2lafw.la
+
+libsigrokhwfx2lafw_la_SOURCES = \
+       fx2lafw.c \
+       fx2lafw.h
+
+libsigrokhwfx2lafw_la_CFLAGS = \
+       -I$(top_srcdir)
+
+endif
+
diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c
new file mode 100644 (file)
index 0000000..f375577
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * This file is part of the sigrok project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "sigrok.h"
+#include "sigrok-internal.h"
+#include "fx2lafw.h"
+
+
+/*
+ * API callbacks
+ */
+
+static int hw_init(const char *deviceinfo)
+{
+       (void)deviceinfo;
+       return 0;
+}
+
+static int hw_dev_open(int device_index)
+{
+       (void)device_index;
+       return SR_OK;
+}
+
+static int hw_dev_close(int device_index)
+{
+       (void)device_index;
+       return SR_OK;
+}
+
+static int hw_cleanup(void)
+{
+       return SR_OK;
+}
+
+static void *hw_dev_info_get(int device_index, int device_info_id)
+{
+       (void)device_index;
+       (void)device_info_id;
+       return NULL;
+}
+
+static int hw_dev_status_get(int device_index)
+{
+       (void)device_index;
+       return SR_ST_NOT_FOUND;
+}
+
+static int *hw_hwcap_get_all(void)
+{
+       return NULL;
+}
+
+static int hw_dev_config_set(int dev_index, int capability, void *value)
+{
+       (void)dev_index;
+       (void)capability;
+       (void)value;
+       return SR_OK;
+}
+
+static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
+{
+       (void)dev_index;
+       (void)session_data;
+       return SR_OK;
+}
+
+/* This stops acquisition on ALL devices, ignoring device_index. */
+static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
+{
+       (void)dev_index;
+       (void)session_data;
+       return SR_OK;
+}
+
+SR_PRIV struct sr_dev_plugin fx2lafw_plugin_info = {
+       .name = "fx2lafw",
+       .longname = "fx2lafw",
+       .api_version = 1,
+       .init = hw_init,
+       .cleanup = hw_cleanup,
+       .dev_open = hw_dev_open,
+       .dev_close = hw_dev_close,
+       .dev_info_get = hw_dev_info_get,
+       .dev_status_get = hw_dev_status_get,
+       .hwcap_get_all = hw_hwcap_get_all,
+       .dev_config_set = hw_dev_config_set,
+       .dev_acquisition_start = hw_dev_acquisition_start,
+       .dev_acquisition_stop = hw_dev_acquisition_stop,
+};
diff --git a/hardware/fx2lafw/fx2lafw.h b/hardware/fx2lafw/fx2lafw.h
new file mode 100644 (file)
index 0000000..f0ea12c
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the sigrok project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBSIGROK_HARDWARE_FX2LAFW
+#define LIBSIGROK_HARDWARE_FX2LAFW
+
+#endif
index 37d98e5dfca11901ad732ac6a6819f4c8bc442b6..5204a0f02c7ba2341bd377495725ddb5ebb1cdc8 100644 (file)
@@ -63,6 +63,9 @@ extern SR_PRIV struct sr_dev_plugin link_mso19_plugin_info;
 #ifdef HAVE_LA_ALSA
 extern SR_PRIV struct sr_dev_plugin alsa_plugin_info;
 #endif
+#ifdef HAVE_LA_FX2LAFW
+extern SR_PRIV struct sr_dev_plugin fx2lafw_plugin_info;
+#endif
 
 static struct sr_dev_plugin *plugins_list[] = {
 #ifdef HAVE_LA_DEMO
@@ -88,6 +91,9 @@ static struct sr_dev_plugin *plugins_list[] = {
 #endif
 #ifdef HAVE_LA_ALSA
        &alsa_plugin_info,
+#endif
+#ifdef HAVE_LA_FX2LAFW
+       &fx2lafw_plugin_info,
 #endif
        NULL,
 };