X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=tests%2Flib.c;h=f1c3c0159a1b4cd52308ccd505be1d060899d4a5;hb=afaa75b98c8beca03d67d28dacbffee819c2f70b;hp=39c036f6446e6984481ffdcc95ca0fa981889634;hpb=c3e2b08dc9a252ada9b9a51ae47ea588135944e1;p=libsigrok.git diff --git a/tests/lib.c b/tests/lib.c index 39c036f6..f1c3c015 100644 --- a/tests/lib.c +++ b/tests/lib.c @@ -23,7 +23,8 @@ #include #include #include -#include "../libsigrok.h" +#include "../include/libsigrok/libsigrok.h" +#include "lib.h" /* Get a libsigrok driver by name. */ struct sr_dev_driver *srtest_driver_get(const char *drivername) @@ -63,25 +64,6 @@ struct sr_input_format *srtest_input_get(const char *id) return input; } -/* Get a libsigrok output format by ID. */ -struct sr_output_format *srtest_output_get(const char *id) -{ - struct sr_output_format **outputs, *output = NULL; - int i; - - outputs = sr_output_list(); - fail_unless(outputs != NULL, "No output modules found."); - - for (i = 0; outputs[i]; i++) { - if (strcmp(outputs[i]->id, id)) - continue; - output = outputs[i]; - } - fail_unless(output != NULL, "Output module '%s' not found.", id); - - return output; -} - /* Initialize a libsigrok driver. */ void srtest_driver_init(struct sr_context *sr_ctx, struct sr_dev_driver *driver) { @@ -210,21 +192,21 @@ void srtest_buf_to_file(const char *filename, const uint8_t *buf, uint64_t len) fclose(f); } -GArray *srtest_get_enabled_logic_probes(const struct sr_dev_inst *sdi) +GArray *srtest_get_enabled_logic_channels(const struct sr_dev_inst *sdi) { - struct sr_probe *probe; - GArray *probes; + struct sr_channel *ch; + GArray *channels; GSList *l; - probes = g_array_new(FALSE, FALSE, sizeof(int)); - for (l = sdi->probes; l; l = l->next) { - probe = l->data; - if (probe->type != SR_PROBE_LOGIC) + channels = g_array_new(FALSE, FALSE, sizeof(int)); + for (l = sdi->channels; l; l = l->next) { + ch = l->data; + if (ch->type != SR_CHANNEL_LOGIC) continue; - if (probe->enabled != TRUE) + if (ch->enabled != TRUE) continue; - g_array_append_val(probes, probe->index); + g_array_append_val(channels, ch->index); } - return probes; + return channels; }