X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fsysclk-lwla%2Fprotocol.h;h=29a191aab4b477b71e22a1513a00c3a2c0c16618;hb=7f4975b4401a1e8de61e356b5b272fc00b658260;hp=be8aaeba8ef57b204ec5896e4b4d8dde668ca87d;hpb=5874e88d83cabbec62e36c37e9016fab983d957b;p=libsigrok.git diff --git a/hardware/sysclk-lwla/protocol.h b/hardware/sysclk-lwla/protocol.h index be8aaeba..29a191aa 100644 --- a/hardware/sysclk-lwla/protocol.h +++ b/hardware/sysclk-lwla/protocol.h @@ -41,10 +41,14 @@ #define NUM_PROBES 34 #define TRIGGER_TYPES "01fr" +/* Bit mask covering all 34 channels. + */ +#define ALL_CHANNELS_MASK (((uint64_t)1 << NUM_PROBES) - 1) + /** Unit and packet size for the sigrok logic datafeed. */ #define UNIT_SIZE ((NUM_PROBES + 7) / 8) -#define PACKET_SIZE (10000 * UNIT_SIZE) /* bytes */ +#define PACKET_LENGTH 10000 /* units */ /** Size of the acquisition buffer in device memory units. */ @@ -89,6 +93,14 @@ */ #define DEFAULT_SAMPLERATE SR_MHZ(125) +/** Maximum configurable sample count limit. + */ +#define MAX_LIMIT_SAMPLES (UINT64_C(1) << 48) + +/** Maximum configurable capture duration in milliseconds. + */ +#define MAX_LIMIT_MSEC (UINT64_C(1) << 32) + /** LWLA clock sources. */ enum clock_source { @@ -133,10 +145,15 @@ struct acquisition_state { uint64_t sample; uint64_t run_len; - /** Number of samples acquired so far. */ - uint64_t captured_samples; + /** Maximum number of samples to process. */ + uint64_t samples_max; /** Number of samples sent to the session bus. */ - uint64_t transferred_samples; + uint64_t samples_done; + + /** Maximum duration of capture, in milliseconds. */ + uint64_t duration_max; + /** Running capture duration since trigger event. */ + uint64_t duration_now; /** Capture memory fill level. */ size_t mem_addr_fill; @@ -145,7 +162,7 @@ struct acquisition_state { size_t mem_addr_next; size_t mem_addr_stop; - size_t out_offset; + size_t out_index; struct libusb_transfer *xfer_in; struct libusb_transfer *xfer_out; @@ -154,12 +171,15 @@ struct acquisition_state { enum rle_state rle; + /** Whether to bypass the clock divider. */ + gboolean bypass_clockdiv; + /* Payload data buffers for outgoing and incoming transfers. */ uint16_t xfer_buf_out[MAX_ACQ_SEND_WORDS]; uint16_t xfer_buf_in[MAX_ACQ_RECV_WORDS]; /* Payload buffer for sigrok logic packets. */ - uint8_t out_packet[PACKET_SIZE]; + uint8_t out_packet[PACKET_LENGTH * UNIT_SIZE]; }; /** Private, per-device-instance driver context. @@ -168,6 +188,9 @@ struct dev_context { /** The samplerate selected by the user. */ uint64_t samplerate; + /** The maximimum sampling duration, in milliseconds. */ + uint64_t limit_msec; + /** The maximimum number of samples to acquire. */ uint64_t limit_samples; @@ -185,7 +208,6 @@ struct dev_context { int reg_write_len; enum device_state state; - enum device_state next_state; /** The currently configured clock source of the device. */ enum clock_source cur_clock_source;