X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fzeroplus-logic-cube%2Fzeroplus.c;h=c22f9458418aee2524ab19cf7d1431312a7e469f;hb=6f22a8ef2ccf7091324b41b553632695507215a7;hp=7dcda9cfd4dcc46310df96fcbad8a3ea9130eb3f;hpb=fabe59b326c8ed17582f54d5525b278b6712085b;p=libsigrok.git diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 7dcda9cf..c22f9458 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -24,7 +24,6 @@ #include #include #include -#include "config.h" #include "libsigrok.h" #include "libsigrok-internal.h" #include "analyzer.h" @@ -72,7 +71,6 @@ static model_t zeroplus_models[] = { static const int hwcaps[] = { SR_HWCAP_LOGIC_ANALYZER, SR_HWCAP_SAMPLERATE, - SR_HWCAP_PROBECONFIG, SR_HWCAP_CAPTURE_RATIO, /* These are really implemented in the driver, not the hardware. */ @@ -148,11 +146,6 @@ static const struct sr_samplerates samplerates = { supported_samplerates, }; -/* Private driver context. */ -struct drv_context { - GSList *instances; -}; - /* Private, per-device-instance driver context. */ struct dev_context { uint64_t cur_samplerate; @@ -186,7 +179,7 @@ static unsigned int get_memory_size(int type) return 0; } -static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes) +static int configure_probes(const struct sr_dev_inst *sdi) { struct dev_context *devc; const struct sr_probe *probe; @@ -204,7 +197,7 @@ static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes) } stage = -1; - for (l = probes; l; l = l->next) { + for (l = sdi->probes; l; l = l->next) { probe = (struct sr_probe *)l->data; if (probe->enabled == FALSE) continue; @@ -227,7 +220,7 @@ static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes) return SR_OK; } -static void clear_instances(void) +static int clear_instances(void) { GSList *l; struct sr_dev_inst *sdi; @@ -251,6 +244,7 @@ static void clear_instances(void) g_slist_free(drvc->instances); drvc->instances = NULL; + return SR_OK; } /* @@ -355,6 +349,15 @@ static GSList *hw_scan(GSList *options) return devices; } +static GSList *hw_dev_list(void) +{ + struct drv_context *drvc; + + drvc = zdi->priv; + + return drvc->instances; +} + static int hw_dev_open(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -571,8 +574,6 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, switch (hwcap) { case SR_HWCAP_SAMPLERATE: return set_samplerate(sdi, *(const uint64_t *)value); - case SR_HWCAP_PROBECONFIG: - return configure_probes(sdi, (const GSList *)value); case SR_HWCAP_LIMIT_SAMPLES: devc->limit_samples = *(const uint64_t *)value; return SR_OK; @@ -599,6 +600,11 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, return SR_ERR_ARG; } + if (configure_probes(sdi) != SR_OK) { + sr_err("zp: failed to configured probes"); + return SR_ERR; + } + /* push configured settings to device */ analyzer_configure(devc->usb->devhdl); @@ -685,6 +691,8 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = { .init = hw_init, .cleanup = hw_cleanup, .scan = hw_scan, + .dev_list = hw_dev_list, + .dev_clear = hw_cleanup, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get,