X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fhameg-hmo%2Fprotocol.h;h=bdf70fc55ca3b6262162cb95f761e2436056c0f6;hb=5a7e62211c4714ea2aac35baac10cf448373d4f5;hp=9f27f01b899e3b6c296c1d5d1bbffce147dabab1;hpb=13f2b9d789fdc7130c0f31b88319bd0f3445109a;p=libsigrok.git diff --git a/hardware/hameg-hmo/protocol.h b/hardware/hameg-hmo/protocol.h index 9f27f01b..bdf70fc5 100644 --- a/hardware/hameg-hmo/protocol.h +++ b/hardware/hameg-hmo/protocol.h @@ -26,28 +26,11 @@ #include "libsigrok.h" #include "libsigrok-internal.h" -/* Message logging helpers with subsystem-specific prefix string. */ -#define LOG_PREFIX "hameg-hmo: " -#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) -#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) -#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) -#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) -#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) -#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) +#define LOG_PREFIX "hameg-hmo" #define MAX_INSTRUMENT_VERSIONS 10 #define MAX_COMMAND_SIZE 31 -SR_PRIV struct sr_dev_driver hameg_hmo_driver_info; -static struct sr_dev_driver *di = &hameg_hmo_driver_info; - -enum { - PG_INVALID = -1, - PG_NONE, - PG_ANALOG, - PG_DIGITAL, -}; - struct scope_config { const char *name[MAX_INSTRUMENT_VERSIONS]; const uint8_t analog_channels; @@ -86,7 +69,7 @@ struct scope_config { struct analog_channel_state { int coupling; - float vdiv; + int vdiv; float vertical_offset; gboolean state; @@ -97,11 +80,12 @@ struct scope_state { gboolean *digital_channels; gboolean *digital_pods; - float timebase; + int timebase; float horiz_triggerpos; int trigger_source; int trigger_slope; + uint64_t sample_rate; }; /** Private, per-device-instance driver context. */ @@ -109,11 +93,11 @@ struct dev_context { void *model_config; void *model_state; - struct sr_probe_group *analog_groups; - struct sr_probe_group *digital_groups; + struct sr_channel_group *analog_groups; + struct sr_channel_group *digital_groups; - GSList *enabled_probes; - GSList *current_probe; + GSList *enabled_channels; + GSList *current_channel; uint64_t num_frames; uint64_t frame_limit; @@ -121,12 +105,11 @@ struct dev_context { SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi); SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi); -SR_PRIV int hameg_hmo_receive_data(int fd, int revents, void *cb_data); -SR_PRIV struct sr_dev_inst *hameg_probe_serial_device(const char *serial_device, - const char *serial_options); +SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data); -SR_PRIV struct scope_state *scope_state_new(struct scope_config *config); -SR_PRIV void scope_state_free(struct scope_state *state); -SR_PRIV int scope_state_get(struct sr_dev_inst *sdi); +SR_PRIV struct scope_state *hmo_scope_state_new(struct scope_config *config); +SR_PRIV void hmo_scope_state_free(struct scope_state *state); +SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi); +SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi); #endif