]>
Commit | Line | Data |
---|---|---|
2999345d MG |
1 | struct usbtmc_header { |
2 | unsigned char MsgID; | |
3 | unsigned char bTag; | |
4 | unsigned char bTagInverse; | |
5 | unsigned char Reserved3; | |
6 | uint32_t TransferSize; | |
7 | unsigned char bmTransferAttributes; | |
8 | unsigned char TermChar; /* Only in REQUEST_DEV_DEP_MSG_IN */ | |
9 | unsigned char Reverved10; | |
10 | unsigned char Reverved11; | |
65f37f81 | 11 | unsigned char msg[]; |
2999345d MG |
12 | } __attribute__ ((__packed__)); |
13 | ||
483a564b MG |
14 | struct usbtmc_capabilities { |
15 | unsigned char USBTMC_status; | |
16 | unsigned char Reserved1; | |
17 | unsigned char bcdUSBTMC[2]; | |
18 | unsigned char USBTMCIFcapabilities; | |
19 | unsigned char USBTMCDEVcapabilities; | |
20 | unsigned char Reserved6[6]; | |
21 | unsigned char bcdUSB488[2]; | |
22 | unsigned char USB488IFcapabilities; | |
23 | unsigned char USB488DEVcapabilities; | |
24 | unsigned char Reserved16[8]; | |
25 | } __attribute__ ((__packed__)); | |
26 | ||
2999345d MG |
27 | #define USBTMC_DEV_DEP_MSG_OUT 0x1 |
28 | #define USBTMC_REQUEST_DEV_DEP_MSG_IN 0x2 | |
29 | #define USBTMC_DEV_DEP_MSG_IN 0x2 | |
30 | ||
31 | #define USBTMC_TRANSFERATTRIB_EOM (1<<0) | |
32 | #define USBTMC_TRANSFERATTRIB_TERMCHAR (1<<1) | |
33 | ||
483a564b MG |
34 | #define USBTMC_CTL_INITIATE_ABORT_BO 0x01 |
35 | #define USBTMC_CTL_CHECK_ABORT_BO_STAT 0x02 | |
36 | #define USBTMC_CTL_INITIATE_ABORT_BI 0x03 | |
37 | #define USBTMC_CTL_CHECK_ABORT_BI_STAT 0x04 | |
38 | #define USBTMC_CTL_INITIATE_CLEAR 0x05 | |
39 | #define USBTMC_CTL_CHECK_CLEAR_STAT 0x06 | |
40 | #define USBTMC_CTL_GET_CAPABILITIES 0x07 | |
41 | #define USBTMC_CTL_INDICATOR_PULSE 0x40 | |
42 | #define USB488_CTL_READ_STATUS_BYTE 0x80 | |
43 | #define USB488_CTL_REN_CONTROL 0xa0 | |
44 | #define USB488_CTL_GO_TO_LOCAL 0xa1 | |
45 | #define USB488_CTL_LOCAL_LOCKOUT 0xa2 | |
46 | ||
47 | #define USBTMC_CAP_IF_INDICATOR_PULSE (1<<2) | |
48 | #define USBTMC_CAP_IF_TALKONLY (1<<1) | |
49 | #define USBTMC_CAP_IF_LISTENONLY (1<<0) | |
50 | #define USBTMC_CAP_DEV_TERMCHAR_SUPP (1<<0) | |
51 | #define USB488_CAP_IF_4882 (1<<2) | |
52 | #define USB488_CAP_IF_LOCKOUT (1<<1) | |
53 | #define USB488_CAP_IF_TRIGGER (1<<0) | |
54 | #define USB488_CAP_DEV_SCPI (1<<3) | |
55 | #define USB488_CAP_DEV_SR1 (1<<2) | |
56 | #define USB488_CAP_DEV_RL1 (1<<1) | |
57 | #define USB488_CAP_DEV_DT1 (1<<0) | |
58 | ||
07a45f03 MG |
59 | #define USBTMC_STATUS_SUCCESS 0x01 |
60 | #define USBTMC_STATUS_PENDING 0x02 | |
61 | #define USBTMC_STATUS_FAILED 0x80 | |
62 | #define USBTMC_STATUS_TRANS_NIP 0x81 | |
63 | #define USBTMC_STATUS_SPLIT_NIP 0x82 | |
64 | #define USBTMC_STATUS_SPLIT_IP 0x83 | |
65 | ||
66 | #define USBTMC_STATUS_SUCC(x) (x == USBTMC_STATUS_SUCCESS) | |
67 | #define USBTMC_STATUS_WARN(x) ((x > USBTMC_STATUS_SUCCESS) && (x < USBTMC_STATUS_FAILED)) | |
68 | #define USBTMC_STATUS_FAIL(x) (x >= USBTMC_STATUS_FAILED) | |
69 | ||
7906b395 MG |
70 | int usbtmc_sendscpi(struct scope *sc, char* cmd, unsigned char *resp, int resplen); |
71 | struct scope * usbtmc_initscope(void); | |
72 | void usbtmc_close(struct scope *sc); | |
73 | void usbtmc_claim(struct scope *sc); | |
74 | void usbtmc_release(struct scope *sc); | |
10ca7ea8 | 75 | void usbtmc_reset(struct scope *sc); |