X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fgwinstek-gds-800%2Fprotocol.h;h=d5c2e5a0de185698debe6d78b649234f00d0c86a;hb=ecd4600bb15fc16d842936c452d4e7d5fb8e12f5;hp=5ee467fa0e022bc2ad368edf3ed039bbcef43664;hpb=7c198f968b8145321e3b7066c2a549b028a6320b;p=libsigrok.git diff --git a/src/hardware/gwinstek-gds-800/protocol.h b/src/hardware/gwinstek-gds-800/protocol.h index 5ee467fa..d5c2e5a0 100644 --- a/src/hardware/gwinstek-gds-800/protocol.h +++ b/src/hardware/gwinstek-gds-800/protocol.h @@ -22,21 +22,39 @@ #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" +#include "scpi.h" #define LOG_PREFIX "gwinstek-gds-800" -/** Private, per-device-instance driver context. */ -struct dev_context { - /* Model-specific information */ - - /* Acquisition settings */ - - /* Operational state */ - - /* Temporary state across callbacks */ +#define MAX_SAMPLES 125000 +#define MAX_RCV_BUFFER_SIZE (MAX_SAMPLES * 2) + +enum gds_state +{ + START_ACQUISITION, + START_TRANSFER_OF_CHANNEL_DATA, + WAIT_FOR_TRANSFER_OF_BEGIN_TRANSMISSION_COMPLETE, + WAIT_FOR_TRANSFER_OF_DATA_SIZE_DIGIT_COMPLETE, + WAIT_FOR_TRANSFER_OF_DATA_SIZE_COMPLETE, + WAIT_FOR_TRANSFER_OF_SAMPLE_RATE_COMPLETE, + WAIT_FOR_TRANSFER_OF_CHANNEL_INDICATOR_COMPLETE, + WAIT_FOR_TRANSFER_OF_RESERVED_DATA_COMPLETE, + WAIT_FOR_TRANSFER_OF_CHANNEL_DATA_COMPLETE, +}; +struct dev_context { + enum gds_state state; + uint64_t cur_acq_frame; + uint64_t frame_limit; + int cur_acq_channel; + int cur_rcv_buffer_position; + char rcv_buffer[MAX_RCV_BUFFER_SIZE]; + int data_size_digits; + int data_size; + float sample_rate; + gboolean df_started; }; SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data);