X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-util.git;a=blobdiff_plain;f=source%2Fdrv-api.c;h=824027f962c9c265746ea73e96e736fa4c6c9fea;hp=0ef289d96be76a0841a8cb790f0d785500a8710e;hb=4dfd6eced5f2a8c5136bee4d76f25ef304bee643;hpb=5b10d8fd7675ea51ed3da57105df359e18c84481 diff --git a/source/drv-api.c b/source/drv-api.c index 0ef289d..824027f 100644 --- a/source/drv-api.c +++ b/source/drv-api.c @@ -17,18 +17,17 @@ * along with this program. If not, see . */ +#include #include "protocol.h" SR_PRIV struct sr_dev_driver ${lib}_driver_info; -static struct sr_dev_driver *di = &${lib}_driver_info; - -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); } -static GSList *scan(GSList *options) +static GSList *scan(struct sr_dev_driver *di, GSList *options) { struct drv_context *drvc; GSList *devices; @@ -36,7 +35,7 @@ static GSList *scan(GSList *options) (void)options; devices = NULL; - drvc = di->priv; + drvc = di->context; drvc->instances = NULL; /* TODO: scan for devices, either based on a SR_CONF_CONN option @@ -45,16 +44,12 @@ static GSList *scan(GSList *options) return devices; } -static GSList *dev_list(void) +static GSList *dev_list(const struct sr_dev_driver *di) { - struct drv_context *drvc; - - drvc = di->priv; - - return drvc->instances; + return ((struct drv_context *)(di->context))->instances; } -static int dev_clear(void) +static int dev_clear(const struct sr_dev_driver *di) { return std_dev_clear(di, NULL); } @@ -81,21 +76,23 @@ 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); /* TODO: free other driver resources, if any. */ return SR_OK; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi) +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { int ret; (void)sdi; (void)data; + (void)cg; ret = SR_OK; switch (key) { @@ -107,11 +104,13 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi) return ret; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi) +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { int ret; (void)data; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -126,12 +125,14 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi) return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { int ret; (void)sdi; (void)data; + (void)cg; ret = SR_OK; switch (key) { @@ -144,7 +145,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) } static int dev_acquisition_start(const struct sr_dev_inst *sdi, - void *cb_data) + void *cb_data) { (void)sdi; (void)cb_data; @@ -186,5 +187,5 @@ SR_PRIV struct sr_dev_driver ${lib}_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };