X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fapi.c;h=95f53159a85fa073209ad6da1ca5f4eef83ca874;hb=1e91a90f2ad5f915c2490c1f099f05e15277a365;hp=b567c1f94c7f2a62b11faa188af4124d1c3993fb;hpb=f82525e60d50c7bd06e2d398c3244a6b3aecc46a;p=libsigrok.git diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index b567c1f9..95f53159 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -1,7 +1,7 @@ /* * This file is part of the libsigrok project. * - * Copyright (C) 2014-17 Kumar Abhishek + * Copyright (C) 2014-2017 Kumar Abhishek * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,31 +59,18 @@ static const uint64_t samplerates[] = { SR_HZ(1), }; -static struct dev_context *beaglelogic_devc_alloc(void) -{ - struct dev_context *devc; - - devc = g_malloc0(sizeof(struct dev_context)); - - /* Default non-zero values (if any) */ - devc->fd = -1; - devc->limit_samples = (uint64_t)10000000; - devc->tcp_buffer = 0; - - return devc; -} - static GSList *scan(struct sr_dev_driver *di, GSList *options) { GSList *l; struct sr_config *src; struct sr_dev_inst *sdi; struct dev_context *devc; - const char *conn = NULL; + const char *conn; gchar **params; int i, maxch; maxch = NUM_CHANNELS; + conn = NULL; for (l = options; l; l = l->next) { src = l->data; if (src->key == SR_CONF_NUM_LOGIC_CHANNELS) @@ -94,6 +81,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* Probe for /dev/beaglelogic if not connecting via TCP */ if (!conn) { + params = NULL; if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS)) return NULL; } else { @@ -117,7 +105,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->model = g_strdup("BeagleLogic"); sdi->version = g_strdup("1.0"); - devc = beaglelogic_devc_alloc(); + devc = g_malloc0(sizeof(struct dev_context)); + + /* Default non-zero values (if any) */ + devc->fd = -1; + devc->limit_samples = 10000000; + devc->tcp_buffer = 0; if (!conn) { devc->beaglelogic = &beaglelogic_native_ops; @@ -337,7 +330,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) /* If continuous sampling, set the limit_samples to max possible value */ if (devc->triggerflags == BL_TRIGGERFLAGS_CONTINUOUS) - devc->limit_samples = (uint64_t)-1; + devc->limit_samples = UINT64_MAX; /* Configure triggers & send header packet */ if ((trigger = sr_session_trigger_get(sdi->session))) {