2 * This file is part of the libsigrok project.
4 * Copyright (C) 2019 Katherine J. Temkin <k@ktemkin.com>
5 * Copyright (C) 2019 Mikaela Szekely <qyriad@gmail.com>
6 * Copyright (C) 2023 Gerhard Sittig <gerhard.sittig@gmx.net>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
23 #define LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
26 #include <libsigrok/libsigrok.h>
29 #include "libsigrok-internal.h"
31 #define LOG_PREFIX "greatfet"
34 struct sr_dev_inst *sdi;
35 GString *usb_comm_buffer;
36 char *firmware_version;
40 size_t feed_unit_size;
41 struct sr_sw_limits sw_limits;
43 struct dev_acquisition_t {
44 uint64_t bandwidth_threshold;
45 size_t wire_unit_size;
46 struct feed_queue_logic *feed_queue;
47 size_t capture_channels;
48 gboolean use_upper_pins;
50 size_t points_per_byte;
51 uint64_t capture_samplerate;
52 size_t firmware_bufsize;
53 uint8_t samples_endpoint;
54 uint8_t control_interface;
55 uint8_t samples_interface;
62 gboolean frame_begin_sent;
63 gboolean control_interface_claimed;
64 gboolean samples_interface_claimed;
65 gboolean start_req_sent;
67 struct dev_transfers_t {
68 size_t transfer_bufsize;
69 size_t transfers_count;
70 uint8_t *transfer_buffer;
71 struct libusb_transfer **transfers;
72 size_t active_transfers;
73 size_t capture_bufsize;
77 SR_PRIV int greatfet_get_serial_number(const struct sr_dev_inst *sdi);
78 SR_PRIV int greatfet_get_version_number(const struct sr_dev_inst *sdi);
80 SR_PRIV int greatfet_setup_acquisition(const struct sr_dev_inst *sdi);
81 SR_PRIV int greatfet_start_acquisition(const struct sr_dev_inst *sdi);
82 SR_PRIV void greatfet_abort_acquisition(const struct sr_dev_inst *sdi);
83 SR_PRIV int greatfet_stop_acquisition(const struct sr_dev_inst *sdi);
84 SR_PRIV void greatfet_release_resources(const struct sr_dev_inst *sdi);
86 SR_PRIV int greatfet_receive_data(int fd, int revents, void *cb_data);