conrad-digi-35-cpu: Initial driver framework.
This commit is contained in:
parent
a90061e5d1
commit
823b4e5817
24
configure.ac
24
configure.ac
|
@ -134,6 +134,11 @@ AC_ARG_ENABLE(colead-slm, AC_HELP_STRING([--enable-colead-slm],
|
||||||
[HW_COLEAD_SLM="$enableval"],
|
[HW_COLEAD_SLM="$enableval"],
|
||||||
[HW_COLEAD_SLM=$HW_ENABLED_DEFAULT])
|
[HW_COLEAD_SLM=$HW_ENABLED_DEFAULT])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(conrad-digi-35-cpu, AC_HELP_STRING([--enable-conrad-digi-35-cpu],
|
||||||
|
[enable Conrad DIGI 35 CPU support [default=yes]]),
|
||||||
|
[HW_CONRAD_DIGI_35_CPU="$enableval"],
|
||||||
|
[HW_CONRAD_DIGI_35_CPU=$HW_ENABLED_DEFAULT])
|
||||||
|
|
||||||
AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
|
AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo],
|
||||||
[enable demo driver support [default=yes]]),
|
[enable demo driver support [default=yes]]),
|
||||||
[HW_DEMO="$enableval"],
|
[HW_DEMO="$enableval"],
|
||||||
|
@ -274,10 +279,10 @@ AC_SEARCH_LIBS([pow], [m])
|
||||||
# RPC is only needed for VXI support.
|
# RPC is only needed for VXI support.
|
||||||
AC_MSG_CHECKING([for RPC support])
|
AC_MSG_CHECKING([for RPC support])
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <rpc/rpc.h>],
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <rpc/rpc.h>],
|
||||||
[CLIENT *rpc_test(void)],
|
[CLIENT *rpc_test(void)],
|
||||||
[{ return clnt_create("", 0, 0, ""); }])],
|
[{ return clnt_create("", 0, 0, ""); }])],
|
||||||
[AC_MSG_RESULT([yes]); have_rpc=1],
|
[AC_MSG_RESULT([yes]); have_rpc=1],
|
||||||
[AC_MSG_RESULT([no]); have_rpc=0])
|
[AC_MSG_RESULT([no]); have_rpc=0])
|
||||||
# Define HAVE_RPC in config.h if we found RPC support.
|
# Define HAVE_RPC in config.h if we found RPC support.
|
||||||
AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc], [Specifies whether we have RPC support.])
|
AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc], [Specifies whether we have RPC support.])
|
||||||
# VXI support is only compiled if RPC support was found.
|
# VXI support is only compiled if RPC support was found.
|
||||||
|
@ -302,8 +307,8 @@ PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.0],
|
||||||
SR_PKGLIBS="$SR_PKGLIBS libserialport"],
|
SR_PKGLIBS="$SR_PKGLIBS libserialport"],
|
||||||
[have_libserialport="no"; HW_AGILENT_DMM="no"; HW_APPA_55II="no";
|
[have_libserialport="no"; HW_AGILENT_DMM="no"; HW_APPA_55II="no";
|
||||||
HW_ATTEN_PPS3XXX="no"; HW_BRYMEN_DMM="no"; HW_CEM_DT_885X="no";
|
HW_ATTEN_PPS3XXX="no"; HW_BRYMEN_DMM="no"; HW_CEM_DT_885X="no";
|
||||||
HW_CENTER_3XX="no"; HW_COLEAD_SLM="no"; HW_FLUKE_DMM="no";
|
HW_CENTER_3XX="no"; HW_COLEAD_SLM="no"; HW_CONRAD_DIGI_35_CPU="no";
|
||||||
HW_GMC_MH_1X_2X="no"; HW_HAMEG_HMO="no"; HW_LINK_MSO19="no";
|
HW_FLUKE_DMM="no"; HW_GMC_MH_1X_2X="no"; HW_HAMEG_HMO="no"; HW_LINK_MSO19="no";
|
||||||
HW_MIC_985XX="no"; HW_NORMA_DMM="no"; HW_OLS="no";
|
HW_MIC_985XX="no"; HW_NORMA_DMM="no"; HW_OLS="no";
|
||||||
HW_SERIAL_DMM="no"; HW_TELEINFO="no"; HW_TONDAJ_SL_814="no"])
|
HW_SERIAL_DMM="no"; HW_TELEINFO="no"; HW_TONDAJ_SL_814="no"])
|
||||||
|
|
||||||
|
@ -450,6 +455,11 @@ if test "x$HW_COLEAD_SLM" = "xyes"; then
|
||||||
AC_DEFINE(HAVE_HW_COLEAD_SLM, 1, [Colead SLM support])
|
AC_DEFINE(HAVE_HW_COLEAD_SLM, 1, [Colead SLM support])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HW_CONRAD_DIGI_35_CPU, test x$HW_CONRAD_DIGI_35_CPU = xyes)
|
||||||
|
if test "x$HW_CONRAD_DIGI_35_CPU" = "xyes"; then
|
||||||
|
AC_DEFINE(HAVE_HW_CONRAD_DIGI_35_CPU, 1, [Conrad DIGI 35 CPU support])
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(HW_DEMO, test x$HW_DEMO = xyes)
|
AM_CONDITIONAL(HW_DEMO, test x$HW_DEMO = xyes)
|
||||||
if test "x$HW_DEMO" = "xyes"; then
|
if test "x$HW_DEMO" = "xyes"; then
|
||||||
AC_DEFINE(HAVE_HW_DEMO, 1, [Demo driver support])
|
AC_DEFINE(HAVE_HW_DEMO, 1, [Demo driver support])
|
||||||
|
@ -602,6 +612,7 @@ AC_CONFIG_FILES([Makefile version.h hardware/Makefile
|
||||||
hardware/chronovu-la8/Makefile
|
hardware/chronovu-la8/Makefile
|
||||||
hardware/colead-slm/Makefile
|
hardware/colead-slm/Makefile
|
||||||
hardware/common/Makefile
|
hardware/common/Makefile
|
||||||
|
hardware/conrad-digi-35-cpu/Makefile
|
||||||
hardware/gmc-mh-1x-2x/Makefile
|
hardware/gmc-mh-1x-2x/Makefile
|
||||||
hardware/hameg-hmo/Makefile
|
hardware/hameg-hmo/Makefile
|
||||||
hardware/ikalogic-scanalogic2/Makefile
|
hardware/ikalogic-scanalogic2/Makefile
|
||||||
|
@ -671,6 +682,7 @@ echo " - cem-dt-885x..................... $HW_CEM_DT_885X"
|
||||||
echo " - center-3xx...................... $HW_CENTER_3XX"
|
echo " - center-3xx...................... $HW_CENTER_3XX"
|
||||||
echo " - chronovu-la8.................... $HW_CHRONOVU_LA8"
|
echo " - chronovu-la8.................... $HW_CHRONOVU_LA8"
|
||||||
echo " - colead-slm...................... $HW_COLEAD_SLM"
|
echo " - colead-slm...................... $HW_COLEAD_SLM"
|
||||||
|
echo " - conrad-digi-35-cpu.............. $HW_CONRAD_DIGI_35_CPU"
|
||||||
echo " - demo............................ $HW_DEMO"
|
echo " - demo............................ $HW_DEMO"
|
||||||
echo " - fluke-dmm....................... $HW_FLUKE_DMM"
|
echo " - fluke-dmm....................... $HW_FLUKE_DMM"
|
||||||
echo " - fx2lafw......................... $HW_FX2LAFW"
|
echo " - fx2lafw......................... $HW_FX2LAFW"
|
||||||
|
|
|
@ -30,6 +30,7 @@ SUBDIRS = \
|
||||||
chronovu-la8 \
|
chronovu-la8 \
|
||||||
colead-slm \
|
colead-slm \
|
||||||
common \
|
common \
|
||||||
|
conrad-digi-35-cpu \
|
||||||
demo \
|
demo \
|
||||||
fluke-dmm \
|
fluke-dmm \
|
||||||
fx2lafw \
|
fx2lafw \
|
||||||
|
@ -102,6 +103,10 @@ if HW_COLEAD_SLM
|
||||||
libsigrokhardware_la_LIBADD += colead-slm/libsigrok_hw_colead_slm.la
|
libsigrokhardware_la_LIBADD += colead-slm/libsigrok_hw_colead_slm.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if HW_CONRAD_DIGI_35_CPU
|
||||||
|
libsigrokhardware_la_LIBADD += conrad-digi-35-cpu/libsigrok_hw_conrad_digi_35_cpu.la
|
||||||
|
endif
|
||||||
|
|
||||||
if HW_DEMO
|
if HW_DEMO
|
||||||
libsigrokhardware_la_LIBADD += demo/libsigrok_hw_demo.la
|
libsigrokhardware_la_LIBADD += demo/libsigrok_hw_demo.la
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -0,0 +1,191 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the libsigrok project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Matthias Heidbrink <m-sigrok@heidbrink.biz>
|
||||||
|
*
|
||||||
|
* 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 "protocol.h"
|
||||||
|
|
||||||
|
SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info;
|
||||||
|
static struct sr_dev_driver *di = &conrad_digi_35_cpu_driver_info;
|
||||||
|
|
||||||
|
static int init(struct sr_context *sr_ctx)
|
||||||
|
{
|
||||||
|
return std_init(sr_ctx, di, LOG_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GSList *scan(GSList *options)
|
||||||
|
{
|
||||||
|
struct drv_context *drvc;
|
||||||
|
GSList *devices;
|
||||||
|
|
||||||
|
(void)options;
|
||||||
|
|
||||||
|
devices = NULL;
|
||||||
|
drvc = di->priv;
|
||||||
|
drvc->instances = NULL;
|
||||||
|
|
||||||
|
/* TODO: scan for devices, either based on a SR_CONF_CONN option
|
||||||
|
* or on a USB scan. */
|
||||||
|
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GSList *dev_list(void)
|
||||||
|
{
|
||||||
|
return ((struct drv_context *)(di->priv))->instances;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_clear(void)
|
||||||
|
{
|
||||||
|
return std_dev_clear(di, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
{
|
||||||
|
(void)sdi;
|
||||||
|
|
||||||
|
/* TODO: get handle from sdi->conn and open it. */
|
||||||
|
|
||||||
|
sdi->status = SR_ST_ACTIVE;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
|
{
|
||||||
|
(void)sdi;
|
||||||
|
|
||||||
|
/* TODO: get handle from sdi->conn and close it. */
|
||||||
|
|
||||||
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cleanup(void)
|
||||||
|
{
|
||||||
|
dev_clear();
|
||||||
|
|
||||||
|
/* TODO: free other driver resources, if any. */
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
const struct sr_probe_group *probe_group)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
(void)sdi;
|
||||||
|
(void)data;
|
||||||
|
(void)probe_group;
|
||||||
|
|
||||||
|
ret = SR_OK;
|
||||||
|
switch (key) {
|
||||||
|
/* TODO */
|
||||||
|
default:
|
||||||
|
return SR_ERR_NA;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
const struct sr_probe_group *probe_group)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
(void)probe_group;
|
||||||
|
|
||||||
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
|
ret = SR_OK;
|
||||||
|
switch (key) {
|
||||||
|
/* TODO */
|
||||||
|
default:
|
||||||
|
ret = SR_ERR_NA;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
const struct sr_probe_group *probe_group)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
(void)sdi;
|
||||||
|
(void)data;
|
||||||
|
(void)probe_group;
|
||||||
|
|
||||||
|
ret = SR_OK;
|
||||||
|
switch (key) {
|
||||||
|
/* TODO */
|
||||||
|
default:
|
||||||
|
return SR_ERR_NA;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
||||||
|
void *cb_data)
|
||||||
|
{
|
||||||
|
(void)sdi;
|
||||||
|
(void)cb_data;
|
||||||
|
|
||||||
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
|
/* TODO: configure hardware, reset acquisition state, set up
|
||||||
|
* callbacks and send header packet. */
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||||
|
{
|
||||||
|
(void)cb_data;
|
||||||
|
|
||||||
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
|
/* TODO: stop acquisition. */
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
|
||||||
|
.name = "conrad-digi-35-cpu",
|
||||||
|
.longname = "Conrad DIGI 35 CPU",
|
||||||
|
.api_version = 1,
|
||||||
|
.init = init,
|
||||||
|
.cleanup = cleanup,
|
||||||
|
.scan = scan,
|
||||||
|
.dev_list = dev_list,
|
||||||
|
.dev_clear = dev_clear,
|
||||||
|
.config_get = config_get,
|
||||||
|
.config_set = config_set,
|
||||||
|
.config_list = config_list,
|
||||||
|
.dev_open = dev_open,
|
||||||
|
.dev_close = dev_close,
|
||||||
|
.dev_acquisition_start = dev_acquisition_start,
|
||||||
|
.dev_acquisition_stop = dev_acquisition_stop,
|
||||||
|
.priv = NULL,
|
||||||
|
};
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the libsigrok project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Matthias Heidbrink <m-sigrok@heidbrink.biz>
|
||||||
|
*
|
||||||
|
* 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 "protocol.h"
|
||||||
|
|
||||||
|
SR_PRIV int conrad_digi_35_cpu_receive_data(int fd, int revents, void *cb_data)
|
||||||
|
{
|
||||||
|
const struct sr_dev_inst *sdi;
|
||||||
|
struct dev_context *devc;
|
||||||
|
|
||||||
|
(void)fd;
|
||||||
|
|
||||||
|
if (!(sdi = cb_data))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (!(devc = sdi->priv))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (revents == G_IO_IN) {
|
||||||
|
/* TODO */
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the libsigrok project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Matthias Heidbrink <m-sigrok@heidbrink.biz>
|
||||||
|
*
|
||||||
|
* 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_CONRAD_DIGI_35_CPU_PROTOCOL_H
|
||||||
|
#define LIBSIGROK_HARDWARE_CONRAD_DIGI_35_CPU_PROTOCOL_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include "libsigrok.h"
|
||||||
|
#include "libsigrok-internal.h"
|
||||||
|
|
||||||
|
/* Message logging helpers with subsystem-specific prefix string. */
|
||||||
|
#define LOG_PREFIX "conrad-digi-35-cpu"
|
||||||
|
|
||||||
|
/** Private, per-device-instance driver context. */
|
||||||
|
struct dev_context {
|
||||||
|
/* Model-specific information */
|
||||||
|
|
||||||
|
/* Acquisition settings */
|
||||||
|
|
||||||
|
/* Operational state */
|
||||||
|
|
||||||
|
/* Temporary state across callbacks */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
SR_PRIV int conrad_digi_35_cpu_receive_data(int fd, int revents, void *cb_data);
|
||||||
|
|
||||||
|
#endif
|
|
@ -143,6 +143,9 @@ extern SR_PRIV struct sr_dev_driver voltcraft_k204_driver_info;
|
||||||
#ifdef HAVE_HW_COLEAD_SLM
|
#ifdef HAVE_HW_COLEAD_SLM
|
||||||
extern SR_PRIV struct sr_dev_driver colead_slm_driver_info;
|
extern SR_PRIV struct sr_dev_driver colead_slm_driver_info;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_HW_CONRAD_DIGI_35_CPU
|
||||||
|
extern SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_HW_DEMO
|
#ifdef HAVE_HW_DEMO
|
||||||
extern SR_PRIV struct sr_dev_driver demo_driver_info;
|
extern SR_PRIV struct sr_dev_driver demo_driver_info;
|
||||||
#endif
|
#endif
|
||||||
|
@ -293,6 +296,9 @@ static struct sr_dev_driver *drivers_list[] = {
|
||||||
#ifdef HAVE_HW_COLEAD_SLM
|
#ifdef HAVE_HW_COLEAD_SLM
|
||||||
&colead_slm_driver_info,
|
&colead_slm_driver_info,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_HW_CONRAD_DIGI_35_CPU
|
||||||
|
&conrad_digi_35_cpu_driver_info,
|
||||||
|
#endif
|
||||||
#ifdef HAVE_HW_DEMO
|
#ifdef HAVE_HW_DEMO
|
||||||
&demo_driver_info,
|
&demo_driver_info,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue