#include <stdlib.h>
#include <string.h>
#include <libsigrok/libsigrok.h>
-#include "libsigrok-internal.h"
+#include <libsigrok-internal.h>
#include "protocol.h"
/* Supported device scan options.
#include <config.h>
#include <glib/gstdio.h>
#include <libsigrok/libsigrok.h>
-#include "libsigrok-internal.h"
-#include "protocol.h"
+#include <libsigrok-internal.h>
#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 */
/** 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,
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);
#include <config.h>
#include <string.h>
-#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.
*/
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;
}
struct dev_context *devc;
int ret;
+ const int poll_interval_ms = 100;
+
drvc = sdi->driver->context;
devc = sdi->priv;
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);
*/
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 */