home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_12 / taylor2 / decl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-22  |  16.0 KB  |  314 lines

  1. /*
  2.  *    If you are using the Microsoft C compiler version 5.1 or later,
  3.  *    the following two constants should be defined.
  4.  */
  5.  
  6. // #define  MSC_FAR     _far
  7. // #define  MSC_CDECL   _cdecl
  8.  
  9. /*
  10.  ***    Changed for Borland C++ compiler, SGJ 12/23/1994
  11.  */
  12. #define  MSC_FAR     far
  13. #define  MSC_CDECL   cdecl
  14.  
  15. /*
  16.  *    
  17.  *    If you are using the Microsoft C compiler version 5.0 or earlier
  18.  *    the following two constants should be defined.
  19.  *
  20.  *  #define  MSC_FAR     far
  21.  *  #define  MSC_CDECL   cdecl
  22.  */
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. /* C Declarations                                          */
  29. /*                                                         */
  30. /*                                                         */
  31. /* Status variables declared public by mcib.obj.           */
  32.  
  33. extern  int             ibsta;  /* status word                    */
  34. extern  int             iberr;  /* GPIB error code                */
  35. extern  unsigned int    ibcnt;  /* number of bytes sent           */
  36. extern  unsigned long   ibcntl; /* (same) number of bytes sent    */
  37.  
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41.  
  42. /* Optionally include the following declarations in your   */
  43. /* program.                                                */
  44.  
  45. /* GPIB Commands                                           */
  46.  
  47. #define UNL  0x3f  /* GPIB unlisten command                */
  48. #define UNT  0x5f  /* GPIB untalk command                  */
  49. #define GTL  0x01  /* GPIB go to local                     */
  50. #define SDC  0x04  /* GPIB selected device clear           */
  51. #define PPC  0x05  /* GPIB parallel poll configure         */
  52. #define GET  0x08  /* GPIB group execute trigger           */
  53. #define TCT  0x09  /* GPIB take control                    */
  54. #define LLO  0x11  /* GPIB local lock out                  */
  55. #define DCL  0x14  /* GPIB device clear                    */
  56. #define PPU  0x15  /* GPIB parallel poll unconfigure       */
  57. #define SPE  0x18  /* GPIB serial poll enable              */
  58. #define SPD  0x19  /* GPIB serial poll disable             */
  59. #define PPE  0x60  /* GPIB parallel poll enable            */
  60. #define PPD  0x70  /* GPIB parallel poll disable           */
  61.  
  62. /* GPIB status bit vector :                                */
  63. /*       global variable ibsta and wait mask               */
  64.  
  65. #define ERR     (1<<15) /* Error detected                  */
  66. #define TIMO    (1<<14) /* Timeout                         */
  67. #define END     (1<<13) /* EOI or EOS detected             */
  68. #define SRQI    (1<<12) /* SRQ detected by CIC             */
  69. #define RQS     (1<<11) /* Device needs service            */
  70. #define CMPL    (1<<8)  /* I/O completed                   */
  71. #define LOK     (1<<7)  /* Local lockout state             */
  72. #define REM     (1<<6)  /* Remote state                    */
  73. #define CIC     (1<<5)  /* Controller-in-Charge            */
  74. #define ATN     (1<<4)  /* Attention asserted              */
  75. #define TACS    (1<<3)  /* Talker active                   */
  76. #define LACS    (1<<2)  /* Listener active                 */
  77. #define DTAS    (1<<1)  /* Device trigger state            */
  78. #define DCAS    (1<<0)  /* Device clear state              */
  79.  
  80. /* Error messages returned in global variable iberr        */
  81.  
  82. #define EDVR  0  /* DOS error                              */
  83. #define ECIC  1  /* Function requires GPIB board to be CIC */
  84. #define ENOL  2  /* Write function detected no Listeners   */
  85. #define EADR  3  /* Interface board not addressed correctly*/
  86. #define EARG  4  /* Invalid argument to function call      */
  87. #define ESAC  5  /* Function requires GPIB board to be SAC */
  88. #define EABO  6  /* I/O operation aborted                  */
  89. #define ENEB  7  /* Non-existent interface board           */
  90. #define EOIP 10  /* I/O operation started before previous  */
  91.          /* operation completed                    */
  92. #define ECAP 11  /* No capability for intended operation   */
  93. #define EFSO 12  /* File system operation error            */
  94. #define EBUS 14  /* Command error during device call       */
  95. #define ESTB 15  /* Serial poll status byte lost           */
  96. #define ESRQ 16  /* SRQ remains asserted                   */
  97. #define ETAB 20  /* The return buffer is full.             */
  98.  
  99. /* EOS mode bits                                           */
  100.  
  101. #define BIN  (1<<12) /* Eight bit compare                  */
  102. #define XEOS (1<<11) /* Send END with EOS byte           */
  103. #define REOS (1<<10) /* Terminate read on EOS              */
  104.  
  105. /* Timeout values and meanings                             */
  106.  
  107. #define TNONE    0   /* Infinite timeout (disabled)        */
  108. #define T10us    1   /* Timeout of 10 us (ideal)           */
  109. #define T30us    2   /* Timeout of 30 us (ideal)           */
  110. #define T100us   3   /* Timeout of 100 us (ideal)          */
  111. #define T300us   4   /* Timeout of 300 us (ideal)          */
  112. #define T1ms     5   /* Timeout of 1 ms (ideal)            */
  113. #define T3ms     6   /* Timeout of 3 ms (ideal)            */
  114. #define T10ms    7   /* Timeout of 10 ms (ideal)           */
  115. #define T30ms    8   /* Timeout of 30 ms (ideal)           */
  116. #define T100ms   9   /* Timeout of 100 ms (ideal)          */
  117. #define T300ms  10   /* Timeout of 300 ms (ideal)          */
  118. #define T1s     11   /* Timeout of 1 s (ideal)             */
  119. #define T3s     12   /* Timeout of 3 s (ideal)             */
  120. #define T10s    13   /* Timeout of 10 s (ideal)            */
  121. #define T30s    14   /* Timeout of 30 s (ideal)            */
  122. #define T100s   15   /* Timeout of 100 s (ideal)           */
  123. #define T300s   16   /* Timeout of 300 s (ideal)           */
  124. #define T1000s  17   /* Timeout of 1000 s (maximum)        */
  125.  
  126.  
  127. /*  IBLN Constants                                         */
  128. #define NO_SAD   0
  129. #define ALL_SAD -1
  130.  
  131.  
  132. /* Miscellaneous                                           */
  133.  
  134. #define S    0x08    /* parallel poll sense bit            */
  135. #define LF   0x0A    /* ASCII linefeed character           */
  136.  
  137.  
  138. /*  The following constants are used for the second parameter of the 
  139.  *  ibconfig function.  They are the "option" selection codes.
  140.  */
  141. #define  IbcPAD        0x0001      /* Primary Address                      */
  142. #define  IbcSAD        0x0002      /* Secondary Address                    */
  143. #define  IbcTMO        0x0003      /* Timeout Value                        */
  144. #define  IbcEOT        0x0004      /* Send EOI with last data byte?        */
  145. #define  IbcPPC        0x0005      /* Parallel Poll Configure              */
  146. #define  IbcREADDR     0x0006      /* Repeat Addressing                    */
  147. #define  IbcAUTOPOLL   0x0007      /* Disable Auto Serial Polling          */
  148. #define  IbcCICPROT    0x0008      /* Use the CIC Protocol?                */
  149. #define  IbcIRQ        0x0009      /* Use PIO for I/O                      */
  150. #define  IbcSC         0x000A      /* Board is System Controller?          */
  151. #define  IbcSRE        0x000B      /* Assert SRE on device calls?          */
  152. #define  IbcEOSrd      0x000C      /* Terminate reads on EOS               */
  153. #define  IbcEOSwrt     0x000D      /* Send EOI with EOS character          */
  154. #define  IbcEOScmp     0x000E      /* Use 7 or 8-bit EOS compare           */
  155. #define  IbcEOSchar    0x000F      /* The EOS character.                   */
  156. #define  IbcPP2        0x0010      /* Use Parallel Poll Mode 2.            */
  157. #define  IbcTIMING     0x0011      /* NORMAL, HIGH, or VERY_HIGH timming.  */
  158. #define  IbcDMA        0x0012      /* Use DMA for I/O                      */
  159. #define  IbcReadAdjust 0x0013      /* Swap bytes during an ibrd.           */
  160. #define  IbcWriteAdjust 0x014      /* Swap bytes during an ibwrt.          */
  161.  
  162.  
  163. /* These are the values are used by the Send 488.2 command. */
  164. #define  NULLend (unsigned int)0x00  /* Do nothing at the end of a transfer.*/
  165. #define  NLend   (unsigned int)0x01  /* Send NL with EOI after a transfer.  */
  166. #define  DABend  (unsigned int)0x02  /* Send EOI with the last DAB.         */
  167.  
  168.  
  169. /* This value is used by the 488.2 Receive command.
  170.  */
  171. #define  STOPend     (unsigned int)0x0100
  172.  
  173.  
  174. /*
  175.  *  This macro can be used to easily create an entry in address list
  176.  *  that is required by many of the 488.2 functions.  An address list is
  177.  *  just an array of unsigned integers.  The primary address goes in the
  178.  *  lower 8-bits and the secondary address goes in the upper 8-bits.
  179.  */
  180. #define  MakeAddr(pad, sad)   ((unsigned int)(((unsigned char)(pad)) | (((unsigned char)(sad))<<8)))
  181.  
  182.  
  183. /*
  184.  *  The following two macros are used to "break apart" an address list
  185.  *  entry.  They take an unsigned integer and return either the primary
  186.  *  or secondary address stored in the integer.
  187.  */
  188. #define  GetPAD(val)    ((unsigned char)(val))
  189. #define  GetSAD(val)    ((unsigned char)((val) >> 8))
  190.  
  191.  
  192. /*
  193.  *  The following values are used by the iblines function.  The unsigned
  194.  *  integer returned by iblines contains:
  195.  *       The lower byte will contain a "monitor" bit mask.  If a bit is
  196.  *          set (1) in this mask, then the corresponding line can be
  197.  *          monitiored by the driver.  If the bit is clear (0),
  198.  *          then the line cannot be monitored.
  199.  *       The upper byte will contain the status of the bus lines.
  200.  *          Each bit corresponds to a certain bus line, and has
  201.  *          a correcponding "monitor" bit in the lower byte.
  202.  *
  203.  */
  204. #define  ValidEOI   (unsigned short)0x0080
  205. #define  ValidATN   (unsigned short)0x0040
  206. #define  ValidSRQ   (unsigned short)0x0020
  207. #define  ValidREN   (unsigned short)0x0010
  208. #define  ValidIFC   (unsigned short)0x0008
  209. #define  ValidNRFD  (unsigned short)0x0004
  210. #define  ValidNDAC  (unsigned short)0x0002
  211. #define  ValidDAV   (unsigned short)0x0001
  212. #define  BusEOI     (unsigned short)0x8000
  213. #define  BusATN     (unsigned short)0x4000
  214. #define  BusSRQ     (unsigned short)0x2000
  215. #define  BusREN     (unsigned short)0x1000
  216. #define  BusIFC     (unsigned short)0x0800
  217. #define  BusNRFD    (unsigned short)0x0400
  218. #define  BusNDAC    (unsigned short)0x0200
  219. #define  BusDAV     (unsigned short)0x0100
  220.  
  221.  
  222. /*
  223.  *  This value is used to terminate an address list.  It should be
  224.  *  assigned to the last entry.
  225.  */
  226. #define  NOADDR    0xFFFF
  227.  
  228.  
  229. #ifdef __cplusplus
  230. extern "C" {
  231. #endif
  232.  
  233.  
  234. extern int MSC_FAR MSC_CDECL ibbna(int handle, char MSC_FAR *bdname);
  235. extern int MSC_FAR MSC_CDECL ibcac(int handle, int v);
  236. extern int MSC_FAR MSC_CDECL ibclr(int handle);
  237. extern int MSC_FAR MSC_CDECL ibcmd(int handle, char MSC_FAR *buffer, unsigned long cnt);
  238. extern int MSC_FAR MSC_CDECL ibcmda(int handle, char MSC_FAR *buffer, unsigned long cnt);
  239. extern int MSC_FAR MSC_CDECL ibconfig(int handle, unsigned int option, unsigned int value);
  240. extern int MSC_FAR MSC_CDECL ibdev(int boardID, int padval, int sadval, int tmoval, int eotval, int eosval);
  241. extern int MSC_FAR MSC_CDECL ibdma(int handle, int v);
  242. extern int MSC_FAR MSC_CDECL ibeos(int handle, int v);
  243. extern int MSC_FAR MSC_CDECL ibeot(int handle, int v);
  244. extern int MSC_FAR MSC_CDECL ibfind(char MSC_FAR *bdname);
  245. extern int MSC_FAR MSC_CDECL ibgts(int handle, int v);
  246. extern int MSC_FAR MSC_CDECL ibist(int handle, int v);
  247. extern int MSC_FAR MSC_CDECL iblines(int handle, unsigned int MSC_FAR *lines);
  248. extern int MSC_FAR MSC_CDECL ibln(int handle, int padval, int sadval, int MSC_FAR *listenflag);
  249. extern int MSC_FAR MSC_CDECL ibloc(int handle);
  250. extern int MSC_FAR MSC_CDECL ibonl(int handle, int v);
  251. extern int MSC_FAR MSC_CDECL ibpad(int handle, int v);
  252. extern int MSC_FAR MSC_CDECL ibpct(int handle);
  253. extern int MSC_FAR MSC_CDECL ibppc(int handle, int v);
  254. extern int MSC_FAR MSC_CDECL ibrd(int handle, char MSC_FAR *buffer, unsigned long cnt);
  255. extern int MSC_FAR MSC_CDECL ibrda(int handle, char MSC_FAR *buffer, unsigned long cnt);
  256. extern int MSC_FAR MSC_CDECL ibrdf(int handle, char MSC_FAR *flname);
  257. extern int MSC_FAR MSC_CDECL ibrpp(int handle, char MSC_FAR *ppr);
  258. extern int MSC_FAR MSC_CDECL ibrsc(int handle, int v);
  259. extern int MSC_FAR MSC_CDECL ibrsp(int handle, char MSC_FAR *spr);
  260. extern int MSC_FAR MSC_CDECL ibrsv(int handle, int v);
  261. extern int MSC_FAR MSC_CDECL ibsad(int handle, int v);
  262. extern int MSC_FAR MSC_CDECL ibsic(int handle);
  263. extern int MSC_FAR MSC_CDECL ibsre(int handle, int v);
  264. extern int MSC_FAR MSC_CDECL ibsrq(void (MSC_FAR *func)(void));
  265. extern int MSC_FAR MSC_CDECL ibstop(int handle);
  266. extern int MSC_FAR MSC_CDECL ibtmo(int handle, int v);
  267. extern int MSC_FAR MSC_CDECL ibtrap(int mask, int mode);
  268. extern int MSC_FAR MSC_CDECL ibtrg(int handle);
  269. extern int MSC_FAR MSC_CDECL ibwait(int handle, unsigned int mask);
  270. extern int MSC_FAR MSC_CDECL ibwrt(int handle, char MSC_FAR *buffer, unsigned long cnt);
  271. extern int MSC_FAR MSC_CDECL ibwrta(int handle, char MSC_FAR *buffer, unsigned long cnt);
  272. extern int MSC_FAR MSC_CDECL ibwrtf(int handle, char MSC_FAR *flname);
  273.  
  274. extern int MSC_FAR MSC_CDECL ibpoke(int handle, unsigned int option, unsigned int value);
  275. extern int MSC_FAR MSC_CDECL ibdiag(int handle, char MSC_FAR *buffer, unsigned long cnt);
  276. extern int MSC_FAR MSC_CDECL ibxtrc(int handle, char MSC_FAR *buffer, unsigned long cnt);
  277.  
  278. extern int MSC_FAR MSC_CDECL ibwrtkey(int handle, char MSC_FAR *buffer, unsigned int cnt);
  279. extern int MSC_FAR MSC_CDECL ibrdkey(int handle, char MSC_FAR *buffer, unsigned int cnt);
  280.  
  281. extern void MSC_FAR MSC_CDECL SendCmds(int boardID, unsigned char MSC_FAR *buf, unsigned long cnt);
  282. extern void MSC_FAR MSC_CDECL SendSetup(int boardID, unsigned int MSC_FAR listen[]);
  283. extern void MSC_FAR MSC_CDECL SendDataBytes(int boardID, unsigned char MSC_FAR *buffer, unsigned long cnt, unsigned int eot_mode);
  284. extern void MSC_FAR MSC_CDECL Send(int boardID, unsigned int listener, unsigned char MSC_FAR *databuf, unsigned long datacnt, unsigned int eotMode);
  285. extern void MSC_FAR MSC_CDECL SendList(int boardID, unsigned int MSC_FAR listeners[], unsigned char MSC_FAR *databuf, unsigned long datacnt, unsigned int eotMode);
  286. extern void MSC_FAR MSC_CDECL ReceiveSetup(int boardID, unsigned int talker);
  287. extern void MSC_FAR MSC_CDECL RcvRespMsg(int boardID, unsigned char MSC_FAR *buffer, unsigned long cnt, unsigned int eotMode);
  288. extern void MSC_FAR MSC_CDECL Receive(int boardID, unsigned int talker, unsigned char MSC_FAR *buffer, unsigned long cnt, unsigned int eotMode);
  289. extern void MSC_FAR MSC_CDECL SendIFC(int boardID);
  290. extern void MSC_FAR MSC_CDECL DevClear(int boardID, unsigned int address);
  291. extern void MSC_FAR MSC_CDECL DevClearList(int boardID, unsigned int MSC_FAR addrlist[]);
  292. extern void MSC_FAR MSC_CDECL EnableLocal(int boardID, unsigned int MSC_FAR laddrs[]);
  293. extern void MSC_FAR MSC_CDECL EnableRemote(int boardID, unsigned int MSC_FAR laddrs[]);
  294. extern void MSC_FAR MSC_CDECL SetRWLS(int boardID, unsigned int MSC_FAR laddrs[]);
  295. extern void MSC_FAR MSC_CDECL SendLLO(int boardID);
  296. extern void MSC_FAR MSC_CDECL PassControl(int boardID, unsigned int talker);
  297. extern void MSC_FAR MSC_CDECL ReadStatusByte(int boardID, unsigned int talker, unsigned int MSC_FAR *result);
  298. extern void MSC_FAR MSC_CDECL Trigger(int boardID, unsigned int laddrs);
  299. extern void MSC_FAR MSC_CDECL TriggerList(int boardID, unsigned int MSC_FAR laddrs[]);
  300. extern void MSC_FAR MSC_CDECL PPollConfig(int boardID, unsigned int laddr, unsigned int dataLine, unsigned int lineSense);
  301. extern void MSC_FAR MSC_CDECL PPollUnconfig(int boardID, unsigned int MSC_FAR laddrs[]);
  302. extern void MSC_FAR MSC_CDECL PPoll(int boardID, unsigned int MSC_FAR *res_ptr);
  303. extern void MSC_FAR MSC_CDECL TestSRQ(int boardID, int MSC_FAR *result);
  304. extern void MSC_FAR MSC_CDECL WaitSRQ(int boardID, int MSC_FAR *result);
  305. extern void MSC_FAR MSC_CDECL ResetSys(int boardID, unsigned int MSC_FAR laddrs[]);
  306. extern void MSC_FAR MSC_CDECL FindRQS(int boardID, unsigned int MSC_FAR taddrs[], unsigned int MSC_FAR *dev_stat);
  307. extern void MSC_FAR MSC_CDECL AllSpoll(int boardID, unsigned int MSC_FAR taddrs[], unsigned int MSC_FAR res[]);
  308. extern void MSC_FAR MSC_CDECL FindLstn(int boardID, unsigned int MSC_FAR pads[], unsigned int MSC_FAR results[], unsigned int limit);
  309. extern void MSC_FAR MSC_CDECL TestSys(int boardID, unsigned int MSC_FAR addrs[], unsigned int MSC_FAR result[]);
  310.  
  311. #ifdef __cplusplus
  312. }
  313. #endif
  314.