]> sigrok.org Git - libsigrok.git/blobdiff - hardware/zeroplus-logic-cube/zeroplus.c
sr: Made sample rate lists const
[libsigrok.git] / hardware / zeroplus-logic-cube / zeroplus.c
index 1b779878b9be8205700ea050109a4781bcd49ccc..808b705343acc6140b67b06e39b7c08ec640d8da 100644 (file)
@@ -114,7 +114,7 @@ static libusb_context *usb_context = NULL;
  * TODO: We shouldn't support 150MHz and 200MHz on devices that don't go up
  * that high.
  */
-static uint64_t supported_samplerates[] = {
+static const uint64_t supported_samplerates[] = {
        SR_HZ(100),
        SR_HZ(500),
        SR_KHZ(1),
@@ -136,7 +136,7 @@ static uint64_t supported_samplerates[] = {
        0,
 };
 
-static struct sr_samplerates samplerates = {
+static const struct sr_samplerates samplerates = {
        0,
        0,
        0,
@@ -157,7 +157,7 @@ struct context {
        struct sr_usb_dev_inst *usb;
 };
 
-static int hw_dev_config_set(int dev_index, int hwcap, void *value);
+static int hw_dev_config_set(int dev_index, int hwcap, const void *value);
 
 static unsigned int get_memory_size(int type)
 {
@@ -282,11 +282,11 @@ static void close_dev(struct sr_dev_inst *sdi)
        sdi->status = SR_ST_INACTIVE;
 }
 
-static int configure_probes(struct sr_dev_inst *sdi, GSList *probes)
+static int configure_probes(struct sr_dev_inst *sdi, const GSList *probes)
 {
        struct context *ctx;
-       struct sr_probe *probe;
-       GSList *l;
+       const struct sr_probe *probe;
+       const GSList *l;
        int probe_bit, stage, i;
        char *tc;
 
@@ -499,11 +499,11 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static void *hw_dev_info_get(int dev_index, int dev_info_id)
+static const void *hw_dev_info_get(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct context *ctx;
-       void *info;
+       const void *info;
 
        if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("zp: %s: sdi was NULL", __func__);
@@ -599,7 +599,7 @@ static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
        return SR_OK;
 }
 
-static int hw_dev_config_set(int dev_index, int hwcap, void *value)
+static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
 {
        struct sr_dev_inst *sdi;
        struct context *ctx;
@@ -616,11 +616,11 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
 
        switch (hwcap) {
        case SR_HWCAP_SAMPLERATE:
-               return set_samplerate(sdi, *(uint64_t *)value);
+               return set_samplerate(sdi, *(const uint64_t *)value);
        case SR_HWCAP_PROBECONFIG:
-               return configure_probes(sdi, (GSList *)value);
+               return configure_probes(sdi, (const GSList *)value);
        case SR_HWCAP_LIMIT_SAMPLES:
-               ctx->limit_samples = *(uint64_t *)value;
+               ctx->limit_samples = *(const uint64_t *)value;
                return SR_OK;
        default:
                return SR_ERR;