return SR_OK;
}
-static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
+static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
{
int i, ret;
struct context *ctx = sdi->priv;
* The Sigma supports complex triggers using boolean expressions, but this
* has not been implemented yet.
*/
-static int configure_probes(struct sr_dev_inst *sdi, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
{
struct context *ctx = sdi->priv;
const struct sr_probe *probe;
return SR_ST_NOT_FOUND;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
int ret;
- if (!(sdi = sr_dev_inst_get(adi->instances, dev_index)))
- return SR_ERR;
-
ctx = sdi->priv;
if (hwcap == SR_HWCAP_SAMPLERATE) {
return sdi->status;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) {
- sr_err("la8: %s: sdi was NULL", __func__);
- return SR_ERR_BUG;
- }
-
if (!(ctx = sdi->priv)) {
sr_err("la8: %s: sdi->priv was NULL", __func__);
return SR_ERR_BUG;
}
- sr_spew("la8: %s: dev_index %d, hwcap %d", __func__, dev_index, hwcap);
-
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
return SR_OK;
}
-SR_PRIV int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
+SR_PRIV int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
{
struct context *ctx;
SR_PRIV int la8_close_usb_reset_sequencer(struct context *ctx);
SR_PRIV int la8_reset(struct context *ctx);
SR_PRIV int configure_probes(struct context *ctx, const GSList *probes);
-SR_PRIV int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate);
+SR_PRIV int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate);
SR_PRIV int la8_read_block(struct context *ctx);
SR_PRIV void send_block_to_session_bus(struct context *ctx, int block);
return SR_ST_ACTIVE;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
int ret;
const char *stropt;
- /* Avoid compiler warnings. */
- (void)dev_index;
+ (void)sdi;
if (hwcap == SR_HWCAP_PROBECONFIG) {
/* Nothing to do, but must be supported */
SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
static struct sr_dev_driver *fdi = &fx2lafw_driver_info;
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value);
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value);
static int hw_dev_acquisition_stop(int dev_index, void *cb_data);
/**
if (ctx->cur_samplerate == 0) {
/* Samplerate hasn't been set; default to the slowest one. */
- if (hw_dev_config_set(dev_index, SR_HWCAP_SAMPLERATE,
+ if (hw_dev_config_set(sdi, SR_HWCAP_SAMPLERATE,
&supported_samplerates[0]) == SR_ERR)
return SR_ERR;
}
return sdi->status;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
int ret;
- if (!(sdi = sr_dev_inst_get(fdi->instances, dev_index)))
- return SR_ERR;
ctx = sdi->priv;
if (hwcap == SR_HWCAP_SAMPLERATE) {
return sdi->status;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
- sr_err("genericdmm: sdi was NULL.");
- return SR_ERR_BUG;
- }
-
if (!(ctx = sdi->priv)) {
sr_err("genericdmm: sdi->priv was NULL.");
return SR_ERR_BUG;
}
- sr_spew("genericdmm: dev_index %d, hwcap %d.", dev_index, hwcap);
-
switch (hwcap) {
case SR_HWCAP_LIMIT_MSEC:
if (*(const uint64_t *)value == 0) {
return sdi->status;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
struct sr_rational tmp_rat;
float tmp_float;
int ret, i;
char **targets;
- if (!(sdi = sr_dev_inst_get(hdi->instances, dev_index)))
- return SR_ERR;
-
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
return sdi->status;
}
-static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
+static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
{
struct context *ctx;
return SR_OK;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
int ret;
const uint64_t *tmp_u64;
- if (!(sdi = sr_dev_inst_get(odi->instances, dev_index)))
- return SR_ERR;
ctx = sdi->priv;
if (sdi->status != SR_ST_ACTIVE)
struct sr_usb_dev_inst *usb;
};
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value);
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, 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, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
{
struct context *ctx;
const struct sr_probe *probe;
if (ctx->cur_samplerate == 0) {
/* Samplerate hasn't been set. Default to the slowest one. */
- if (hw_dev_config_set(dev_index, SR_HWCAP_SAMPLERATE,
+ if (hw_dev_config_set(sdi, SR_HWCAP_SAMPLERATE,
&samplerates.list[0]) == SR_ERR)
return SR_ERR;
}
return SR_ST_NOT_FOUND;
}
-static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
+static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
{
struct context *ctx;
return SR_OK;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
- struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
- sr_err("zp: %s: sdi was NULL", __func__);
- return SR_ERR;
- }
-
if (!(ctx = sdi->priv)) {
sr_err("zp: %s: sdi->priv was NULL", __func__);
return SR_ERR_ARG;
int (*info_get) (int dev_info_id, const void **data,
const struct sr_dev_inst *sdi);
int (*dev_status_get) (int dev_index);
- int (*dev_config_set) (int dev_index, int hwcap, const void *value);
+ int (*dev_config_set) (const struct sr_dev_inst *sdi, 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);
return SR_ERR;
}
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+ const void *value)
{
struct session_vdev *vdev;
const uint64_t *tmp_u64;
- if (!(vdev = get_vdev_by_index(dev_index)))
- return SR_ERR;
+ vdev = sdi->priv;
switch (hwcap) {
case SR_HWCAP_SAMPLERATE: