]> sigrok.org Git - libsigrok.git/commitdiff
zeroplus-logic-cube: fix samplerate setting
authorBert Vermeulen <redacted>
Sun, 31 Mar 2013 18:47:01 +0000 (20:47 +0200)
committerBert Vermeulen <redacted>
Thu, 11 Apr 2013 16:32:07 +0000 (18:32 +0200)
hardware/zeroplus-logic-cube/api.c
hardware/zeroplus-logic-cube/protocol.c
hardware/zeroplus-logic-cube/protocol.h

index eca4bea483cf530df2217762c9506bf436ef0f6d..240de8e6ca894eb53dfe2910aaf94ac95fcbe883 100644 (file)
@@ -210,6 +210,33 @@ static int configure_probes(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
+SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate)
+{
+       int i;
+
+       for (i = 0; ARRAY_SIZE(samplerates_200); i++)
+               if (samplerate == samplerates_200[i])
+                       break;
+
+       if (i == ARRAY_SIZE(samplerates_200) || samplerate > devc->max_samplerate) {
+               sr_err("Unsupported samplerate: %" PRIu64 "Hz.", samplerate);
+               return SR_ERR_ARG;
+       }
+
+       sr_info("Setting samplerate to %" PRIu64 "Hz.", samplerate);
+
+       if (samplerate >= SR_MHZ(1))
+               analyzer_set_freq(samplerate / SR_MHZ(1), FREQ_SCALE_MHZ);
+       else if (samplerate >= SR_KHZ(1))
+               analyzer_set_freq(samplerate / SR_KHZ(1), FREQ_SCALE_KHZ);
+       else
+               analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
+
+       devc->cur_samplerate = samplerate;
+
+       return SR_OK;
+}
+
 static int clear_instances(void)
 {
        GSList *l;
index 268be5dd9fea5f4d88f21c2b42e9a3a7ddb38803..e9d158b9ae5a03642f54be805e45d7bdff490813 100644 (file)
@@ -33,33 +33,6 @@ SR_PRIV unsigned int get_memory_size(int type)
                return 0;
 }
 
-SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate)
-{
-       int i;
-
-       for (i = 0; zp_supported_samplerates_200[i]; i++)
-               if (samplerate == zp_supported_samplerates_200[i])
-                       break;
-
-       if (!zp_supported_samplerates_200[i] || samplerate > devc->max_samplerate) {
-               sr_err("Unsupported samplerate: %" PRIu64 "Hz.", samplerate);
-               return SR_ERR_ARG;
-       }
-
-       sr_info("Setting samplerate to %" PRIu64 "Hz.", samplerate);
-
-       if (samplerate >= SR_MHZ(1))
-               analyzer_set_freq(samplerate / SR_MHZ(1), FREQ_SCALE_MHZ);
-       else if (samplerate >= SR_KHZ(1))
-               analyzer_set_freq(samplerate / SR_KHZ(1), FREQ_SCALE_KHZ);
-       else
-               analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
-
-       devc->cur_samplerate = samplerate;
-
-       return SR_OK;
-}
-
 SR_PRIV int set_limit_samples(struct dev_context *devc, uint64_t samples)
 {
        devc->limit_samples = samples;
index 30b217dac12a3f3a44323a13bc33e529f99d2516..ee710cd3b3c069f69722ed55fcc26dc6d2e19329 100644 (file)
@@ -55,8 +55,6 @@ struct dev_context {
        const struct zp_model *prof;
 };
 
-extern const uint64_t zp_supported_samplerates_200[];
-
 SR_PRIV unsigned int get_memory_size(int type);
 SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate);
 SR_PRIV int set_limit_samples(struct dev_context *devc, uint64_t samples);