X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fasix-sigma%2Fasix-sigma.c;h=ed32e6a5ae93516f2350ffb32883c74031eaee67;hb=161a8a272699a7b818ddab01043838f07d7cf6eb;hp=10e2e3707efea528ec10f29da7bfd54288c7c677;hpb=228b2cccaf2773efa81891273e2cf32ce6f14b2f;p=libsigrok.git diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 10e2e370..ed32e6a5 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -93,7 +93,6 @@ static const int hwcaps[] = { SR_HWCAP_LOGIC_ANALYZER, SR_HWCAP_SAMPLERATE, SR_HWCAP_CAPTURE_RATIO, - SR_HWCAP_PROBECONFIG, SR_HWCAP_LIMIT_MSEC, 0, @@ -407,7 +406,7 @@ static int bin2bitbang(const char *filename, return SR_OK; } -static void clear_instances(void) +static int clear_instances(void) { GSList *l; struct sr_dev_inst *sdi; @@ -432,6 +431,7 @@ static void clear_instances(void) g_slist_free(drvc->instances); drvc->instances = NULL; + return SR_OK; } static int hw_init(void) @@ -532,6 +532,15 @@ free: return NULL; } +static GSList *hw_dev_list(void) +{ + struct drv_context *drvc; + + drvc = adi->priv; + + return drvc->instances; +} + static int upload_firmware(int firmware_idx, struct dev_context *devc) { int ret; @@ -689,7 +698,7 @@ static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate) * The Sigma supports complex triggers using boolean expressions, but this * has not been implemented yet. */ -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 = sdi->priv; const struct sr_probe *probe; @@ -699,7 +708,7 @@ static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes) memset(&devc->trigger, 0, sizeof(struct sigma_trigger)); - for (l = probes; l; l = l->next) { + for (l = sdi->probes; l; l = l->next) { probe = (struct sr_probe *)l->data; probebit = 1 << (probe->index); @@ -837,8 +846,6 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, if (hwcap == SR_HWCAP_SAMPLERATE) { ret = set_samplerate(sdi, *(const uint64_t *)value); - } else if (hwcap == SR_HWCAP_PROBECONFIG) { - ret = configure_probes(sdi, value); } else if (hwcap == SR_HWCAP_LIMIT_MSEC) { devc->limit_msec = *(const uint64_t *)value; if (devc->limit_msec > 0) @@ -1292,6 +1299,11 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, devc = sdi->priv; + if (configure_probes(sdi) != SR_OK) { + sr_err("asix-sigma: failed to configured probes"); + return SR_ERR; + } + /* If the samplerate has not been set, default to 200 kHz. */ if (devc->cur_firmware == -1) { if ((ret = set_samplerate(sdi, SR_KHZ(200))) != SR_OK) @@ -1453,6 +1465,8 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = { .init = hw_init, .cleanup = hw_cleanup, .scan = hw_scan, + .dev_list = hw_dev_list, + .dev_clear = clear_instances, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .info_get = hw_info_get,