X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fhardware%2Fgmc-mh-1x-2x%2Fprotocol.h;h=ed759694861d2b59c8e6b75c626a7313b18012d8;hb=060df80fb354246cc309ef80927d38e37e922eb2;hp=87034e6b784e1ef90098d86952e733faad839214;hpb=07ffa5b315caab0d6d703e04f09035bc0f2b3ee4;p=libsigrok.git
diff --git a/src/hardware/gmc-mh-1x-2x/protocol.h b/src/hardware/gmc-mh-1x-2x/protocol.h
index 87034e6b..ed759694 100644
--- a/src/hardware/gmc-mh-1x-2x/protocol.h
+++ b/src/hardware/gmc-mh-1x-2x/protocol.h
@@ -17,17 +17,12 @@
* along with this program. If not, see .
*/
-/** @file
- * Gossen Metrawatt Metrahit 1x/2x drivers
- * @internal
- */
-
#ifndef LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H
#define LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H
#include
#include
-#include "libsigrok.h"
+#include
#include "libsigrok-internal.h"
#define LOG_PREFIX "gmc-mh-1x-2x"
@@ -42,7 +37,7 @@
#define MSGID_DTA 0x20 /**< Start of data message, displayed, averaged */
#define MSGID_DATA 0x30 /**< Data byte in message */
-#define MSGC_MASK 0x0f /**< Mask to get message byte contents in send mode */
+#define MSGC_MASK 0x0f /**< Mask to get message byte contents in send mode */
#define MSGSRC_MASK 0xc0 /**< Mask to get bits related to message source */
@@ -81,27 +76,19 @@ enum model {
METRAHIT_29S = METRAHIT_28S + 1,
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
enum model model; /**< Model code. */
- /* Acquisition settings */
- uint64_t limit_samples; /**< Target number of samples */
- uint64_t limit_msec; /**< Target sampling time */
-
- /* Opaque pointer passed in by frontend. */
- void *cb_data;
+ struct sr_sw_limits limits;
- /* Operational state */
gboolean settings_ok; /**< Settings msg received yet. */
int msg_type; /**< Message type (MSGID_INF, ...). */
int msg_len; /**< Message length (valid when msg, curr. type known).*/
- int mq; /**< Measured quantity */
- int unit; /**< Measured unit */
- uint64_t mqflags; /**< Measured quantity flags */
+ enum sr_mq mq; /**< Measured quantity */
+ enum sr_unit unit; /**< Measured unit */
+ enum sr_mqflag mqflags; /**< Measured quantity flags */
float value; /**< Measured value */
- float scale; /**< Scale for value. */
+ int8_t scale; /**< Scale for value. */
int8_t scale1000; /**< Additional scale factor 1000x. */
int addr; /**< Device address (1..15). */
int cmd_idx; /**< Parameter "Idx" (Index) of current command, if required. */
@@ -113,18 +100,12 @@ struct dev_context {
int64_t req_sent_at; /**< Request sent. */
gboolean response_pending; /**< Request sent, response is pending. */
- /* Temporary state across callbacks */
- uint64_t num_samples; /**< Current #samples for limit_samples */
- GTimer *elapsed_msec; /**< Used for sampling with limit_msec */
uint8_t buf[GMC_BUFSIZE]; /**< Buffer for read callback */
int buflen; /**< Data len in buf */
};
-/* Forward declarations */
SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg);
-SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf);
-SR_PRIV void dump_msg14(guchar* buf, gboolean raw);
SR_PRIV int gmc_decode_model_bd(uint8_t mcode);
SR_PRIV int gmc_decode_model_sm(uint8_t mcode);
SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data);