]> sigrok.org Git - libsigrok.git/blobdiff - hardware/asix-sigma/asix-sigma.c
Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
[libsigrok.git] / hardware / asix-sigma / asix-sigma.c
index 2ddbbea9bc684e272f7c5f5054eec17e25911694..1a56cf3999830168657df9c86202bac679e702b1 100644 (file)
@@ -383,26 +383,26 @@ static int bin2bitbang(const char *filename,
 static void clear_helper(void *priv)
 {
        struct dev_context *devc;
-       
+
        devc = priv;
 
        ftdi_deinit(&devc->ftdic);
 }
 
-static int clear_instances(void)
+static int dev_clear(void)
 {
        return std_dev_clear(di, clear_helper);
 }
 
 static int init(struct sr_context *sr_ctx)
 {
-       return std_hw_init(sr_ctx, di, LOG_PREFIX);
+       return std_init(sr_ctx, di, LOG_PREFIX);
 }
 
 static GSList *scan(GSList *options)
 {
        struct sr_dev_inst *sdi;
-       struct sr_probe *probe;
+       struct sr_channel *probe;
        struct drv_context *drvc;
        struct dev_context *devc;
        GSList *devices;
@@ -654,7 +654,7 @@ static int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate)
 static int configure_probes(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc = sdi->priv;
-       const struct sr_probe *probe;
+       const struct sr_channel *probe;
        const GSList *l;
        int trigger_set = 0;
        int probebit;
@@ -662,7 +662,7 @@ static int configure_probes(const struct sr_dev_inst *sdi)
        memset(&devc->trigger, 0, sizeof(struct sigma_trigger));
 
        for (l = sdi->probes; l; l = l->next) {
-               probe = (struct sr_probe *)l->data;
+               probe = (struct sr_channel *)l->data;
                probebit = 1 << (probe->index);
 
                if (!probe->enabled || !probe->trigger)
@@ -741,13 +741,16 @@ static int dev_close(struct sr_dev_inst *sdi)
 
 static int cleanup(void)
 {
-       return clear_instances();
+       return dev_clear();
 }
 
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
+       (void)cg;
+
        switch (id) {
        case SR_CONF_SAMPLERATE:
                if (sdi) {
@@ -763,11 +766,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
+static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        int ret;
 
+       (void)cg;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -794,12 +800,14 @@ static int config_set(int id, 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(int key, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        GVariant *gvar;
        GVariantBuilder gvb;
 
        (void)sdi;
+       (void)cg;
 
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
@@ -1053,7 +1061,7 @@ static int receive_data(int fd, int revents, void *cb_data)
 
                /* Find first ts. */
                if (devc->state.chunks_downloaded == 0) {
-                       devc->state.lastts = *(uint16_t *) buf - 1;
+                       devc->state.lastts = RL16(buf) - 1;
                        devc->state.lastsample = 0;
                }
 
@@ -1398,7 +1406,7 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = clear_instances,
+       .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,