X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Flogicport.c;h=ea4cb39b252bb406aaf31bcb4a343128ed2dab9b;hb=4441e5738d185d17775b4361f76372482bdd6fd2;hp=011735302f0f4483e6425d2a0d2aafa26d8069a8;hpb=4c40d096d4cde1b0538dea216e50846a14f33aaa;p=libsigrok.git diff --git a/src/input/logicport.c b/src/input/logicport.c index 01173530..ea4cb39b 100644 --- a/src/input/logicport.c +++ b/src/input/logicport.c @@ -60,10 +60,6 @@ #include #include "libsigrok-internal.h" -/* TODO: Move these helpers to some library API routine group. */ -struct sr_channel_group *sr_channel_group_new(const char *name, void *priv); -void sr_channel_group_free(struct sr_channel_group *cg); - #define LOG_PREFIX "input/logicport" #define MAX_CHANNELS 34 @@ -155,26 +151,6 @@ static void free_signal_group(struct signal_group_desc *desc) g_free(desc); } -struct sr_channel_group *sr_channel_group_new(const char *name, void *priv) -{ - struct sr_channel_group *cg; - - cg = g_malloc0(sizeof(*cg)); - if (name && *name) - cg->name = g_strdup(name); - cg->priv = priv; - - return cg; -} - -void sr_channel_group_free(struct sr_channel_group *cg) -{ - if (!cg) - return; - g_free(cg->name); - g_slist_free(cg->channels); -} - /* Wrapper for GDestroyNotify compatibility. */ static void sg_free(void *p) { @@ -802,10 +778,9 @@ static int create_channels_groups(struct sr_input *in) sdi = in->sdi; for (l = inc->signal_groups; l; l = l->next) { desc = l->data; - cg = sr_channel_group_new(desc->name, NULL); + cg = sr_channel_group_new(sdi, desc->name, NULL); if (!cg) return SR_ERR_MALLOC; - sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); mask = UINT64_C(1); for (idx = 0; idx < inc->channel_count; idx++, mask <<= 1) { if (!(desc->mask & mask)) @@ -842,8 +817,6 @@ static int send_buffer(struct sr_input *in) { struct context *inc; struct sr_datafeed_packet packet; - struct sr_datafeed_meta meta; - struct sr_config *src; struct sr_datafeed_logic logic; int rc; @@ -859,14 +832,8 @@ static int send_buffer(struct sr_input *in) } if (inc->sample_rate && !inc->rate_sent) { - packet.type = SR_DF_META; - packet.payload = &meta; - src = sr_config_new(SR_CONF_SAMPLERATE, + rc = sr_session_send_meta(in->sdi, SR_CONF_SAMPLERATE, g_variant_new_uint64(inc->sample_rate)); - meta.config = g_slist_append(NULL, src); - rc = sr_session_send(in->sdi, &packet); - g_slist_free(meta.config); - sr_config_free(src); if (rc) return rc; inc->rate_sent = TRUE; @@ -1180,11 +1147,6 @@ static int reset(struct sr_input *in) inc->channels = NULL; cleanup(in); inc->channels = channels; - inc->ch_feed_prep = FALSE; - inc->header_sent = FALSE; - inc->rate_sent = FALSE; - if (in->buf) - g_string_truncate(in->buf, 0); return SR_OK; }