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)
{
struct sr_dev_inst *sdi;
struct context *ctx;
case SR_HWCAP_PROBECONFIG:
return SR_OK;
case SR_HWCAP_SAMPLERATE:
- ctx->cur_rate = *(uint64_t *)value;
+ ctx->cur_rate = *(const uint64_t *)value;
return SR_OK;
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;
* The Sigma supports complex triggers using boolean expressions, but this
* has not been implemented yet.
*/
-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 = sdi->priv;
- struct sr_probe *probe;
- GSList *l;
+ const struct sr_probe *probe;
+ const GSList *l;
int trigger_set = 0;
int probebit;
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)
{
struct sr_dev_inst *sdi;
struct context *ctx;
ctx = sdi->priv;
if (hwcap == SR_HWCAP_SAMPLERATE) {
- ret = set_samplerate(sdi, *(uint64_t *)value);
+ ret = set_samplerate(sdi, *(const uint64_t *)value);
} else if (hwcap == SR_HWCAP_PROBECONFIG) {
ret = configure_probes(sdi, value);
} else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
- ctx->limit_msec = *(uint64_t *)value;
+ ctx->limit_msec = *(const uint64_t *)value;
if (ctx->limit_msec > 0)
ret = SR_OK;
else
ret = SR_ERR;
} else if (hwcap == SR_HWCAP_CAPTURE_RATIO) {
- ctx->capture_ratio = *(uint64_t *)value;
+ ctx->capture_ratio = *(const uint64_t *)value;
if (ctx->capture_ratio < 0 || ctx->capture_ratio > 100)
ret = SR_ERR;
else
return SR_OK;
}
-static int configure_probes(struct context *ctx, GSList *probes)
+static int configure_probes(struct context *ctx, const GSList *probes)
{
- struct sr_probe *probe;
- GSList *l;
+ const struct sr_probe *probe;
+ const GSList *l;
uint8_t probe_bit;
char *tc;
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)
{
struct sr_dev_inst *sdi;
struct context *ctx;
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
- if (set_samplerate(sdi, *(uint64_t *)value) == SR_ERR) {
+ if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
sr_err("la8: %s: setting samplerate failed.", __func__);
return SR_ERR;
}
sr_dbg("la8: SAMPLERATE = %" PRIu64, ctx->cur_samplerate);
break;
case SR_HWCAP_PROBECONFIG:
- if (configure_probes(ctx, (GSList *)value) != SR_OK) {
+ if (configure_probes(ctx, (const GSList *)value) != SR_OK) {
sr_err("la8: %s: probe config failed.", __func__);
return SR_ERR;
}
break;
case SR_HWCAP_LIMIT_MSEC:
- if (*(uint64_t *)value == 0) {
+ if (*(const uint64_t *)value == 0) {
sr_err("la8: %s: LIMIT_MSEC can't be 0.", __func__);
return SR_ERR;
}
- ctx->limit_msec = *(uint64_t *)value;
+ ctx->limit_msec = *(const uint64_t *)value;
sr_dbg("la8: LIMIT_MSEC = %" PRIu64, ctx->limit_msec);
break;
case SR_HWCAP_LIMIT_SAMPLES:
- if (*(uint64_t *)value < MIN_NUM_SAMPLES) {
+ if (*(const uint64_t *)value < MIN_NUM_SAMPLES) {
sr_err("la8: %s: LIMIT_SAMPLES too small.", __func__);
return SR_ERR;
}
- ctx->limit_samples = *(uint64_t *)value;
+ ctx->limit_samples = *(const uint64_t *)value;
sr_dbg("la8: LIMIT_SAMPLES = %" PRIu64, ctx->limit_samples);
break;
default:
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;
/* 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;
static GSList *dev_insts = NULL;
static libusb_context *usb_context = NULL;
-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 int hw_dev_acquisition_stop(int dev_index, void *cb_data);
/**
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)
{
struct sr_dev_inst *sdi;
struct context *ctx;
ctx = sdi->priv;
if (hwcap == SR_HWCAP_SAMPLERATE) {
- ctx->cur_samplerate = *(uint64_t *)value;
+ ctx->cur_samplerate = *(const uint64_t *)value;
ret = SR_OK;
} else if (hwcap == SR_HWCAP_PROBECONFIG) {
ret = configure_probes(ctx, (GSList *) value);
} else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
- ctx->limit_samples = *(uint64_t *)value;
+ ctx->limit_samples = *(const uint64_t *)value;
ret = SR_OK;
} else {
ret = SR_ERR;
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)
{
struct sr_dev_inst *sdi;
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
- return mso_configure_rate(sdi, *(uint64_t *) value);
+ return mso_configure_rate(sdi, *(const uint64_t *) value);
case SR_HWCAP_PROBECONFIG:
case SR_HWCAP_LIMIT_SAMPLES:
default:
return SR_OK;
}
-static int configure_probes(struct context *ctx, GSList *probes)
+static int configure_probes(struct context *ctx, const GSList *probes)
{
- struct sr_probe *probe;
- GSList *l;
+ const struct sr_probe *probe;
+ const GSList *l;
int probe_bit, stage, i;
char *tc;
ctx->num_stages = 0;
for (l = probes; l; l = l->next) {
- probe = (struct sr_probe *)l->data;
+ probe = (const struct sr_probe *)l->data;
if (!probe->enabled)
continue;
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;
int ret;
- uint64_t *tmp_u64;
+ const uint64_t *tmp_u64;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
- ret = set_samplerate(sdi, *(uint64_t *)value);
+ ret = set_samplerate(sdi, *(const uint64_t *)value);
break;
case SR_HWCAP_PROBECONFIG:
- ret = configure_probes(ctx, (GSList *)value);
+ ret = configure_probes(ctx, (const GSList *)value);
break;
case SR_HWCAP_LIMIT_SAMPLES:
tmp_u64 = value;
ret = SR_OK;
break;
case SR_HWCAP_CAPTURE_RATIO:
- ctx->capture_ratio = *(uint64_t *)value;
+ ctx->capture_ratio = *(const uint64_t *)value;
if (ctx->capture_ratio < 0 || ctx->capture_ratio > 100) {
ctx->capture_ratio = 0;
ret = SR_ERR;
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)
{
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;
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;
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;
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)
{
struct session_vdev *vdev;
- uint64_t *tmp_u64;
+ const uint64_t *tmp_u64;
if (!(vdev = get_vdev_by_index(dev_index)))
return SR_ERR;
const void *(*dev_info_get) (int dev_index, int dev_info_id);
int (*dev_status_get) (int dev_index);
const int *(*hwcap_get_all) (void);
- int (*dev_config_set) (int dev_index, int hwcap, void *value);
+ int (*dev_config_set) (int dev_index, int hwcap, const void *value);
int (*dev_acquisition_start) (int dev_index, void *session_dev_id);
int (*dev_acquisition_stop) (int dev_index, void *session_dev_id);
};