X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcem-dt-885x%2Fapi.c;h=8a9a6e1e0461f29428428978d197c089614960b8;hb=6ec6c43b4738dbc7091f4a49a4ec80ea6102cb52;hp=1e4998028294bd1532920f84c25a72ec58ea6fd1;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 1e499802..8a9a6e1e 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -17,12 +17,14 @@ * along with this program. If not, see . */ +#include #include #include "protocol.h" #define SERIALCOMM "9600/8n1" + /* 23ms is the longest interval between tokens. */ -#define MAX_SCAN_TIME 25 * 1000 +#define MAX_SCAN_TIME_US (25 * 1000) static const uint32_t scanopts[] = { SR_CONF_CONN, @@ -66,8 +68,8 @@ static const char *data_sources[] = { "Live", "Memory", }; -SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info; +SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info; static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) { @@ -101,9 +103,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return NULL; devices = NULL; - drvc = di->priv; + drvc = di->context; start = g_get_monotonic_time(); - while (g_get_monotonic_time() - start < MAX_SCAN_TIME) { + while (g_get_monotonic_time() - start < MAX_SCAN_TIME_US) { if (serial_read_nonblocking(serial, &c, 1) == 1 && c == 0xa5) { /* Found one. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); @@ -136,7 +138,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -348,6 +350,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); + break; case SR_CONF_SPL_WEIGHT_FREQ: *data = g_variant_new_strv(weight_freq, ARRAY_SIZE(weight_freq)); break; @@ -429,5 +432,5 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = { .dev_close = std_serial_dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };