]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Implemented SR_HWCAP_PROBECONFIG and SR_HWCAP_LIMIT_SAMPLES
authorJoel Holdsworth <redacted>
Wed, 29 Feb 2012 22:47:05 +0000 (22:47 +0000)
committerJoel Holdsworth <redacted>
Wed, 7 Mar 2012 07:51:39 +0000 (07:51 +0000)
hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h

index 20be9f8469319a9dda9c1ca5082f6906533f23f3..9cc97f21d1dcdaf30ab579018c2837159cbd77f2 100644 (file)
@@ -442,6 +442,8 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id)
                return &fx2lafw_samplerates;
        case SR_DI_TRIGGER_TYPES:
                return TRIGGER_TYPES;
+       case SR_DI_CUR_SAMPLERATE:
+               return &ctx->cur_samplerate;
        }
 
        return NULL;
@@ -473,7 +475,12 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
                return SR_ERR;
        ctx = sdi->priv;
 
-       if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
+       if (hwcap == SR_HWCAP_SAMPLERATE) {
+               ctx->cur_samplerate = *(uint64_t *)value;
+               ret = SR_OK;
+       } else if (hwcap == SR_HWCAP_PROBECONFIG) {
+               ret = SR_OK;
+       } else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
                ctx->limit_samples = *(uint64_t *)value;
                ret = SR_OK;
        } else {
@@ -631,7 +638,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
        packet->payload = header;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
-       header->samplerate = 24000000UL;
+       header->samplerate = ctx->cur_samplerate;
        header->num_logic_probes = ctx->profile->num_probes;
        sr_session_send(cb_data, packet);
        g_free(header);
index 4b830cd00f265d0162f9bf07fa7b4f2acd5d3b0b..6da663c90f5a66c102785f5ada10cb87f6123cb6 100644 (file)
@@ -55,6 +55,7 @@ struct context {
        GTimeVal fw_updated;
 
        /* Device/Capture Settings */
+       uint64_t cur_samplerate;
        uint64_t limit_samples;
 
        void *session_dev_id;