]> sigrok.org Git - libsigrok.git/blobdiff - hardware/zeroplus-logic-cube/api.c
Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
[libsigrok.git] / hardware / zeroplus-logic-cube / api.c
index 74b3f0f3d5ef003278fdc6c24536153e1000d077..f30551e828e5287531d1c7e3e9d8508b1c3bec0f 100644 (file)
@@ -127,7 +127,7 @@ static int dev_close(struct sr_dev_inst *sdi);
 static int configure_probes(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
-       const struct sr_probe *probe;
+       const struct sr_channel *probe;
        const GSList *l;
        int probe_bit, stage, i;
        char *tc;
@@ -143,7 +143,7 @@ static int configure_probes(const struct sr_dev_inst *sdi)
 
        stage = -1;
        for (l = sdi->probes; l; l = l->next) {
-               probe = (struct sr_probe *)l->data;
+               probe = (struct sr_channel *)l->data;
                if (probe->enabled == FALSE)
                        continue;
                probe_bit = 1 << (probe->index);
@@ -170,7 +170,7 @@ static int configure_probes(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        const GSList *l;
-       const struct sr_probe *probe;
+       const struct sr_channel *probe;
        char *tc;
        int type;
 
@@ -178,7 +178,7 @@ static int configure_probes(const struct sr_dev_inst *sdi)
        devc = sdi->priv;
 
        for (l = sdi->probes; l; l = l->next) {
-               probe = (struct sr_probe *)l->data;
+               probe = (struct sr_channel *)l->data;
                if (probe->enabled == FALSE)
                        continue;
 
@@ -239,11 +239,6 @@ SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate)
        return SR_OK;
 }
 
-static int dev_clear(void)
-{
-       return std_dev_clear(di, NULL);
-}
-
 static int init(struct sr_context *sr_ctx)
 {
        return std_init(sr_ctx, di, LOG_PREFIX);
@@ -252,7 +247,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 *probe;
        struct drv_context *drvc;
        struct dev_context *devc;
        const struct zp_model *prof;
@@ -468,15 +463,15 @@ static int dev_close(struct sr_dev_inst *sdi)
 
 static int cleanup(void)
 {
-       return dev_clear();
+       return std_dev_clear(di, NULL);
 }
 
 static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
-       (void)probe_group;
+       (void)cg;
 
        switch (id) {
        case SR_CONF_SAMPLERATE:
@@ -505,16 +500,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                } else
                        return SR_ERR_ARG;
                break;
-       case SR_CONF_MAX_UNCOMPRESSED_SAMPLES:
-               if (sdi) {
-                       /* As long as this driver doesn't support compression,
-                        * this is ok. When compression is enabled, this should
-                        * return SR_ERR_NA instead. */
-                       devc = sdi->priv;
-                       *data = g_variant_new_uint64(devc->max_sample_depth);
-               } else
-                       return SR_ERR;
-               break;
        default:
                return SR_ERR_NA;
        }
@@ -523,12 +508,12 @@ static int config_get(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_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        gdouble low, high;
 
-       (void)probe_group;
+       (void)cg;
 
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
@@ -556,15 +541,15 @@ static int config_set(int id, 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_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
-       GVariant *gvar;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
        double v;
        GVariant *range[2];
 
-       (void)probe_group;
+       (void)cg;
 
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
@@ -603,6 +588,14 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                }
                *data = g_variant_builder_end(&gvb);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               if (!sdi)
+                       return SR_ERR_ARG;
+               devc = sdi->priv;
+               grange[0] = g_variant_new_uint64(0);
+               grange[1] = g_variant_new_uint64(devc->max_sample_depth);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        default:
                return SR_ERR_NA;
        }
@@ -829,7 +822,7 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = dev_clear,
+       .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,