X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fscpi.h;h=c70bd930fd5b2e42d284be08973516790b68ad2c;hb=88a0265ebcb265ba839c02cc5bcd39e359c9f60f;hp=36bc16270c6e3c19bcbc6f5e3a2340ec3c456ecc;hpb=5a1afc0907abfee5848484f944789213d6be9752;p=libsigrok.git diff --git a/src/scpi.h b/src/scpi.h index 36bc1627..c70bd930 100644 --- a/src/scpi.h +++ b/src/scpi.h @@ -58,6 +58,11 @@ enum { SCPI_CMD_GET_SAMPLE_RATE_LIVE, }; +struct scpi_command { + int command; + const char *string; +}; + struct sr_scpi_hw_info { char *manufacturer; char *model; @@ -72,7 +77,7 @@ struct sr_scpi_dev_inst { GSList *(*scan)(struct drv_context *drvc); int (*dev_inst_new)(void *priv, struct drv_context *drvc, const char *resource, char **params, const char *serialcomm); - int (*open)(void *priv); + int (*open)(struct sr_scpi_dev_inst *scpi); int (*source_add)(struct sr_session *session, void *priv, int events, int timeout, sr_receive_data_callback cb, void *cb_data); int (*source_remove)(struct sr_session *session, void *priv); @@ -80,10 +85,12 @@ struct sr_scpi_dev_inst { int (*read_begin)(void *priv); int (*read_data)(void *priv, char *buf, int maxlen); int (*read_complete)(void *priv); - int (*close)(void *priv); + int (*close)(struct sr_scpi_dev_inst *scpi); void (*free)(void *priv); unsigned int read_timeout_ms; void *priv; + /* Only used for quirk workarounds, notably the Rigol DS1000 series. */ + uint64_t firmware_version; }; SR_PRIV GSList *sr_scpi_scan(struct drv_context *drvc, GSList *options, @@ -125,4 +132,12 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi, struct sr_scpi_hw_info **scpi_response); SR_PRIV void sr_scpi_hw_info_free(struct sr_scpi_hw_info *hw_info); +SR_PRIV const char *sr_vendor_alias(const char *raw_vendor); +SR_PRIV const char *scpi_cmd_get(const struct scpi_command *cmdtable, int command); +SR_PRIV int scpi_cmd(const struct sr_dev_inst *sdi, + const struct scpi_command *cmdtable, int command, ...); +SR_PRIV int scpi_cmd_resp(const struct sr_dev_inst *sdi, + const struct scpi_command *cmdtable, + GVariant **gvar, const GVariantType *gvtype, int command, ...); + #endif