]> sigrok.org Git - libsigrok.git/blame - src/hardware/gwinstek-gds-800/protocol.h
scpi-pps: don't break SCPI devices when scanning for HP-IB devices
[libsigrok.git] / src / hardware / gwinstek-gds-800 / protocol.h
CommitLineData
7c198f96
ML
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2015 Martin Lederhilger <martin.lederhilger@gmx.at>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBSIGROK_HARDWARE_GWINSTEK_GDS_800_PROTOCOL_H
21#define LIBSIGROK_HARDWARE_GWINSTEK_GDS_800_PROTOCOL_H
22
23#include <stdint.h>
24#include <glib.h>
b11afbb1 25#include <libsigrok/libsigrok.h>
7c198f96 26#include "libsigrok-internal.h"
b11afbb1 27#include "scpi.h"
7c198f96
ML
28
29#define LOG_PREFIX "gwinstek-gds-800"
30
b11afbb1
ML
31#define MAX_SAMPLES 125000
32#define MAX_RCV_BUFFER_SIZE (MAX_SAMPLES * 2)
33
34enum gds_state
35{
36 START_ACQUISITION,
37 START_TRANSFER_OF_CHANNEL_DATA,
38 WAIT_FOR_TRANSFER_OF_BEGIN_TRANSMISSION_COMPLETE,
39 WAIT_FOR_TRANSFER_OF_DATA_SIZE_DIGIT_COMPLETE,
40 WAIT_FOR_TRANSFER_OF_DATA_SIZE_COMPLETE,
41 WAIT_FOR_TRANSFER_OF_SAMPLE_RATE_COMPLETE,
42 WAIT_FOR_TRANSFER_OF_CHANNEL_INDICATOR_COMPLETE,
43 WAIT_FOR_TRANSFER_OF_RESERVED_DATA_COMPLETE,
44 WAIT_FOR_TRANSFER_OF_CHANNEL_DATA_COMPLETE,
45};
46
7c198f96 47struct dev_context {
b11afbb1
ML
48 enum gds_state state;
49 uint64_t cur_acq_frame;
50 uint64_t frame_limit;
51 int cur_acq_channel;
52 int cur_rcv_buffer_position;
53 char rcv_buffer[MAX_RCV_BUFFER_SIZE];
54 int data_size_digits;
55 int data_size;
56 float sample_rate;
57 gboolean df_started;
7c198f96
ML
58};
59
60SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data);
61
62#endif