diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-01-20 21:26:45 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-01-27 17:53:56 +0100 |
commit | 322c6b2fb36aaa38967ca797acef0ebb1f3090e6 (patch) | |
tree | c28dde675c3e3378536584248150710a5bdf9212 /controller.c | |
parent | 6d333fd65c41f7bf6470d0b6ada88efee4777f59 (diff) | |
download | libsigrokdecode-322c6b2fb36aaa38967ca797acef0ebb1f3090e6.tar.gz libsigrokdecode-322c6b2fb36aaa38967ca797acef0ebb1f3090e6.zip |
Temporarily revert API changes in preparation of release.
The upcoming libsigrokdecode release should not contain any API changes
so it is compatible with existing released frontends (sigrok-cli 0.3.1).
Diffstat (limited to 'controller.c')
-rw-r--r-- | controller.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/controller.c b/controller.c index c265ae7..5d19e7a 100644 --- a/controller.c +++ b/controller.c @@ -330,9 +330,9 @@ static gint compare_probe_id(const struct srd_probe *a, const char *probe_id) * it overwrites any probes that were already defined (if any). * * @param di Decoder instance. - * @param new_probes A GHashTable of probes to set. Key is probe name, value is - * the probe number. Samples passed to this instance will be - * arranged in this order. + * @param probes A GHashTable of probes to set. Key is probe name, value is + * the probe number. Samples passed to this instance will be + * arranged in this order. * * @return SRD_OK upon success, a (negative) error code otherwise. */ @@ -344,7 +344,6 @@ SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di, struct srd_probe *p; int *new_probemap, new_probenum; char *probe_id, *probenum_str; - int i, num_required_probes; srd_dbg("set probes called for instance %s with list of %d probes", di->inst_id, g_hash_table_size(new_probes)); @@ -367,13 +366,6 @@ SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di, return SRD_ERR_MALLOC; } - /* - * For now, map all indexes to probe -1 (can be overridden later). - * This -1 is interpreted as an unspecified probe later. - */ - for (i = 0; i < di->dec_num_probes; i++) - new_probemap[i] = -1; - for (l = g_hash_table_get_keys(new_probes); l; l = l->next) { probe_id = l->data; probenum_str = g_hash_table_lookup(new_probes, probe_id); @@ -398,17 +390,9 @@ SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di, } p = sl->data; new_probemap[p->order] = new_probenum; - srd_dbg("Setting probe mapping: %s (index %d) = probe %d.", - p->id, p->order, new_probenum); - } - - srd_dbg("Final probe map:"); - num_required_probes = g_slist_length(di->decoder->probes); - for (i = 0; i < di->dec_num_probes; i++) { - srd_dbg(" - index %d = probe %d (%s)", i, new_probemap[i], - (i < num_required_probes) ? "required" : "optional"); + srd_dbg("setting probe mapping for %d = probe %d", p->order, + new_probenum); } - g_free(di->dec_probemap); di->dec_probemap = new_probemap; @@ -418,9 +402,9 @@ SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di, /** * Create a new protocol decoder instance. * - * @param decoder_id Decoder 'id' field. + * @param id Decoder 'id' field. * @param options GHashtable of options which override the defaults set in - * the decoder class. May be NULL. + * the decoder class. * * @return Pointer to a newly allocated struct srd_decoder_inst, or * NULL in case of failure. @@ -445,13 +429,10 @@ SRD_API struct srd_decoder_inst *srd_inst_new(const char *decoder_id, return NULL; } + inst_id = g_hash_table_lookup(options, "id"); di->decoder = dec; - if (options) { - inst_id = g_hash_table_lookup(options, "id"); - di->inst_id = g_strdup(inst_id ? inst_id : decoder_id); - g_hash_table_remove(options, "id"); - } else - di->inst_id = g_strdup(decoder_id); + di->inst_id = g_strdup(inst_id ? inst_id : decoder_id); + g_hash_table_remove(options, "id"); /* * Prepare a default probe map, where samples come in the @@ -480,7 +461,7 @@ SRD_API struct srd_decoder_inst *srd_inst_new(const char *decoder_id, return NULL; } - if (options && srd_inst_option_set(di, options) != SRD_OK) { + if (srd_inst_option_set(di, options) != SRD_OK) { g_free(di->dec_probemap); g_free(di); return NULL; @@ -736,8 +717,6 @@ SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) struct srd_decoder_inst *di; int ret; - ret = SRD_OK; - srd_dbg("Calling start() on all instances with %d probes, " "unitsize %d samplerate %d.", num_probes, unitsize, samplerate); @@ -756,7 +735,7 @@ SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) di->data_num_probes = num_probes; di->data_unitsize = unitsize; di->data_samplerate = samplerate; - if ((ret = srd_inst_start(di, args)) != SRD_OK) + if ((ret = srd_inst_start(di, args) != SRD_OK)) break; } @@ -770,7 +749,7 @@ SRD_API int srd_session_start(int num_probes, int unitsize, uint64_t samplerate) * * @param start_samplenum The sample number of the first sample in this chunk. * @param inbuf Pointer to sample data. - * @param inbuflen Length in bytes of the buffer. + * @param inbuf Length in bytes of the buffer. * * @return SRD_OK upon success, a (negative) error code otherwise. */ |