X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fyokogawa-dlm%2Fapi.c;h=1bbab68992fa8fac96b3a7585e66d7ff70558963;hb=da005885c8ebbf98772f75126764f758b2640d11;hp=b4a1305babdd5407ad8db5dbab6bc80d5331c4bb;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index b4a1305b..1bbab689 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -22,10 +22,9 @@ #include "protocol.h" SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info; -static struct sr_dev_driver *di = &yokogawa_dlm_driver_info; -static char *MANUFACTURER_ID = "YOKOGAWA"; -static char *MANUFACTURER_NAME = "Yokogawa"; +static const char *MANUFACTURER_ID = "YOKOGAWA"; +static const char *MANUFACTURER_NAME = "Yokogawa"; static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, @@ -39,7 +38,7 @@ enum { CG_DIGITAL, }; -static int init(struct sr_context *sr_ctx) +static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { return std_init(sr_ctx, di, LOG_PREFIX); } @@ -80,7 +79,7 @@ static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi) devc = g_malloc0(sizeof(struct dev_context)); - sdi->driver = di; + sdi->driver = &yokogawa_dlm_driver_info; sdi->priv = devc; sdi->inst_type = SR_INST_SCPI; sdi->conn = scpi; @@ -98,18 +97,17 @@ fail: sr_scpi_hw_info_free(hw_info); if (sdi) sr_dev_inst_free(sdi); - if (devc) - g_free(devc); + g_free(devc); return NULL; } -static GSList *scan(GSList *options) +static GSList *scan(struct sr_dev_driver *di, GSList *options) { return sr_scpi_scan(di->priv, options, probe_usbtmc_device); } -static GSList *dev_list(void) +static GSList *dev_list(const struct sr_dev_driver *di) { return ((struct drv_context *)(di->priv))->instances; } @@ -127,7 +125,7 @@ static void clear_helper(void *priv) g_free(devc); } -static int dev_clear(void) +static int dev_clear(const struct sr_dev_driver *di) { return std_dev_clear(di, clear_helper); } @@ -157,9 +155,9 @@ static int dev_close(struct sr_dev_inst *sdi) return SR_OK; } -static int cleanup(void) +static int cleanup(const struct sr_dev_driver *di) { - dev_clear(); + dev_clear(di); return SR_OK; } @@ -179,7 +177,7 @@ static int check_channel_group(struct dev_context *devc, const struct sr_channel_group *cg) { unsigned int i; - struct scope_config *model; + const struct scope_config *model; model = devc->model_config; @@ -204,7 +202,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s int ret, cg_type; unsigned int i; struct dev_context *devc; - struct scope_config *model; + const struct scope_config *model; struct scope_state *state; if (!sdi || !(devc = sdi->priv)) @@ -218,7 +216,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s state = devc->model_state; switch (key) { - case SR_CONF_NUM_TIMEBASE: + case SR_CONF_NUM_HDIV: *data = g_variant_new_int32(model->num_xdivs); ret = SR_OK; break; @@ -323,7 +321,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd unsigned int i, j; char float_str[30]; struct dev_context *devc; - struct scope_config *model; + const struct scope_config *model; struct scope_state *state; const char *tmp; uint64_t p, q; @@ -475,7 +473,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * { int cg_type = CG_NONE; struct dev_context *devc = NULL; - struct scope_config *model = NULL; + const struct scope_config *model = NULL; if (sdi && (devc = sdi->priv)) { if ((cg_type = check_channel_group(devc, cg)) == CG_INVALID) @@ -573,7 +571,7 @@ static int dlm_setup_channels(const struct sr_dev_inst *sdi) unsigned int i; gboolean *pod_enabled, setup_changed; struct scope_state *state; - struct scope_config *model; + const struct scope_config *model; struct sr_channel *ch; struct dev_context *devc; struct sr_scpi_dev_inst *scpi;