X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fatten-pps3xxx%2Fapi.c;h=3b9f002569a0706a389f09a1081cc178ce218dc9;hb=a4e435eb49c1fa30c31d5851b404001324cafe33;hp=ec344f3b6b205229459ede365e7b2b68713e7c2e;hpb=660e398fe9f5fc608787f8fd75a9df8aac61026f;p=libsigrok.git diff --git a/hardware/atten-pps3xxx/api.c b/hardware/atten-pps3xxx/api.c index ec344f3b..3b9f0025 100644 --- a/hardware/atten-pps3xxx/api.c +++ b/hardware/atten-pps3xxx/api.c @@ -43,7 +43,7 @@ static const int32_t devopts[] = { SR_CONF_OVER_CURRENT_PROTECTION, }; -static const int32_t devopts_pg[] = { +static const int32_t devopts_cg[] = { SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_VOLTAGE_MAX, SR_CONF_OUTPUT_CURRENT, @@ -87,8 +87,8 @@ static GSList *scan(GSList *options, int modelid) struct drv_context *drvc; struct dev_context *devc; struct sr_config *src; - struct sr_probe *probe; - struct sr_channel_group *pg; + struct sr_channel *ch; + struct sr_channel_group *cg; struct sr_serial_dev_inst *serial; GSList *l, *devices; struct pps_model *model; @@ -126,7 +126,7 @@ static GSList *scan(GSList *options, int modelid) return NULL; serial_flush(serial); - /* This is how the vendor software probes for hardware. */ + /* This is how the vendor software channels for hardware. */ memset(packet, 0, PACKET_SIZE); packet[0] = 0xaa; packet[1] = 0xaa; @@ -167,13 +167,13 @@ static GSList *scan(GSList *options, int modelid) sdi->conn = serial; for (i = 0; i < MAX_CHANNELS; i++) { snprintf(channel, 10, "CH%d", i + 1); - probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel); - sdi->probes = g_slist_append(sdi->probes, probe); - pg = g_malloc(sizeof(struct sr_channel_group)); - pg->name = g_strdup(channel); - pg->probes = g_slist_append(NULL, probe); - pg->priv = NULL; - sdi->channel_groups = g_slist_append(sdi->channel_groups, pg); + ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, channel); + sdi->channels = g_slist_append(sdi->channels, ch); + cg = g_malloc(sizeof(struct sr_channel_group)); + cg->name = g_strdup(channel); + cg->channels = g_slist_append(NULL, ch); + cg->priv = NULL; + sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); } devc = g_malloc0(sizeof(struct dev_context)); @@ -206,10 +206,10 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - struct sr_probe *probe; + struct sr_channel *ch; int channel, ret; if (!sdi) @@ -218,7 +218,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_OUTPUT_CHANNEL: @@ -232,8 +232,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } } else { /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; - channel = probe->index; + ch = cg->channels->data; + channel = ch->index; switch (key) { case SR_CONF_OUTPUT_VOLTAGE: @@ -275,10 +275,10 @@ static int find_str(const char *str, const char **strings, int array_size) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - struct sr_probe *probe; + struct sr_channel *ch; gdouble dval; int channel, ret, ival; const char *sval; @@ -289,7 +289,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_OK; devc = sdi->priv; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_OUTPUT_CHANNEL: @@ -323,8 +323,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } else { /* Channel group specified: per-channel options. */ /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; - channel = probe->index; + ch = cg->channels->data; + channel = ch->index; switch (key) { case SR_CONF_OUTPUT_VOLTAGE_MAX: @@ -359,10 +359,10 @@ static int config_set(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 *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - struct sr_probe *probe; + struct sr_channel *ch; GVariant *gvar; GVariantBuilder gvb; int channel, ret, i; @@ -379,7 +379,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -403,13 +403,13 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi) return SR_ERR_ARG; /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->probes->data; - channel = probe->index; + ch = cg->channels->data; + channel = ch->index; switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - devopts_pg, ARRAY_SIZE(devopts_pg), sizeof(int32_t)); + devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t)); break; case SR_CONF_OUTPUT_VOLTAGE_MAX: g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); @@ -473,7 +473,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, serial_source_add(serial, G_IO_IN, 50, atten_pps3xxx_receive_data, (void *)sdi); std_session_send_df_header(cb_data, LOG_PREFIX); - /* Send a "probe" configuration packet now. */ + /* Send a "channel" configuration packet now. */ memset(packet, 0, PACKET_SIZE); packet[0] = 0xaa; packet[1] = 0xaa;