]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/yokogawa-dlm/protocol.h
yokogawa-dlm: Introduce config_channel_set()
[libsigrok.git] / src / hardware / yokogawa-dlm / protocol.h
index 0950267a3a0065a90df5cb7806bb829e066553a1..c5e7d5609daabe2fb301f0fe439d2eebbbfbc2ff 100644 (file)
 #include "protocol_wrappers.h"
 
 #define LOG_PREFIX "yokogawa-dlm"
-#define MAX_INSTRUMENT_VERSIONS 4
+#define MAX_INSTRUMENT_VERSIONS 8
 
-#define RECEIVE_BUFFER_SIZE (4096)
+#define RECEIVE_BUFFER_SIZE 4096
 
 /* See Communication Interface User's Manual on p. 268 (:WAVeform:ALL:SEND?). */
-#define DLM_MAX_FRAME_LENGTH (12500)
+#define DLM_MAX_FRAME_LENGTH 12500
 /* See Communication Interface User's Manual on p. 269 (:WAVeform:SEND?). */
-#define DLM_DIVISION_FOR_WORD_FORMAT (3200)
-#define DLM_DIVISION_FOR_BYTE_FORMAT (12.5)
+#define DLM_DIVISION_FOR_WORD_FORMAT 3200
+#define DLM_DIVISION_FOR_BYTE_FORMAT 12.5
 
+#define DLM_DIG_CHAN_INDEX_OFFS (32)
 
 enum trigger_slopes {
        SLOPE_POSITIVE,
        SLOPE_NEGATIVE
 };
 
+extern const char *dlm_trigger_slopes[3];
+extern const uint64_t dlm_timebases[36][2];
+extern const uint64_t dlm_vdivs[17][2];
+
 struct scope_config {
        const char *model_id[MAX_INSTRUMENT_VERSIONS];
        const char *model_name[MAX_INSTRUMENT_VERSIONS];
@@ -57,26 +62,12 @@ struct scope_config {
        const char *(*analog_names)[];
        const char *(*digital_names)[];
 
-       const int32_t (*hw_caps)[];
-       const uint8_t num_hwcaps;
-
-       const int32_t (*analog_hwcaps)[];
-       const uint8_t num_analog_hwcaps;
-
        const char *(*coupling_options)[];
        const uint8_t num_coupling_options;
 
        const char *(*trigger_sources)[];
        const uint8_t num_trigger_sources;
 
-       const char *(*trigger_slopes)[];
-
-       const uint64_t (*timebases)[][2];
-       const uint8_t num_timebases;
-
-       const uint64_t (*vdivs)[][2];
-       const uint8_t num_vdivs;
-
        const uint8_t num_xdivs;
        const uint8_t num_ydivs;
 };
@@ -106,7 +97,7 @@ struct scope_state {
 
 /** Private, per-device-instance driver context. */
 struct dev_context {
-       void *model_config;
+       const void *model_config;
        void *model_state;
 
        struct sr_channel_group **analog_groups;
@@ -122,18 +113,15 @@ struct dev_context {
        gboolean data_pending;
 };
 
-/*--- api.c -----------------------------------------------------------------*/
+SR_PRIV int dlm_channel_state_set(const struct sr_dev_inst *sdi,
+               const int ch_index, gboolean state);
 SR_PRIV int dlm_data_request(const struct sr_dev_inst *sdi);
-
-/*--- protocol.c ------------------------------------------------------------*/
 SR_PRIV int dlm_model_get(char *model_id, char **model_name, int *model_index);
 SR_PRIV int dlm_device_init(struct sr_dev_inst *sdi, int model_index);
 SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data);
-
 SR_PRIV void dlm_scope_state_destroy(struct scope_state *state);
 SR_PRIV int dlm_scope_state_query(struct sr_dev_inst *sdi);
 SR_PRIV int dlm_sample_rate_query(const struct sr_dev_inst *sdi);
-
 SR_PRIV int dlm_channel_data_request(const struct sr_dev_inst *sdi);
 
 #endif