]> sigrok.org Git - libsigrok.git/blobdiff - hardware/demo/demo.c
sr: Made sample rate lists const
[libsigrok.git] / hardware / demo / demo.c
index ca572af8a009e6892e2a6b62446997722d86b02e..e511c0a6fac22340ee8a860cac571836ae0d0b22 100644 (file)
@@ -86,7 +86,7 @@ static const int hwcaps[] = {
        SR_HWCAP_CONTINUOUS,
 };
 
-static struct sr_samplerates samplerates = {
+static const struct sr_samplerates samplerates = {
        SR_HZ(1),
        SR_GHZ(1),
        SR_HZ(1),
@@ -184,10 +184,10 @@ 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;
-       void *info = NULL;
+       const void *info = NULL;
 
        if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("demo: %s: sdi was NULL", __func__);
@@ -231,10 +231,10 @@ static const int *hw_hwcap_get_all(void)
        return hwcaps;
 }
 
-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)
 {
        int ret;
-       char *stropt;
+       const char *stropt;
 
        /* Avoid compiler warnings. */
        (void)dev_index;
@@ -243,17 +243,17 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
                /* Nothing to do, but must be supported */
                ret = SR_OK;
        } else if (hwcap == SR_HWCAP_SAMPLERATE) {
-               cur_samplerate = *(uint64_t *)value;
+               cur_samplerate = *(const uint64_t *)value;
                sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
                       cur_samplerate);
                ret = SR_OK;
        } else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
-               limit_samples = *(uint64_t *)value;
+               limit_samples = *(const uint64_t *)value;
                sr_dbg("demo: %s: setting limit_samples to %" PRIu64, __func__,
                       limit_samples);
                ret = SR_OK;
        } else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
-               limit_msec = *(uint64_t *)value;
+               limit_msec = *(const uint64_t *)value;
                sr_dbg("demo: %s: setting limit_msec to %" PRIu64, __func__,
                       limit_msec);
                ret = SR_OK;