X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmastech-ms6514%2Fprotocol.h;fp=src%2Fhardware%2Fmastech-ms6514%2Fprotocol.h;h=35660b4237f5a47a87b036ae6cc3660d808406ae;hb=23669c3df33a3ea884afabf4b7a8cd6fe4a75824;hp=0000000000000000000000000000000000000000;hpb=212769c3b86a8aa01c5573e07bd57f000932e8bb;p=libsigrok.git diff --git a/src/hardware/mastech-ms6514/protocol.h b/src/hardware/mastech-ms6514/protocol.h new file mode 100644 index 00000000..35660b42 --- /dev/null +++ b/src/hardware/mastech-ms6514/protocol.h @@ -0,0 +1,55 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2019 Dave Buechi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LIBSIGROK_HARDWARE_MASTECH_MS6514_PROTOCOL_H +#define LIBSIGROK_HARDWARE_MASTECH_MS6514_PROTOCOL_H + +#include +#include +#include +#include "libsigrok-internal.h" + +#define LOG_PREFIX "mastech-ms6514" + +#define MASTECH_MS6514_NUM_CHANNELS 2 +#define MASTECH_MS6514_BUF_SIZE (3 * 18) +#define MASTECH_MS6514_FRAME_SIZE 18 +#define DEFAULT_DATA_SOURCE DATA_SOURCE_LIVE + +enum mastech_ms6614_data_source { + DATA_SOURCE_LIVE, + DATA_SOURCE_MEMORY, +}; + +enum mastech_ms6614_command { + CMD_GET_STORED = 0xA1 +}; + +struct dev_context { + struct sr_sw_limits limits; + enum mastech_ms6614_data_source data_source; + unsigned int buf_len; + uint8_t buf[MASTECH_MS6514_BUF_SIZE]; + unsigned int log_buf_len; +}; + +SR_PRIV int mastech_ms6514_receive_data(int fd, int revents, void *cb_data); +SR_PRIV gboolean mastech_ms6514_packet_valid(const uint8_t *buf); + +#endif