From: Joel Holdsworth Date: Sat, 11 Feb 2012 12:08:49 +0000 (+0000) Subject: fx2lafw: Added empty hardware module for fx2lafw X-Git-Tag: libsigrok-0.1.0~100 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f302a082567d10f90cd20fca5a7abd68d7267d96;p=libsigrok.git fx2lafw: Added empty hardware module for fx2lafw --- diff --git a/configure.ac b/configure.ac index cd2ebe86..9a6cd538 100644 --- a/configure.ac +++ b/configure.ac @@ -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" diff --git a/hardware/Makefile.am b/hardware/Makefile.am index 3aa0e87f..17622448 100644 --- a/hardware/Makefile.am +++ b/hardware/Makefile.am @@ -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 index 00000000..5713fe11 --- /dev/null +++ b/hardware/fx2lafw/Makefile.am @@ -0,0 +1,35 @@ +## +## This file is part of the sigrok project. +## +## Copyright (C) 2012 Joel Holdsworth +## +## 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 . +## + +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 index 00000000..f3755775 --- /dev/null +++ b/hardware/fx2lafw/fx2lafw.c @@ -0,0 +1,111 @@ +/* + * This file is part of the sigrok project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 . + */ + +#include +#include + +#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 index 00000000..f0ea12cc --- /dev/null +++ b/hardware/fx2lafw/fx2lafw.h @@ -0,0 +1,23 @@ +/* + * This file is part of the sigrok project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 . + */ + +#ifndef LIBSIGROK_HARDWARE_FX2LAFW +#define LIBSIGROK_HARDWARE_FX2LAFW + +#endif diff --git a/hwplugin.c b/hwplugin.c index 37d98e5d..5204a0f0 100644 --- a/hwplugin.c +++ b/hwplugin.c @@ -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, };