]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/atorch/protocol.h
atorch: Implement support for DC and USB Meters
[libsigrok.git] / src / hardware / atorch / protocol.h
index 9312fae3ace9c48de482f4da3117a692410bb77c..05cbe839af80f8421b393a768823f67e02e66521 100644 (file)
 #ifndef LIBSIGROK_HARDWARE_ATORCH_PROTOCOL_H
 #define LIBSIGROK_HARDWARE_ATORCH_PROTOCOL_H
 
-#include <stdint.h>
 #include <glib.h>
 #include <libsigrok/libsigrok.h>
+#include <stdint.h>
+
 #include "libsigrok-internal.h"
 
 #define LOG_PREFIX "atorch"
 
+#define ATORCH_BUFSIZE 128
+
+struct atorch_device_profile {
+       uint8_t device_type;
+       const char *device_name;
+       const struct atorch_channel_desc *channels;
+       size_t channel_count;
+};
+
+struct atorch_channel_desc {
+       const char *name;
+       struct binary_value_spec spec;
+       struct sr_rational scale;
+       int digits;
+       enum sr_mq mq;
+       enum sr_unit unit;
+       enum sr_mqflag flags;
+};
+
+enum atorch_msg_type {
+       MSG_REPORT = 0x01,
+       MSG_REPLY = 0x02,
+       MSG_COMMAND = 0x11,
+};
+
 struct dev_context {
+       const struct atorch_device_profile *profile;
+       struct sr_sw_limits limits;
+       struct feed_queue_analog **feeds;
+       uint8_t buf[ATORCH_BUFSIZE];
+       size_t wr_idx;
+       size_t rd_idx;
 };
 
-SR_PRIV int atorch_receive_data(int fd, int revents, void *cb_data);
+SR_PRIV int atorch_probe(struct sr_serial_dev_inst *serial, struct dev_context *devc);
+SR_PRIV int atorch_receive_data_callback(int fd, int revents, void *cb_data);
 
 #endif