From: Daniel Elstner Date: Fri, 4 Dec 2015 19:08:07 +0000 (+0100) Subject: sysclk-lwla: Various cosmetic improvements X-Git-Tag: libsigrok-0.4.0~69 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=407b6e2cff817c6b05f1f038e2fecd94ad11fa86;p=libsigrok.git sysclk-lwla: Various cosmetic improvements --- diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 516726a3..6ba18a28 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -23,7 +23,7 @@ #include #include #include -#include "libsigrok-internal.h" +#include #include "protocol.h" /* Supported device scan options. diff --git a/src/hardware/sysclk-lwla/lwla.c b/src/hardware/sysclk-lwla/lwla.c index 0623f511..c884885c 100644 --- a/src/hardware/sysclk-lwla/lwla.c +++ b/src/hardware/sysclk-lwla/lwla.c @@ -20,9 +20,9 @@ #include #include #include -#include "libsigrok-internal.h" -#include "protocol.h" +#include #include "lwla.h" +#include "protocol.h" #define BITSTREAM_MAX_SIZE (256 * 1024) /* bitstream size limit for safety */ #define BITSTREAM_HEADER_SIZE 4 /* transfer header size in bytes */ diff --git a/src/hardware/sysclk-lwla/lwla.h b/src/hardware/sysclk-lwla/lwla.h index 35e3b0ea..7d95f9c1 100644 --- a/src/hardware/sysclk-lwla/lwla.h +++ b/src/hardware/sysclk-lwla/lwla.h @@ -83,7 +83,7 @@ enum command_id { /** LWLA capture state flags. * The bit positions are the same as in the LWLA1016 control register. */ -enum { +enum status_flag { STATUS_CAPTURING = 1 << 2, STATUS_TRIGGERED = 1 << 5, STATUS_MEM_AVAIL = 1 << 6, diff --git a/src/hardware/sysclk-lwla/lwla1016.c b/src/hardware/sysclk-lwla/lwla1016.c index 59557efd..4c8bbfb5 100644 --- a/src/hardware/sysclk-lwla/lwla1016.c +++ b/src/hardware/sysclk-lwla/lwla1016.c @@ -319,7 +319,6 @@ static int prepare_request(const struct sr_dev_inst *sdi) lwla_queue_regval(acq, REG_CAP_COUNT, 0); break; case STATE_READ_REQUEST: - /* Always read a multiple of 8 device words. */ count = MIN(READ_CHUNK_LEN32, acq->mem_addr_stop - acq->mem_addr_next); diff --git a/src/hardware/sysclk-lwla/protocol.c b/src/hardware/sysclk-lwla/protocol.c index 6c940ac2..a8d71b79 100644 --- a/src/hardware/sysclk-lwla/protocol.c +++ b/src/hardware/sysclk-lwla/protocol.c @@ -19,12 +19,8 @@ #include #include -#include "lwla.h" #include "protocol.h" - -/* Status polling interval during acquisition. - */ -#define POLL_INTERVAL 100 /* ms */ +#include "lwla.h" /* Submit an already filled-in USB transfer. */ @@ -341,7 +337,8 @@ static void LIBUSB_CALL transfer_out_completed(struct libusb_transfer *transfer) acq = devc->acquisition; if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { - sr_err("Transfer to device failed: %d.", transfer->status); + sr_err("Transfer to device failed (state %d): %s.", + devc->state, libusb_error_name(transfer->status)); devc->transfer_error = TRUE; return; } @@ -549,6 +546,8 @@ SR_PRIV int lwla_start_acquisition(const struct sr_dev_inst *sdi) struct dev_context *devc; int ret; + const int poll_interval_ms = 100; + drvc = sdi->driver->context; devc = sdi->priv; @@ -570,7 +569,7 @@ SR_PRIV int lwla_start_acquisition(const struct sr_dev_inst *sdi) return ret; } /* Register event source for asynchronous USB I/O. */ - ret = usb_source_add(sdi->session, drvc->sr_ctx, POLL_INTERVAL, + ret = usb_source_add(sdi->session, drvc->sr_ctx, poll_interval_ms, &transfer_event, (struct sr_dev_inst *)sdi); if (ret != SR_OK) { clear_acquisition_state(sdi); diff --git a/src/hardware/sysclk-lwla/protocol.h b/src/hardware/sysclk-lwla/protocol.h index 9ef21b05..9e04100b 100644 --- a/src/hardware/sysclk-lwla/protocol.h +++ b/src/hardware/sysclk-lwla/protocol.h @@ -118,12 +118,10 @@ enum protocol_state { */ struct dev_context { uint64_t samplerate; /* requested samplerate */ - uint64_t limit_msec; /* requested capture duration in ms */ uint64_t limit_samples; /* requested capture length in samples */ - uint64_t channel_mask; /* bit mask of enabled channels */ - + uint64_t channel_mask; /* bit mask of enabled channels */ uint64_t trigger_mask; /* trigger enable mask */ uint64_t trigger_edge_mask; /* trigger type mask */ uint64_t trigger_values; /* trigger level/slope bits */