]> git.zerfleddert.de Git - rigol/blobdiff - usbtmc.h
defines for STATUS bytes
[rigol] / usbtmc.h
index 175511e8926fa69247ca13540c42bcc614a8dc98..3734ff5d3aa0a4d11517f39d9e31c422e8cdbcbf 100644 (file)
--- a/usbtmc.h
+++ b/usbtmc.h
@@ -1,3 +1,74 @@
-int usbtmc_sendscpi(usb_dev_handle *dev, char* cmd, unsigned char *resp, int resplen);
-usb_dev_handle* usbtmc_initscope(void);
-void usbtmc_close(usb_dev_handle *sc);
+struct usbtmc_header {
+       unsigned char MsgID;
+       unsigned char bTag;
+       unsigned char bTagInverse;
+       unsigned char Reserved3;
+       uint32_t TransferSize;
+       unsigned char bmTransferAttributes;
+       unsigned char TermChar; /* Only in REQUEST_DEV_DEP_MSG_IN */
+       unsigned char Reverved10;
+       unsigned char Reverved11;
+       unsigned char msg[];
+} __attribute__ ((__packed__));
+
+struct usbtmc_capabilities {
+       unsigned char USBTMC_status;
+       unsigned char Reserved1;
+       unsigned char bcdUSBTMC[2];
+       unsigned char USBTMCIFcapabilities;
+       unsigned char USBTMCDEVcapabilities;
+       unsigned char Reserved6[6];
+       unsigned char bcdUSB488[2];
+       unsigned char USB488IFcapabilities;
+       unsigned char USB488DEVcapabilities;
+       unsigned char Reserved16[8];
+} __attribute__ ((__packed__));
+
+#define USBTMC_DEV_DEP_MSG_OUT         0x1
+#define USBTMC_REQUEST_DEV_DEP_MSG_IN  0x2
+#define USBTMC_DEV_DEP_MSG_IN          0x2
+
+#define USBTMC_TRANSFERATTRIB_EOM      (1<<0)
+#define USBTMC_TRANSFERATTRIB_TERMCHAR (1<<1)
+
+#define USBTMC_CTL_INITIATE_ABORT_BO   0x01
+#define USBTMC_CTL_CHECK_ABORT_BO_STAT 0x02
+#define USBTMC_CTL_INITIATE_ABORT_BI   0x03
+#define USBTMC_CTL_CHECK_ABORT_BI_STAT 0x04
+#define USBTMC_CTL_INITIATE_CLEAR      0x05
+#define USBTMC_CTL_CHECK_CLEAR_STAT    0x06
+#define USBTMC_CTL_GET_CAPABILITIES    0x07
+#define USBTMC_CTL_INDICATOR_PULSE     0x40
+#define USB488_CTL_READ_STATUS_BYTE    0x80
+#define USB488_CTL_REN_CONTROL         0xa0
+#define USB488_CTL_GO_TO_LOCAL         0xa1
+#define USB488_CTL_LOCAL_LOCKOUT       0xa2
+
+#define USBTMC_CAP_IF_INDICATOR_PULSE  (1<<2)
+#define USBTMC_CAP_IF_TALKONLY         (1<<1)
+#define USBTMC_CAP_IF_LISTENONLY       (1<<0)
+#define USBTMC_CAP_DEV_TERMCHAR_SUPP   (1<<0)
+#define USB488_CAP_IF_4882             (1<<2)
+#define USB488_CAP_IF_LOCKOUT          (1<<1)
+#define USB488_CAP_IF_TRIGGER          (1<<0)
+#define USB488_CAP_DEV_SCPI            (1<<3)
+#define USB488_CAP_DEV_SR1             (1<<2)
+#define USB488_CAP_DEV_RL1             (1<<1)
+#define USB488_CAP_DEV_DT1             (1<<0)
+
+#define USBTMC_STATUS_SUCCESS          0x01
+#define USBTMC_STATUS_PENDING          0x02
+#define USBTMC_STATUS_FAILED           0x80
+#define USBTMC_STATUS_TRANS_NIP                0x81
+#define USBTMC_STATUS_SPLIT_NIP                0x82
+#define USBTMC_STATUS_SPLIT_IP         0x83
+
+#define USBTMC_STATUS_SUCC(x)  (x == USBTMC_STATUS_SUCCESS)
+#define USBTMC_STATUS_WARN(x)  ((x > USBTMC_STATUS_SUCCESS) && (x < USBTMC_STATUS_FAILED))
+#define USBTMC_STATUS_FAIL(x)  (x >= USBTMC_STATUS_FAILED)
+
+int usbtmc_sendscpi(struct scope *sc, char* cmd, unsigned char *resp, int resplen);
+struct scope * usbtmc_initscope(void);
+void usbtmc_close(struct scope *sc);
+void usbtmc_claim(struct scope *sc);
+void usbtmc_release(struct scope *sc);
Impressum, Datenschutz