X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fatorch%2Fprotocol.h;fp=src%2Fhardware%2Fatorch%2Fprotocol.h;h=05cbe839af80f8421b393a768823f67e02e66521;hb=a5800e90ab7154b5179c3d95ac988bda715ebbb2;hp=9312fae3ace9c48de482f4da3117a692410bb77c;hpb=cc9653de22d72b5694d56492348895097a5c626b;p=libsigrok.git diff --git a/src/hardware/atorch/protocol.h b/src/hardware/atorch/protocol.h index 9312fae3..05cbe839 100644 --- a/src/hardware/atorch/protocol.h +++ b/src/hardware/atorch/protocol.h @@ -20,16 +20,49 @@ #ifndef LIBSIGROK_HARDWARE_ATORCH_PROTOCOL_H #define LIBSIGROK_HARDWARE_ATORCH_PROTOCOL_H -#include #include #include +#include + #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