]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/cem-dt-885x/api.c
Improve readability and clarity of some numbers.
[libsigrok.git] / src / hardware / cem-dt-885x / api.c
index 5c259542b8babca76036fd096284490780d42290..5ae4e37ca67b9a4b5ec918e8a8e18aefe0184bd9 100644 (file)
@@ -21,8 +21,9 @@
 #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,16 +67,15 @@ static const char *data_sources[] = {
        "Live",
        "Memory",
 };
-SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info;
-static struct sr_dev_driver *di = &cem_dt_885x_driver_info;
 
+SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info;
 
-static int init(struct sr_context *sr_ctx)
+static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
 {
        return std_init(sr_ctx, di, LOG_PREFIX);
 }
 
-static GSList *scan(GSList *options)
+static GSList *scan(struct sr_dev_driver *di, GSList *options)
 {
        struct drv_context *drvc;
        struct dev_context *devc;
@@ -104,7 +104,7 @@ static GSList *scan(GSList *options)
        devices = NULL;
        drvc = di->priv;
        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));
@@ -135,7 +135,7 @@ static GSList *scan(GSList *options)
        return devices;
 }
 
-static GSList *dev_list(void)
+static GSList *dev_list(const struct sr_dev_driver *di)
 {
        return ((struct drv_context *)(di->priv))->instances;
 }
@@ -153,7 +153,7 @@ static int dev_open(struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int cleanup(void)
+static int cleanup(const struct sr_dev_driver *di)
 {
        return std_dev_clear(di, NULL);
 }