]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/asix-sigma/api.c
sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / asix-sigma / api.c
index 99c1ef143ffce470954745e4717d7813773aa45a..676be07f2d0f86e122d461f1241dc2f9e448dde3 100644 (file)
@@ -50,13 +50,14 @@ static const uint32_t devopts[] = {
 #endif
 };
 
+#if ASIX_SIGMA_WITH_TRIGGER
 static const int32_t trigger_matches[] = {
        SR_TRIGGER_ZERO,
        SR_TRIGGER_ONE,
        SR_TRIGGER_RISING,
        SR_TRIGGER_FALLING,
 };
-
+#endif
 
 static int dev_clear(const struct sr_dev_driver *di)
 {
@@ -160,9 +161,7 @@ static int dev_close(struct sr_dev_inst *sdi)
 
        devc = sdi->priv;
 
-       /* TODO */
-       if (sdi->status == SR_ST_ACTIVE)
-               ftdi_usb_close(&devc->ftdic);
+       ftdi_usb_close(&devc->ftdic);
 
        sdi->status = SR_ST_INACTIVE;
 
@@ -211,9 +210,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
@@ -298,9 +294,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        uint8_t clock_bytes[sizeof(clockselect)];
        size_t clock_idx;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (sigma_convert_trigger(sdi) != SR_OK) {
@@ -388,7 +381,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                           (devc->capture_ratio * 255) / 100, devc);
 
        /* Start acqusition. */
-       gettimeofday(&devc->start_tv, 0);
+       devc->start_time = g_get_monotonic_time();
        regval =  WMR_TRGRES | WMR_SDRAMWRITEEN;
 #if ASIX_SIGMA_WITH_TRIGGER
        regval |= WMR_TRGEN;