home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 September / CHIP_CD_1997_09_PL.iso / software / testsoft / labwind / demo.6 / main / include / gpib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-02  |  22.8 KB  |  491 lines

  1. /*============================================================================*/
  2. /*                        L a b W i n d o w s / C V I                         */
  3. /*----------------------------------------------------------------------------*/
  4. /*    Copyright (c) National Instruments 1987-1995.  All Rights Reserved.     */
  5. /*----------------------------------------------------------------------------*/
  6. /*                                                                            */
  7. /* Title:       gpib.h                                                        */
  8. /* Purpose:     Include file for Win32 and Solaris 2                          */
  9. /*                                                                            */
  10. /*============================================================================*/
  11.  
  12. #ifndef _GPIB_HEADER_
  13. #define _GPIB_HEADER_
  14.  
  15. #ifdef _CVI_
  16. #pragma EnableLibraryRuntimeChecking
  17. #endif
  18.  
  19. #include "cvidef.h"
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25.  
  26. /**************************************************************************/
  27. /* Global variables.                                                      */
  28. /**************************************************************************/
  29.  
  30. extern int  ibsta, iberr, ibcnt;
  31.  
  32. #if defined(_NI_mswin32_)
  33. extern long ibcntl;
  34.  
  35. #elif defined(_NI_unix_)
  36. #define  ibcntl  ibcnt
  37.  
  38. #endif
  39.  
  40. /**************************************************************************/
  41. /* Function types.                                                        */
  42. /**************************************************************************/
  43.  
  44. #define CVIGPIBFUNC CVIFUNC
  45.  
  46. /**************************************************************************/
  47. /*  Device Manager Function Prototypes                                    */
  48. /**************************************************************************/
  49. int CVIGPIBFUNC OpenDev (char devname[], char instrPrefix[]);
  50. int CVIGPIBFUNC CloseDev (int bd);
  51. int CVIGPIBFUNC CloseInstrDevs (char instrPrefix[]);
  52.  
  53. /**************************************************************************/
  54. /*  NI-488 Function Prototypes                                            */
  55. /**************************************************************************/
  56. int CVIGPIBFUNC ibask (int bdid, int option, int *v);
  57. int CVIGPIBFUNC ibbna (int ud, char udname[]);
  58. int CVIGPIBFUNC ibcac (int ud, int v);
  59. int CVIGPIBFUNC ibclr (int ud);
  60. int CVIGPIBFUNC ibcmd (int ud, void *buf, long cnt);
  61. int CVIGPIBFUNC ibcmda (int ud, void *buf, long cnt);
  62. int CVIGPIBFUNC ibconfig (int bdid, int option, int v);
  63. int CVIGPIBFUNC ibdev (int ud, int pad, int sad, int tmo, int eot, int eos);
  64. int CVIGPIBFUNC ibdiag (int ud, void *buf, long cnt);     /* no function panel */
  65. int CVIGPIBFUNC ibdma (int ud, int v);
  66. int CVIGPIBFUNC ibeos (int ud, int v);
  67. int CVIGPIBFUNC ibeot (int ud, int v);
  68. #if defined(_NI_mswin32_)
  69. int CVIGPIBFUNC ibevent (int ud, short *event);  /* MS Windows only */
  70. #endif
  71. int CVIGPIBFUNC ibfind (char udname[]);
  72. int CVIGPIBFUNC ibgts (int ud, int v);
  73. int CVIGPIBFUNC ibist (int ud, int v);
  74. int CVIGPIBFUNC iblines (int ud, short *result);
  75. int CVIGPIBFUNC ibln (int ud, int pad, int sad, short *listen);
  76. int CVIGPIBFUNC ibloc (int ud);
  77. int CVIGPIBFUNC iblock (int ud);             /* GPIB-ENET only */
  78. int CVIGPIBFUNC ibonl (int ud, int v);
  79. int CVIGPIBFUNC ibpad (int ud, int v);
  80. int CVIGPIBFUNC ibpct (int ud);
  81. int CVIGPIBFUNC ibppc (int ud, int v);
  82. int CVIGPIBFUNC ibrd (int ud, void *buf, long cnt);
  83. int CVIGPIBFUNC ibrda (int ud, void *buf, long cnt);
  84. int CVIGPIBFUNC ibrdf (int ud, char filename[]);
  85. int CVIGPIBFUNC ibrdkey (int ud, void *buf, int cnt);
  86. int CVIGPIBFUNC ibrpp (int ud, char *ppr);
  87. int CVIGPIBFUNC ibrsc (int ud, int v);
  88. int CVIGPIBFUNC ibrsp (int ud, char *spr);
  89. int CVIGPIBFUNC ibrsv (int ud, int v);
  90. int CVIGPIBFUNC ibsad (int ud, int v);
  91. int CVIGPIBFUNC ibsic (int ud);
  92. #ifdef _NI_unix_
  93. int CVIGPIBFUNC ibsgnl (int ud, int mask);  /* UNIX only */
  94. #endif
  95. int CVIGPIBFUNC ibsre (int ud, int v);
  96. int CVIGPIBFUNC ibstop (int ud);
  97. int CVIGPIBFUNC ibtmo (int ud, int v);
  98. int CVIGPIBFUNC ibtrg (int ud);
  99. int CVIGPIBFUNC ibunlock (int ud);          /* GPIB-ENET only */
  100. int CVIGPIBFUNC ibwait (int ud, int mask);
  101. int CVIGPIBFUNC ibwrt (int ud, void *buf, long cnt);
  102. int CVIGPIBFUNC ibwrta (int ud, void *buf, long cnt);
  103. int CVIGPIBFUNC ibwrtf (int ud, char filename[]);
  104. int CVIGPIBFUNC ibwrtkey (int ud, void *buf, int cnt);
  105.  
  106. /**************************************************************************/
  107. /*  NI-488.2 Function Prototypes                                          */
  108. /**************************************************************************/
  109.  
  110. typedef  short  Addr4882_t;
  111.  
  112. void CVIGPIBFUNC AllSpoll (int boardID, Addr4882_t taddrs[], short results[]);
  113. void CVIGPIBFUNC DevClear (int boardID, Addr4882_t address);
  114. void CVIGPIBFUNC DevClearList (int boardID, Addr4882_t addrlist[]);
  115. void CVIGPIBFUNC EnableLocal (int boardID, Addr4882_t laddrs[]);
  116. void CVIGPIBFUNC EnableRemote (int boardID, Addr4882_t laddrs[]);
  117. void CVIGPIBFUNC FindLstn (int boardID, Addr4882_t pads[], short results[], int limit);
  118. void CVIGPIBFUNC FindRQS (int boardID, Addr4882_t taddrs[], short *dev_stat);
  119. void CVIGPIBFUNC PPoll (int boardID, short *result);
  120. void CVIGPIBFUNC PPollConfig (int boardID, Addr4882_t laddr, int dataLine, int lineSense);
  121. void CVIGPIBFUNC PPollUnconfig (int boardID, Addr4882_t laddrs[]);
  122. void CVIGPIBFUNC PassControl (int boardID, Addr4882_t talker);
  123. void CVIGPIBFUNC RcvRespMsg (int boardID, void *buf, long cnt, int eotMode);
  124. void CVIGPIBFUNC ReadStatusByte (int boardID, Addr4882_t talker, short *result);
  125. void CVIGPIBFUNC Receive (int boardID, Addr4882_t talker, void *buf, long cnt, int eotMode);
  126. void CVIGPIBFUNC ReceiveSetup (int boardID, Addr4882_t talker);
  127. void CVIGPIBFUNC ResetSys (int boardID, Addr4882_t laddrs[]);
  128. void CVIGPIBFUNC Send (int boardID, Addr4882_t listener, void *buf, long datacnt, int eotMode);
  129. void CVIGPIBFUNC SendCmds (int boardID, void *buf, long cnt);
  130. void CVIGPIBFUNC SendDataBytes (int boardID, void *buf, long cnt, int eot_mode);
  131. void CVIGPIBFUNC SendIFC (int boardID);
  132. void CVIGPIBFUNC SendLLO (int boardID);
  133. void CVIGPIBFUNC SendList (int boardID, Addr4882_t laddrs[], void *buf, long datacnt, int eotMode);
  134. void CVIGPIBFUNC SendSetup (int boardID, Addr4882_t laddrs[]);
  135. void CVIGPIBFUNC SetRWLS (int boardID, Addr4882_t laddrs[]);
  136. void CVIGPIBFUNC TestSRQ (int boardID, short *result);
  137. void CVIGPIBFUNC TestSys (int boardID, Addr4882_t addrs[], short result[]);
  138. void CVIGPIBFUNC Trigger (int boardID, Addr4882_t laddrs);
  139. void CVIGPIBFUNC TriggerList (int boardID, Addr4882_t laddrs[]);
  140. void CVIGPIBFUNC WaitSRQ (int boardID, short *result);
  141.  
  142. /**************************************************************************/
  143. /* Thread-specific status variable functions.                             */
  144. /**************************************************************************/
  145. int  CVIGPIBFUNC ThreadIbsta (void);
  146. int  CVIGPIBFUNC ThreadIberr (void);
  147. int  CVIGPIBFUNC ThreadIbcnt (void);
  148. long CVIGPIBFUNC ThreadIbcntl (void);
  149.  
  150.     /* the following function is undocumented */
  151. void CVIGPIBFUNC SetGpibStatusVariablesForThread (int sta, int err, long cntl);
  152.  
  153. /**************************************************************************/
  154. /* Asynchronous callback function prototypes.                             */
  155. /**************************************************************************/
  156.  
  157. #if defined(_NI_mswin32_)
  158. typedef int (__stdcall * GpibNotifyCallback_t) (int ud, int ibsta, int iberr, long ibcntl,
  159.                                                 void *callbackData);
  160.  
  161. int CVIGPIBFUNC ibnotify (int ud, int mask, GpibNotifyCallback_t callbackFunction,
  162.                           void *callbackData);
  163. #endif
  164.  
  165. /**************************************************************************/
  166. /* Synchronous callback function prototypes.                              */
  167. /**************************************************************************/
  168.  
  169. #if defined(_NI_mswin32_)
  170. typedef void (CVICALLBACK *GPIBCallbackPtr) (int ud, int mask, void *callbackData);
  171.  
  172. int CVIGPIBFUNC ibInstallCallback (int ud, int mask, GPIBCallbackPtr callbackFunction, 
  173.                                    void *callbackData);
  174. #endif
  175.  
  176. /**************************************************************************/
  177. /*  VXI Extensions Function Prototypes                                    */
  178. /**************************************************************************/
  179.  
  180. #if defined(_NI_mswin32_)
  181. void CVIGPIBFUNC GenerateREQF(int boardID, unsigned short addr);
  182. void CVIGPIBFUNC GenerateREQT(int boardID, unsigned short addr);
  183. void CVIGPIBFUNC GotoMultAddr(int boardID,
  184.                               unsigned short type,
  185.                               unsigned short (*addrfunc)(int boardID, 
  186.                                                          unsigned short type, 
  187.                                                          unsigned short addr),
  188.                               unsigned short (*spollfunc)(int boardID, 
  189.                                                           unsigned short addr));
  190. #endif
  191.  
  192. /***************************************************************************/
  193. /*    HANDY CONSTANTS FOR USE BY APPLICATION PROGRAMS ...                  */
  194. /***************************************************************************/
  195.  
  196. /* GPIB Commands                                           */
  197.  
  198. #define UNL  0x3f  /* GPIB unlisten command                */
  199. #define UNT  0x5f  /* GPIB untalk command                  */
  200. #define GTL  0x01  /* GPIB go to local                     */
  201. #define SDC  0x04  /* GPIB selected device clear           */
  202. #define PPC  0x05  /* GPIB parallel poll configure         */
  203. #define GET  0x08  /* GPIB group execute trigger           */
  204. #define TCT  0x09  /* GPIB take control                    */
  205. #define LLO  0x11  /* GPIB local lock out                  */
  206. #define DCL  0x14  /* GPIB device clear                    */
  207. #define PPU  0x15  /* GPIB parallel poll unconfigure       */
  208. #define SPE  0x18  /* GPIB serial poll enable              */
  209. #define SPD  0x19  /* GPIB serial poll disable             */
  210. #define PPE  0x60  /* GPIB parallel poll enable            */
  211. #define PPD  0x70  /* GPIB parallel poll disable           */
  212.  
  213. /* GPIB status bit vector :                                */
  214. /*       global variable ibsta and wait mask               */
  215.  
  216. #define ERR     (1<<15) /* Error detected                  */
  217. #define TIMO    (1<<14) /* Timeout                         */
  218. #define END     (1<<13) /* EOI or EOS detected             */
  219. #define SRQI    (1<<12) /* SRQ detected by CIC             */
  220. #define RQS     (1<<11) /* Device needs service            */
  221. #define SPOLL   (1<<10) /* Board has been serially polled  */
  222. #define EVENT   (1<<9)  /* An event has occured            */
  223. #define CMPL    (1<<8)  /* I/O completed                   */
  224. #define LOK     (1<<7)  /* Local lockout state             */
  225. #define REM     (1<<6)  /* Remote state                    */
  226. #define CIC     (1<<5)  /* Controller-in-Charge            */
  227. #define ATN     (1<<4)  /* Attention asserted              */
  228. #define TACS    (1<<3)  /* Talker active                   */
  229. #define LACS    (1<<2)  /* Listener active                 */
  230. #define DTAS    (1<<1)  /* Device trigger state            */
  231. #define DCAS    (1<<0)  /* Device clear state              */
  232.  
  233. /* Error messages returned in global variable iberr        */
  234.  
  235. #define EDVR  0  /* Operating system error                 */
  236. #define ECIC  1  /* Function requires GPIB board to be CIC */
  237. #define ENOL  2  /* Write function detected no Listeners   */
  238. #define EADR  3  /* Interface board not addressed correctly*/
  239. #define EARG  4  /* Invalid argument to function call      */
  240. #define ESAC  5  /* Function requires GPIB board to be SAC */
  241. #define EABO  6  /* I/O operation aborted                  */
  242. #define ENEB  7  /* Non-existent interface board           */
  243. #define EDMA  8  /* Error performing DMA buffer            */
  244. #define EOIP 10  /* I/O operation started before previous  */
  245.                  /* operation completed                    */
  246. #define ECAP 11  /* No capability for intended operation   */
  247. #define EFSO 12  /* File system operation error            */
  248. #define EBUS 14  /* Command error during device call       */
  249. #define ESTB 15  /* Serial poll status byte lost           */
  250. #define ESRQ 16  /* SRQ remains asserted                   */
  251. #define ETAB 20  /* The return buffer is full.             */
  252. #define ELCK 21  /* Address or board is locked.            */
  253. #define ECFG 24  /* The GPIB-ENET was already on-line, and */
  254.                  /* the default board configuration sent   */
  255.                  /* to it differs from than configuration  */
  256.                  /* under which it was already operating.  */
  257.                  /* This is only a warning.  The board     */
  258.                  /* configuration has not been changed,    */
  259.                  /* but the operation has otherwise        */
  260.                  /* completed successfully.                */
  261.  
  262. #define ELNK 200 /* The GPIB library was not linked;       */
  263.                  /* dummy functions were linked instead    */
  264. #define EDLL 201 /* Error loading GPIB32.DLL;  ibcnt       */
  265.                  /* contains the MS Windows error code     */
  266. #define EFNF 203 /* Unable to find the function in         */
  267.                  /* in GPIB32.DLL;  ibcnt contains the     */
  268.                  /* MS Windows error code                  */
  269. #define EGLB 205 /* Globals or copyright string not found  */
  270.                  /* in GPIB32.DLL.                         */
  271. #define ENNI 206 /* Not a National Instruments GPIB32.DLL  */
  272. #define EMTX 207 /* Unable to acquire Mutex for loading    */
  273.                  /* DLL.  The MS Windows error is in ibcnt */
  274.  
  275. #define EMSG 210 /* Unable to register callback function   */
  276.                  /* with Windows                           */
  277. #define ECTB 211 /* Callback table is full                 */
  278.  
  279. /* ibnotify rearm failure:  value in ibcntl                */
  280. #define IBNOTIFY_REARM_FAILED     0xE00A003F
  281.  
  282. /* EOS mode bits                                           */
  283.  
  284. #define BIN  (1<<12) /* Eight bit compare                  */
  285. #define XEOS (1<<11) /* Send END with EOS byte         */
  286. #define REOS (1<<10) /* Terminate read on EOS              */
  287.  
  288. /* Timeout values and meanings                             */
  289.  
  290. #define TNONE    0   /* Infinite timeout (disabled)        */
  291. #define T10us    1   /* Timeout of 10 us (ideal)           */
  292. #define T30us    2   /* Timeout of 30 us (ideal)           */
  293. #define T100us   3   /* Timeout of 100 us (ideal)          */
  294. #define T300us   4   /* Timeout of 300 us (ideal)          */
  295. #define T1ms     5   /* Timeout of 1 ms (ideal)            */
  296. #define T3ms     6   /* Timeout of 3 ms (ideal)            */
  297. #define T10ms    7   /* Timeout of 10 ms (ideal)           */
  298. #define T30ms    8   /* Timeout of 30 ms (ideal)           */
  299. #define T100ms   9   /* Timeout of 100 ms (ideal)          */
  300. #define T300ms  10   /* Timeout of 300 ms (ideal)          */
  301. #define T1s     11   /* Timeout of 1 s (ideal)             */
  302. #define T3s     12   /* Timeout of 3 s (ideal)             */
  303. #define T10s    13   /* Timeout of 10 s (ideal)            */
  304. #define T30s    14   /* Timeout of 30 s (ideal)            */
  305. #define T100s   15   /* Timeout of 100 s (ideal)           */
  306. #define T300s   16   /* Timeout of 300 s (ideal)           */
  307. #define T1000s  17   /* Timeout of 1000 s (ideal)          */
  308.  
  309.  
  310. /*  Constants used for the ibln function                      */
  311. #define NO_SAD   0
  312. #define ALL_SAD -1
  313.  
  314. /*  Constants used for the ibevent function                   */
  315. #define  EventDTAS   1
  316. #define  EventDCAS   2
  317. #define  EventIFC    3
  318.  
  319.  
  320. /*
  321.  *    GotoMultAddr (VXI) flags
  322.  */
  323. #define  MultAddrPrimary      0x00
  324. #define  MultAddrSecondary    0x01
  325.  
  326. #define  MultAddrListen       0x00
  327. #define  MultAddrTalk         0x01
  328. #define  MultAddrSerialPoll   0x81
  329.  
  330.  
  331.  
  332. /*  The following constants are used for the second parameter of the
  333.  *  ibconfig function.  They are the "option" selection codes.
  334.  */
  335. #define  IbcPAD        0x0001      /* Primary Address                      */
  336. #define  IbcSAD        0x0002      /* Secondary Address                    */
  337. #define  IbcTMO        0x0003      /* Timeout Value                        */
  338. #define  IbcEOT        0x0004      /* Send EOI with last data byte?        */
  339. #define  IbcPPC        0x0005      /* Parallel Poll Configure              */
  340. #define  IbcREADDR     0x0006      /* Repeat Addressing                    */
  341. #define  IbcAUTOPOLL   0x0007      /* Enable/Disable Auto Serial Polling   */
  342. #define  IbcCICPROT    0x0008      /* Use the CIC Protocol?                */
  343. #define  IbcIRQ        0x0009      /* Use PIO for I/O                      */
  344. #define  IbcSC         0x000A      /* Board is System Controller?          */
  345. #define  IbcSRE        0x000B      /* Assert SRE on device calls?          */
  346. #define  IbcEOSrd      0x000C      /* Terminate reads on EOS               */
  347. #define  IbcEOSwrt     0x000D      /* Send EOI with EOS character          */
  348. #define  IbcEOScmp     0x000E      /* Use 7 or 8-bit EOS compare           */
  349. #define  IbcEOSchar    0x000F      /* The EOS character.                   */
  350. #define  IbcPP2        0x0010      /* Use Parallel Poll Mode 2.            */
  351. #define  IbcTIMING     0x0011      /* NORMAL, HIGH, or VERY_HIGH timing.   */
  352. #define  IbcDMA        0x0012      /* Use DMA for I/O                      */
  353. #define  IbcReadAdjust 0x0013      /* Swap bytes during an ibrd.           */
  354. #define  IbcWriteAdjust 0x014      /* Swap bytes during an ibwrt.          */
  355. #define  IbcEventQueue 0x0015      /* Enable/disable the event queue (MS Windows only). */
  356. #define  IbcSPollBit   0x0016      /* Enable/disable the visibility of SPOLL. */
  357. #define  IbcSendLLO    0x0017      /* Enable/disable the sending of LLO.      */
  358. #define  IbcSPollTime  0x0018      /* Set the timeout value for serial polls. */
  359. #define  IbcPPollTime  0x0019      /* Set the parallel poll length period.    */
  360. #define  IbcEndBitIsNormal 0x001A  /* Remove EOS from END bit of IBSTA.       */
  361. #define  IbcUnAddr         0x001B  /* Enable/disable device unaddressing.     */
  362. #define  IbcSignalNumber   0x001C  /* Set signal number (UNIX only)           */
  363. #define  IbcBlockIfLocked  0x001D  /* Enable/disable blocking for locked boards/devices */
  364.                                    /* (only on GPIB-ENET under Windows 95/NT)           */
  365. #define  IbcHSCableLength  0x001F  /* Length of cable specified for high speed timing.*/
  366. #define  IbcIst        0x0020      /* Set the IST bit.                     */
  367. #define  IbcRsv        0x0021      /* Set the RSV byte.                    */
  368. #define  IbcLON        0x0022      /* Enter listen only mode.              */
  369.  
  370. #define  IbcNoEndBitOnEOS  IbcEndBitIsNormal   /* for backwards compatibility */
  371.  
  372. /*
  373.  *    Constants that can be used (in addition to the ibconfig constants)
  374.  *    when calling the ibask() function.
  375.  */
  376. #define  IbaBNA            0x0200   /* A device's access board.                  */
  377. #define  IbaPAD            IbcPAD
  378. #define  IbaSAD            IbcSAD
  379. #define  IbaTMO            IbcTMO
  380. #define  IbaEOT            IbcEOT
  381. #define  IbaPPC            IbcPPC
  382. #define  IbaREADDR         IbcREADDR
  383. #define  IbaAUTOPOLL       IbcAUTOPOLL
  384. #define  IbaCICPROT        IbcCICPROT
  385. #define  IbaIRQ            IbcIRQ
  386. #define  IbaSC             IbcSC
  387. #define  IbaSRE            IbcSRE
  388. #define  IbaEOSrd          IbcEOSrd
  389. #define  IbaEOSwrt         IbcEOSwrt
  390. #define  IbaEOScmp         IbcEOScmp
  391. #define  IbaEOSchar        IbcEOSchar
  392. #define  IbaPP2            IbcPP2
  393. #define  IbaTIMING         IbcTIMING
  394. #define  IbaDMA            IbcDMA
  395. #define  IbaReadAdjust     IbcReadAdjust
  396. #define  IbaWriteAdjust    IbcWriteAdjust
  397. #define  IbaEventQueue     IbcEventQueue
  398. #define  IbaSPollBit       IbcSPollBit
  399. #define  IbaSendLLO        IbcSendLLO
  400. #define  IbaSPollTime      IbcSPollTime
  401. #define  IbaPPollTime      IbcPPollTime
  402. #define  IbaEndBitIsNormal IbcEndBitIsNormal
  403. #define  IbaUnAddr         IbcUnAddr
  404. #define  IbaSignalNumber   IbcSignalNumber
  405. #define  IbaHSCableLength  IbcHSCableLength
  406. #define  IbaBlockIfLocked  IbcBlockIfLocked
  407. #define  IbaIst            IbcIst
  408. #define  IbaRsv            IbcRsv
  409. #define  IbaLON            IbcLON
  410.  
  411. #define  IbaNoEndBitOnEOS  IbcNoEndBitOnEOS   /* for backwards compatibility */
  412.  
  413.  
  414.  
  415. /*  488.2 CONSTANTS  */
  416.  
  417. /*
  418.  *  These are the values are used for the eotMode in the 488.2 Send command.
  419.  */
  420. #define  NULLend    0x00  /* Do nothing at the end of a transfer.*/
  421. #define  NLend      0x01  /* Send NL with EOI after a transfer.  */
  422. #define  DABend     0x02  /* Send EOI with the last DAB.         */
  423.  
  424. /*
  425.  *  This value is for the eotMode in the 488.2 Receive command.
  426.  */
  427. #define  STOPend    0x0100
  428.  
  429. /*
  430.  *  This macro can be used to easily create an entry in address list
  431.  *  that is required by many of the 488.2 functions.  An address list is
  432.  *  just an array of shorts.  The primary address goes in the
  433.  *  lower 8-bits and the secondary address goes in the upper 8-bits.
  434.  */
  435. #define  MakeAddr(pad, sad)   ((Addr4882_t) ((pad) | ((sad)<<8)))
  436.  
  437.  
  438. /*
  439.  *  The following two macros are used to "break apart" an address list
  440.  *  entry.  They take an integer and return either the primary
  441.  *  or secondary address stored in the integer.
  442.  */
  443. #define  GetPAD(val)    ((val) & 0xFF)
  444. #define  GetSAD(val)    (((val) >> 8) & 0xFF)
  445.  
  446. /*
  447.  *  This value is used to terminate an address list.  It should be
  448.  *  assigned to the last entry.
  449.  */
  450. #define  NOADDR    ((Addr4882_t) ((unsigned short) 0xFFFF))
  451.  
  452.  
  453. /*
  454.  *  The following values are used by the iblines function.
  455.  *
  456.  *  The "result" argument is set by iblines as follows:
  457.  *
  458.  *    -  The lower byte contains a "monitor" bit mask.  If a bit is
  459.  *       set (1) in this mask, then the corresponding line can be
  460.  *       monitiored by the driver.  If the bit is clear (0),
  461.  *       then the line cannot be monitored.
  462.  *
  463.  *    -  The upper byte contains the status of the bus lines.
  464.  *       Each bit corresponds to a certain bus line, and has
  465.  *       a correcponding "monitor" bit in the lower byte.
  466.  *
  467.  */
  468. #define  ValidEOI   ((short)0x0080)
  469. #define  ValidATN   ((short)0x0040)
  470. #define  ValidSRQ   ((short)0x0020)
  471. #define  ValidREN   ((short)0x0010)
  472. #define  ValidIFC   ((short)0x0008)
  473. #define  ValidNRFD  ((short)0x0004)
  474. #define  ValidNDAC  ((short)0x0002)
  475. #define  ValidDAV   ((short)0x0001)
  476. #define  BusEOI     ((short)0x8000)
  477. #define  BusATN     ((short)0x4000)
  478. #define  BusSRQ     ((short)0x2000)
  479. #define  BusREN     ((short)0x1000)
  480. #define  BusIFC     ((short)0x0800)
  481. #define  BusNRFD    ((short)0x0400)
  482. #define  BusNDAC    ((short)0x0200)
  483. #define  BusDAV     ((short)0x0100)
  484.  
  485.  
  486. #ifdef __cplusplus
  487. }
  488. #endif
  489.  
  490. #endif /* _GPIB_HEADER_ */
  491.