📄 sicl.h
字号:
/* Copyright 1992-2001 Agilent Technologies Inc. All Rights Reserved. */
/*
* Agilent Standard Instrument Control Library
*
* This file conforms to the Agilent SICL Spec as specified in I_SICL_REVISION.
*
* #define's used (can be #defined by user):
* STD_SICL - Disallows non-standard constructs
*
* #define's used (not typically set by user)
* SICL_H - Prevents multiple inclusion
* SICL_NOPROTO - Don't include function prototypes
*
*/
/*
* Make sure this file is only included once
*/
#if !defined(SICL_H)
#define SICL_H
/*
* determine which OS we are compiling on
* Don't use #elif here, some bug in std cpp on hpux. DTS ISLxx14032
*/
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#define _SICL_WIN32
#if !defined(__BORLANDC__)
#define _SICL_VXI_D64
#endif
#else
#if defined(__MSDOS__)||defined(MSDOS)||defined(_MSDOS)||defined(_WINDOWS)
#define _MS_DOS_WIN
#endif
#endif
#if defined(__hpux)
#define _SICL_HPUX
#if defined(__cplusplus)
#define volatile
#endif
#endif
#if defined(__Lynx__) && defined(__68k__)
#define _SICL_LYNX_BE
#endif
#if defined(__Lynx__) && defined(__x86__)
#define _SICL_LYNX_LE
#define _SICL_LYNX_FA /* This is for Lynx on Fantasia */
#endif
#if defined(linux)
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define _SICL_LINUX_LE
#elif (__BYTE_ORDER == __BIG_ENDIAN) /* (__BYTE_ORDER == __LITTLE_ENDIAN) */
#define _SICL_LINUX_BE
#endif /* (__BYTE_ORDER == __LITTLE_ENDIAN) */
#endif
/*
* define out Windows specific keywords if not compiling for Windows
*/
#if !defined(_MS_DOS_WIN)
#define _near
#define _far
#define _huge
#define _pascal
#define _export
#endif
/*
* define SICLAPI, SICLAPIV, and SICLCALLBACK appropriately
*/
#if defined(_SICL_WIN32)
#define SICLAPI __cdecl
#define SICLAPIV __cdecl
#define SICLCALLBACK __cdecl
#else
#if defined(_MS_DOS_WIN)
#define SICLCALLBACK _far _pascal _export
#define SICLAPI _far _pascal
#define SICLAPIV _far __cdecl
#else
#define SICLAPI
#define SICLAPIV
#define SICLCALLBACK
#endif
#endif
/*
* Support levels:
*/
#define I_SICL_REVISION 40 /* Agilent SICL Revision 4.0 */
#define I_SICL_LEVEL 3 /* Support Level */
#define I_SICL_FMTIO /* Support Formatted I/O */
#define I_SICL_GPIB /* Support GP-IB */
#define I_SICL_VXI /* Support VXI */
#define I_SICL_LAN /* Support LAN */
#define I_SICL_RS232 /* Support RS-232 */
#define I_SICL_GPIO /* Support GPIO */
#define I_SICL_MSIB /* Support MSIB */
/*
* The following is needed for functions that require va_list in the
* prototypes.
*/
#if defined(I_SICL_FMTIO)
#include <stdarg.h>
#endif
/*
* Definition of INST:
*/
typedef int INST;
/*
* session types
*/
#define I_SESS_INTF 1
#define I_SESS_DEV 2
#define I_SESS_CMDR 3
#define I_SESS_SERVANT 4
/*
* interface types
*/
#define I_INTF_NONE 0
#define I_INTF_GPIB 1
#define I_INTF_VXI 2
#define I_INTF_RS232 3
#define I_INTF_GPIO 4
/* 5 is reserved -- don't use */
#define I_INTF_USRDEF 6
/* 7 is reserved -- don't use */
#define I_INTF_MSIB 8
#define I_INTF_LAN 9
#define I_INTF_1394 10
#define I_INTF_SOCKET 11
#define I_INTF_USB 12
/*
* iread termination conditions
*/
#define I_TERM_MAXCNT 1
#define I_TERM_CHR 2
#define I_TERM_END 4
/*
* ixtrig 'which' values. Note: different interface types may have
* overlapping constants. However, don't overlap them until it is required.
*/
#define I_TRIG_STD 0x00000001L
#define I_TRIG_ALL 0xffffffffL
#define I_TRIG_TTL0 0x00001000L
#define I_TRIG_TTL1 0x00002000L
#define I_TRIG_TTL2 0x00004000L
#define I_TRIG_TTL3 0x00008000L
#define I_TRIG_TTL4 0x00010000L
#define I_TRIG_TTL5 0x00020000L
#define I_TRIG_TTL6 0x00040000L
#define I_TRIG_TTL7 0x00080000L
#define I_TRIG_ECL0 0x00100000L
#define I_TRIG_ECL1 0x00200000L
#define I_TRIG_ECL2 0x00400000L
#define I_TRIG_ECL3 0x00800000L
#define I_TRIG_EXT0 0x01000000L
#define I_TRIG_EXT1 0x02000000L
#define I_TRIG_EXT2 0x04000000L
#define I_TRIG_EXT3 0x08000000L
#define I_TRIG_CLK0 0x10000000L
#define I_TRIG_CLK1 0x20000000L
#define I_TRIG_CLK2 0x40000000L
#define I_TRIG_CLK10 0x80000000L
#define I_TRIG_CLK100 0x00000800L
#define I_TRIG_SERIAL_DTR 0x00000400L
#define I_TRIG_SERIAL_RTS 0x00000200L
#define I_TRIG_GPIO_CTL0 0x00000100L
#define I_TRIG_GPIO_CTL1 0x00000080L
/*
* ihint values
*/
#define I_HINT_DONTCARE 0
#define I_HINT_USEDMA 1
#define I_HINT_USEPOLL 2
#define I_HINT_USEINTR 3
#define I_HINT_SYSTEM 4
#define I_HINT_IO 5
/*
* isetintr values
*/
/* 1-15 are interface independant */
#define I_INTR_OFF 0 /* Turn off interrupts */
#define I_INTR_INTFACT 1
#define I_INTR_INTFDEACT 2
#define I_INTR_TRIG 3
#define I_INTR_STB 4
#define I_INTR_DEVCLR 5
/* 16-31 are interface specific */
/* VXI Interrupts */
#define I_INTR_VXI_SIGNAL 16
#define I_INTR_VXI_SYSRESET 17
#define I_INTR_VXI_VME 18
#define I_INTR_VXI_LLOCK 19
#define I_INTR_VXI_UKNSIG 20
#define I_INTR_VXI_VMESYSFAIL 21
#define I_INTR_VME_IRQ1 22
#define I_INTR_VME_IRQ2 23
#define I_INTR_VME_IRQ3 24
#define I_INTR_VME_IRQ4 25
#define I_INTR_VME_IRQ5 26
#define I_INTR_VME_IRQ6 27
#define I_INTR_VME_IRQ7 28
#define I_INTR_ANY_SIG 29
/* GP-IB Interrupts */
#define I_INTR_GPIB_IFC 16
#define I_INTR_GPIB_PPOLLCONFIG 17
#define I_INTR_GPIB_REMLOC 18
#define I_INTR_GPIB_GET 20
#define I_INTR_GPIB_TLAC 21
#define I_INTR_GPIB_MAX 21 // Ensure this value == largest GPIB INTR
/* RS-232 Interrupts */
#define I_INTR_SERIAL_DAV 16
#define I_INTR_SERIAL_MSL 17
#define I_INTR_SERIAL_BREAK 18
#define I_INTR_SERIAL_ERROR 19
#define I_INTR_SERIAL_TEMT 20
#define I_INTR_SERIAL_MCL 21
/* GP-IO Interrupts */
#define I_INTR_GPIO_EIR 16
#define I_INTR_GPIO_RDY 17
/* MSIB Interrupts */
#define I_INTR_MSIB_END_RECEIVED 22
#define I_INTR_MSIB_LINK_BROKEN 23
/* 32 maximum isetintr values */
#define I_INTR_MAX 32
/*
* Swap Constants
*
* NOTE: The byte ordering constants are more than OS dependant,
* but also dependant on the computer it is implemented on. (i.e.
* UNIX has been implemented on INTEL machines and Motorola machines.)
* If your machine is not identified here, you must be porting our
* code. You need to create a constant that uniquely identifies
* your OS and machine and define the correct ordering macro. For
* long term support, submit a DTS, with explicite instruction
* describing the enhancement for you system.
*/
#if defined(_MS_DOS_WIN) || defined(_SICL_WIN32) || defined(_SICL_LYNX_LE) || defined (_SICL_LINUX_LE)
/* Little Endian */
#define I_ORDER_LE
#undef I_ORDER_BE
#endif
#if defined(_SICL_HPUX) || defined(_SICL_LYNX_BE) || defined(_SICL_LINUX_BE)
/* Big Endian */
#undef I_ORDER_LE
#define I_ORDER_BE
#endif
/* ivxibusstatus values */
#define I_VXI_BUS_TRIGGER 0
#define I_VXI_BUS_LADDR 1
#define I_VXI_BUS_SERVANT_AREA 2
#define I_VXI_BUS_NORMOP 3
#define I_VXI_BUS_CMDR_LADDR 4
#define I_VXI_BUS_MAN_ID 5
#define I_VXI_BUS_MODEL_ID 6
#define I_VXI_BUS_PROTOCOL 7
#define I_VXI_BUS_XPROT 8
#define I_VXI_BUS_SHM_SIZE 9
#define I_VXI_BUS_SHM_ADDR_SPACE 10
#define I_VXI_BUS_SHM_PAGE 11
#define I_VXI_BUS_VXIMXI 12
#define I_VXI_BUS_TRIGSUPP 13
/* igpibbusstatus values */
#define I_GPIB_BUS_REM 1
#define I_GPIB_BUS_SRQ 2
#define I_GPIB_BUS_NDAC 3
#define I_GPIB_BUS_SYSCTLR 4
#define I_GPIB_BUS_ACTCTLR 5
#define I_GPIB_BUS_TALKER 6
#define I_GPIB_BUS_LISTENER 7
#define I_GPIB_BUS_ADDR 8
#define I_GPIB_BUS_LINES 9
#define I_GPIB_T1DELAY_MIN 350
#define I_GPIB_T1DELAY_MAX 2400
/* values for igpioctrl and igpiostat */
#define I_GPIO_AUX 1
#define I_GPIO_CTRL 2
#define I_GPIO_DATA 3
#define I_GPIO_INFO 4
#define I_GPIO_SET_PCTL 5
#define I_GPIO_STAT 6
#define I_GPIO_READ_EOI 7
#define I_GPIO_TEST_ONLY 8
#define I_GPIO_POLARITY 9
#define I_GPIO_READ_CLK 10
#define I_GPIO_PCTL_DELAY 11
/*
* Note that I_GPIO_CHK_PSTS and I_GPIO_AUTO_HDSK are safely overloaded
* an igpioctrl request value and a bit mask for I_GPIO_INFO. This is
* OK because their values (16 and 32) do not conflict with any other
* defined igpioctrl values.
*/
#define I_GPIO_CTRL_CTL0 0x01
#define I_GPIO_CTRL_CTL1 0x02
#define I_GPIO_STAT_STI0 0x01
#define I_GPIO_STAT_STI1 0x02
#define I_GPIO_EIR 0x04
#define I_GPIO_PSTS 0x08
#define I_GPIO_CHK_PSTS 0x10
#define I_GPIO_AUTO_HDSK 0x20
#define I_GPIO_ENH_MODE 0x40
#define I_GPIO_READY 0x80
#define I_GPIO_EOI_NONE 0x10000
/* RS-232 values */
/* STATUS AND CONTROL CONST */
#define I_SERIAL_BAUD 1
#define I_SERIAL_PARITY 2
#define I_SERIAL_STOP 3
#define I_SERIAL_WIDTH 4
#define I_SERIAL_FLOW_CTRL 5
#define I_SERIAL_MSL 6
#define I_SERIAL_STAT 7
#define I_SERIAL_RESET 9
#define I_SERIAL_READ_EOI 10
#define I_SERIAL_WRITE_EOI 11
#define I_SERIAL_DUPLEX 12
#define I_SERIAL_READ_BUFSZ 13
#define I_SERIAL_READ_DAV 14
#define I_SERIAL_IN_DISCARD 15
#define I_SERIAL_OUT_DISCARD 16
#define I_SERIAL_XON_CHAR 17
#define I_SERIAL_XOFF_CHAR 18
#define I_SERIAL_REPLACE_CHAR 19
/* SERIAL duplex modes */
#define I_SERIAL_DUPLEX_HALF 0x0001
#define I_SERIAL_DUPLEX_FULL 0x0002
/* SERIAL UART STATUS */
#define I_SERIAL_DAV 0x0001
#define I_SERIAL_OVERFLOW 0x0002
#define I_SERIAL_PARERR 0x0004
#define I_SERIAL_FRAMING 0x0008
#define I_SERIAL_BREAK 0x0010
#define I_SERIAL_TEMT 0x0020
/* FLOW CONTROL CONST */
#define I_SERIAL_FLOW_NONE 0
#define I_SERIAL_FLOW_XON 1
#define I_SERIAL_FLOW_RTS_CTS 2
#define I_SERIAL_FLOW_DTR_DSR 3
/* SERIAL MODEM STATUS LINES */
#define I_SERIAL_DCD 0x0001
#define I_SERIAL_DSR 0x0002
#define I_SERIAL_CTS 0x0004
#define I_SERIAL_RI 0x0008
#define I_SERIAL_D_DCD 0x0010
#define I_SERIAL_D_DSR 0x0020
#define I_SERIAL_D_CTS 0x0040
#define I_SERIAL_TERI 0x0080
/* SERIAL MODEM CONTROL LINES */
#define I_SERIAL_RTS 0x1000
#define I_SERIAL_DTR 0x2000
/* SERIAL PARITY VALUES */
#define I_SERIAL_PAR_NONE 0
#define I_SERIAL_PAR_EVEN 1
#define I_SERIAL_PAR_ODD 2
#define I_SERIAL_PAR_MARK 3
#define I_SERIAL_PAR_SPACE 4
#define I_SERIAL_PAR_IGNORE 5
/* SERIAL STOP-BIT VALUES */
#define I_SERIAL_STOP_1 1
#define I_SERIAL_STOP_2 2
/* SERIAL CHARACTER WIDTH */
#define I_SERIAL_CHAR_5 5
#define I_SERIAL_CHAR_6 6
#define I_SERIAL_CHAR_7 7
#define I_SERIAL_CHAR_8 8
/* EOI support (used with the I_SERIAL_*_EOI command) */
#define I_SERIAL_EOI_CHR 0x100
#define I_SERIAL_EOI_NONE 0x200
#define I_SERIAL_EOI_BIT8 0x400
#define I_SERIAL_EOI_BREAK 0x800
/*
* MSIB error types (for imsibseterror)
*/
#define I_MSIB_PERMANENTERR 0
#define I_MSIB_TRANSIENTERR 1
/*
* MSIB commands (for imsibcmd)
*/
#define I_MSIB_CMD_NULL 0x0000
#define I_MSIB_CMD_END 0x0001
#define I_MSIB_CMD_SEND_CAPABILITY 0x0002
#define I_MSIB_CMD_RETURN_TO_LOCAL 0x0006
#define I_MSIB_CMD_LOCK_LINK 0x0007
#define I_MSIB_CMD_UNLOCK_LINK 0x0008
#define I_MSIB_CMD_LIGHT_ACTIVE 0x0009
#define I_MSIB_CMD_UNLIGHT_ACTIVE 0x000A
#define I_MSIB_CMD_ERROR_OCCURRED 0x000B
#define I_MSIB_CMD_ERRORS_CLEARED 0x000C
#define I_MSIB_CMD_SEND_STATUS 0x0010
#define I_MSIB_CMD_SEND_ERRORS 0x0011
#define I_MSIB_CMD_SEND_MODULE_ID 0x0012
#define I_MSIB_CMD_SEND_MANUFACTURER 0x0013
#define I_MSIB_CMD_SEND_TIME 0x0014
#define I_MSIB_CMD_LINK_REMOTE 0x0015
#define I_MSIB_CMD_LINK_LOCAL 0x0016
#define I_MSIB_CMD_SEND_MODEL_NUMBER 0x0017
#define I_MSIB_CMD_SEND_SERIAL_NUMBER 0x0018
#define I_MSIB_CMD_SEND_FIRMWARE_REV 0x0019
#define I_MSIB_CMD_STATUS 0x0600
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -