sysclk-lwla: Various cosmetic improvements

This commit is contained in:
Daniel Elstner 2015-12-04 20:08:07 +01:00
parent 6d2897e394
commit 407b6e2cff
6 changed files with 11 additions and 15 deletions

View File

@ -23,7 +23,7 @@
#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.

View File

@ -20,9 +20,9 @@
#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 */

View File

@ -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,

View File

@ -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);

View File

@ -19,12 +19,8 @@
#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.
*/
@ -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);

View File

@ -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 */