]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la8/api.c
Rename various *PROBE* macros to *CHANNEL*.
[libsigrok.git] / hardware / chronovu-la8 / api.c
index ec4bf35f03ebc29d44fea57fbb78960bdfdaf97f..896ee74ae51f746a7b89c59c8ed3c43cbb7afe78 100644 (file)
@@ -79,7 +79,7 @@ static int init(struct sr_context *sr_ctx)
 static GSList *scan(GSList *options)
 {
        struct sr_dev_inst *sdi;
-       struct sr_probe *probe;
+       struct sr_channel *ch;
        struct drv_context *drvc;
        struct dev_context *devc;
        GSList *devices;
@@ -107,7 +107,7 @@ static GSList *scan(GSList *options)
        memset(devc->mangled_buf, 0, BS);
        devc->final_buf = NULL;
        devc->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */
-       devc->trigger_mask = 0x00; /* All probes are "don't care". */
+       devc->trigger_mask = 0x00; /* All channels are "don't care". */
        devc->trigger_timeout = 10; /* Default to 10s trigger timeout. */
        devc->trigger_found = 0;
        devc->done = 0;
@@ -153,11 +153,11 @@ static GSList *scan(GSList *options)
        sdi->driver = di;
        sdi->priv = devc;
 
-       for (i = 0; chronovu_la8_probe_names[i]; i++) {
-               if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
-                                          chronovu_la8_probe_names[i])))
+       for (i = 0; chronovu_la8_channel_names[i]; i++) {
+               if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+                                          chronovu_la8_channel_names[i])))
                        return NULL;
-               sdi->probes = g_slist_append(sdi->probes, probe);
+               sdi->channels = g_slist_append(sdi->channels, ch);
        }
 
        devices = g_slist_append(devices, sdi);
@@ -262,10 +262,13 @@ static int cleanup(void)
        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) {
@@ -283,10 +286,13 @@ 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;
 
+       (void)cg;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -326,12 +332,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-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;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
 
        (void)sdi;
+       (void)cg;
 
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
@@ -350,6 +358,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
                g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar);
                *data = g_variant_builder_end(&gvb);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               grange[0] = g_variant_new_uint64(0);
+               grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        case SR_CONF_TRIGGER_TYPE:
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
@@ -433,8 +446,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR;
        }
 
-       if (configure_probes(sdi) != SR_OK) {
-               sr_err("Failed to configure probes.");
+       if (configure_channels(sdi) != SR_OK) {
+               sr_err("Failed to configure channels.");
                return SR_ERR;
        }