2 * This file is part of the libsigrok project.
4 * Copyright (C) 2018 Sven Bursch-Osewold <sb_git@bursch.com>
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.
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_ZKETECH_EBD_USB_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_ZKETECH_EBD_USB_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "zketech-ebd-usb"
31 #define MSG_CHECKSUM_POS 17
32 #define MSG_FRAME_BEGIN 0xfa
33 #define MSG_FRAME_BEGIN_POS 0
34 #define MSG_FRAME_END 0xf8
35 #define MSG_FRAME_END_POS 18
38 struct sr_sw_limits limits;
42 gboolean load_activated;
45 /* Communication via serial. */
46 SR_PRIV int ebd_read_chars(struct sr_serial_dev_inst *serial, int count, uint8_t *buf);
49 SR_PRIV int ebd_init(struct sr_serial_dev_inst *serial, struct dev_context *devc);
50 SR_PRIV int ebd_loadstart(struct sr_serial_dev_inst *serial, struct dev_context *devc);
51 SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data);
52 SR_PRIV int ebd_stop(struct sr_serial_dev_inst *serial, struct dev_context *devc);
53 SR_PRIV int ebd_loadstop(struct sr_serial_dev_inst *serial, struct dev_context *devc);
56 SR_PRIV int ebd_get_current_limit(const struct sr_dev_inst *sdi, float *current);
57 SR_PRIV int ebd_set_current_limit(const struct sr_dev_inst *sdi, float current);
58 SR_PRIV gboolean ebd_current_is0(struct dev_context *devc);