X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fserial-dmm%2Fprotocol.h;h=decd429d89969acd6bd50e090cbcdd48da92eca4;hb=1c0e1baaaaf0314f49470fb49a4f5e6ddc0ba1a1;hp=202eba2748f60ec6b0b34b92c02c198c02d9aee8;hpb=bcbef5ed709a56e8cec3d7d0b5f73a00a4040984;p=libsigrok.git diff --git a/src/hardware/serial-dmm/protocol.h b/src/hardware/serial-dmm/protocol.h index 202eba27..decd429d 100644 --- a/src/hardware/serial-dmm/protocol.h +++ b/src/hardware/serial-dmm/protocol.h @@ -26,23 +26,31 @@ struct dmm_info { /** libsigrok driver info struct. */ struct sr_dev_driver di; /** Manufacturer/brand. */ - char *vendor; + const char *vendor; /** Model. */ - char *device; + const char *device; /** serialconn string. */ - char *conn; + const char *conn; /** Baud rate. */ uint32_t baudrate; /** Packet size in bytes. */ int packet_size; - /** Request timeout [ms] before request is considered lost and a new - * one is sent. Used only if device needs polling. */ + /** + * Request timeout [ms] before request is considered lost and a new + * one is sent. Used only if device needs polling. + */ int64_t req_timeout_ms; - /** Delay between reception of packet and next request. Some DMMs - * need this. Used only if device needs polling. */ + /** + * Delay between reception of packet and next request. Some DMMs + * need this. Used only if device needs polling. + */ int64_t req_delay_ms; /** Packet request function. */ int (*packet_request)(struct sr_serial_dev_inst *); + /** Number of channels / displays. */ + size_t channel_count; + /** (Optional) printf formats for channel names. */ + const char **channel_formats; /** Packet validation function. */ gboolean (*packet_valid)(const uint8_t *); /** Packet parsing function. */ @@ -54,33 +62,19 @@ struct dmm_info { gsize info_size; }; -extern SR_PRIV struct dmm_info *dmms[]; - #define DMM_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { - /** The current sampling limit (in number of samples). */ - uint64_t limit_samples; - - /** The time limit (in milliseconds). */ - uint64_t limit_msec; - - /** Opaque pointer passed in by the frontend. */ - void *cb_data; - - /** The current number of already received samples. */ - uint64_t num_samples; - - /** The starting time of current sampling run. */ - int64_t starttime; + struct sr_sw_limits limits; uint8_t buf[DMM_BUFSIZE]; int bufoffset; int buflen; - /** The timestamp [µs] to send the next request. - * Used only if device needs polling. */ + /** + * The timestamp [µs] to send the next request. + * Used only if device needs polling. + */ int64_t req_next_at; };