2 * This file is part of the libsigrok project.
4 * Copyright 2014 Google, Inc
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 2 of the License, or
9 * (at your option) any later version.
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.
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/>.
20 #ifndef LIBSIGROK_HARDWARE_CHROMIUM_TWINKIE_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_CHROMIUM_TWINKIE_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "twinkie"
30 /** Private, per-CC logical channel context. */
38 enum vbus_group_index {
45 /** Private, per-device-instance driver context. */
47 /** Maximum number of samples to capture, if nonzero. */
48 uint64_t limit_samples;
51 int submitted_transfers;
53 size_t convbuffer_size;
55 unsigned int num_transfers;
56 struct libusb_transfer **transfers;
57 struct sr_context *ctx;
59 struct cc_context cc[2];
64 struct sr_datafeed_analog vbus_packet[VBUS_GRP_COUNT];
65 struct sr_analog_meaning vbus_meaning[VBUS_GRP_COUNT];
66 struct sr_analog_encoding vbus_encoding;
67 struct sr_analog_spec vbus_spec;
70 SR_PRIV int twinkie_start_acquisition(const struct sr_dev_inst *sdi);
71 SR_PRIV int twinkie_init_device(const struct sr_dev_inst *sdi);
72 SR_PRIV void LIBUSB_CALL twinkie_receive_transfer(struct libusb_transfer *transfer);
73 SR_PRIV void LIBUSB_CALL twinkie_vbus_sent(struct libusb_transfer *transfer);
74 SR_PRIV void LIBUSB_CALL twinkie_vbus_recv(struct libusb_transfer *transfer);