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

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*            National Instruments NI-VXI Software Interface                */
  4. /*                   (C) 1996,  National Instruments                        */
  5. /*                                                                          */
  6. /*                       Word Serial Include File                           */
  7. /*                                                                          */
  8. /****************************************************************************/
  9. /*                        DO NOT MODIFY THIS FILE                           */
  10. /****************************************************************************/
  11. /*  The following file contains all of the necessary include file
  12.  * information for use of the National Instruments NI-VXI Commander Word
  13.  * Serial and Servant Word Serial functions.
  14.  */
  15.  
  16. #if !defined(ws_h)
  17. #define ws_h
  18.  
  19.     /******************************/
  20.     /* WORD SERIAL COMMAND VALUES */
  21.     /******************************/
  22.  
  23. #define WS_BYTEAV_0          0xbc00    /* Byte Available without END           */
  24. #define WS_BYTEAV_1          0xbd00    /* Byte Available with END              */
  25. #define WS_BYTEAV_END        (1U<<8)   /* Byte Available END position          */
  26. #define WS_BYTEAV_MASK       0xfe00    /* Upper 8 bits minus END bit           */
  27. #define WS_BYTERQ            0xdeff    /* Byte Request command                 */
  28. #define WS_BYTERQ_END        (1U<<8)   /* Byte Request END position            */
  29.  
  30. #define WS_CLEAR             0xffff    /* Device Clear                         */
  31. #define WS_TRIGGER           0xedff    /* Trigger                              */
  32. #define WS_READ_SERV         0xceff    /* Read Servant Area                    */
  33. #define WS_DEVGRANT          0xbf00    /* Device Grant (upper 8 bits)          */
  34. #define WS_REL_DEVICE        0x8e00    /* Release device (upper 8 bits)        */
  35. #define WS_ID_COMMANDER      0xbe00    /* Identify commander (upper 8 bits)    */
  36. #define WS_READ_STB          0xcfff    /* Read Status Byte                     */
  37.  
  38. #define WS_ASSIGN_HNDLR      0xa900    /* Assign Handler (VXI Interrupts)      */
  39. #define WS_READ_HNDLRS       0xc7ff    /* Read Handlers (Number Int Handlers)  */
  40. #define WS_READ_LINE         0x8c00    /* Read Handler Line                    */
  41.  
  42. #define WS_ASSIGN_INT        0xaa00    /* Assign Interrupter (VXI Interrupts)  */
  43. #define WS_READ_INTS         0xcaff    /* Read Interrupters (Num Interrupters) */
  44. #define WS_READ_INTLINE      0x8d00    /* Read Interrupter Line                */
  45.  
  46. #define WS_READ_MODID        0xccff    /* Read MODID                           */
  47. #define WS_LOWER_MODID       0xae00    /* Set Lower MODID                      */
  48. #define WS_UPPER_MODID       0xad00    /* Set Upper MODID                      */
  49. #define WS_MODID_ENA         0x0080    /* Modid Enable bit for set upper/lower */
  50. #define M_ENABLE             (1U<<13)  /* Modid Enable bit for RBD and extender*/
  51.  
  52. #define WS_BEGIN_NORM_A      0xfdff    /* Begin Normal Operation-- AUTO        */
  53. #define WS_BEGIN_NORM        0xfcff    /* Begin Normal Operation-- no AUTO     */
  54. #define WS_ENO               0xc9ff    /* End Normal Operation                 */
  55. #define WS_ANO               0xc8ff    /* Abort Normal Operation               */
  56.  
  57. #define WS_ASYNC_MODE        0xa800    /* Asynchronous Mode Control            */
  58. #define ASYNC_RESP_ENA       0x0008    /* 0 = Response generation enabled      */
  59. #define ASYNC_EVENT_ENA      0x0004    /* 0 = Event generation enabled         */
  60. #define ASYNC_RESP_INT       0x0002    /* 0 = Response via ints, 1 = signals   */
  61. #define ASYNC_EVENT_INT      0x0001    /* 0 = Event via ints, 1 = signals      */
  62.  
  63. #define WS_CTRL_EVENT        0xaf00    /* Control Event (ena/dis event gen)    */
  64. #define WS_RESP_ENA          0x8f00    /* Response enable (Control Response)   */
  65. #define WS_CONT_RESP         0x8f00    /* Response enable (Control Response)   */
  66. #define RESP_DOR             0x0020    /* Enable Data Out Ready interrupt      */
  67. #define RESP_DIR             0x0010    /* Enable Data In Ready interrupt       */
  68. #define RESP_ERR             0x0008    /* Enable ERR bit interrupt             */
  69. #define RESP_RR              0x0004    /* Enable Read Ready interrupt          */
  70. #define RESP_WR              0x0002    /* Enable Write Ready interrupt         */
  71. #define RESP_FHS             0x0001    /* Enable Fast Handshake Active inter   */
  72.  
  73. #define WS_RD_PROT_ERR       0xcdff    /* Read Protocol Error (Error query)    */
  74. #define PROT_E_NO_ERROR      0xffff    /* No error Protocol Error              */
  75. #define PROT_E_GENERIC       0xfffe    /* Generic error (not in Spec 1.3)      */
  76. #define PROT_E_MQE           0xfffd    /* Multiple Query Error                 */
  77. #define PROT_E_UNSUP_COM     0xfffc    /* Unsupported command                  */
  78. #define PROT_E_DIR_VIOL      0xfffb    /* DIR violation (BAV sent when not DIR)*/
  79. #define PROT_E_DOR_VIOL      0xfffa    /* DOR violation (BRQ sent when not DOR)*/
  80. #define PROT_E_RR_VIOL       0xfff9    /* RR violation (resp read when not RR) */
  81. #define PROT_E_WR_VIOL       0xfff8    /* WR violation (Cmd wrote when not WR) */
  82.  
  83. #define WS_READ_PROT         0xdfff    /* Read Protocols                       */
  84. #define PROT_DEVDEP          0x87ff    /* Mask for Device dependent            */
  85. #define PROT_RESERVED        0xf8ff    /* Mask for reserved                    */
  86. #define PROT_SPEC_1_2        (1U<<15)  /* 0 = VXI Spec 1.2 device              */
  87. #define PROT_RG              (1U<<9)   /* 0 = Response generation              */
  88. #define PROT_EG              (1U<<8)   /* 0 = Event generation                 */
  89. #define PROT_E               (1U<<7)   /* 0 = ERR bit supported                */
  90. #define PROT_PI              (1U<<6)   /* 0 = WS Interrupt commands            */
  91. #define PROT_PH              (1U<<5)   /* 0 = WS Int Handler commands          */
  92. #define PROT_TRG             (1U<<4)   /* 0 = WS Trigger command               */
  93. #define PROT_I4              (1U<<3)   /* 0 = 488.2 supported                  */
  94. #define PROT_I               (1U<<2)   /* 0 = VXI Instrument prot              */
  95. #define PROT_ELW             (1U<<1)   /* 0 = WS Extended Long word            */
  96. #define PROT_LW              (1U<<0)   /* 0 = WS Long word protocol            */
  97.  
  98.     /**************************************/
  99.     /* Word Serial command fields         */
  100.     /**************************************/
  101.  
  102. /* value definitions for 'respflag' field */
  103. #define WS_RESPONSE          1         /* Command requires a reponse           */
  104. #define WS_NORESPONSE        0         /* Command has no response              */
  105.  
  106.     /*************************************/
  107.     /* Word Serial command RETURN VALUES */
  108.     /*************************************/
  109.  
  110. /* Bit definitions for 'ret' return code for commander driver */
  111.  
  112. /* successful return codes (ERRORFLAG cleared, IODONE set) */
  113. #define WS_RET_IODONE        (1U<<0)   /* I/O successfully completed           */
  114.  
  115. /* unsuccessful return codes (ERRORFLAG set) */
  116. #define WS_RET_TIMO_SEND     (1U<<1)   /* I/O timed out on SEND of command     */
  117. #define WS_RET_TIMO_REC      (1U<<2)   /* I/O timed out on RESPONSE for command*/
  118. #define WS_RET_ForcedAbort   (1U<<4)   /* WSabort called with ForcedAbort      */
  119. #define WS_RET_InvalidLA     (1U<<5)   /* Invalid Logical Address to talk to   */
  120. #define WS_RET_MQE           (1U<<6)   /* Mulitple Query Error                 */
  121. #define WS_RET_BERR          (1U<<7)   /* Bus error                            */
  122. #define WS_RET_UnSupCom      (1U<<9)   /* Unsupported Cmd event/protocol error */
  123. #define WS_RET_RDERR_NSUP    (1U<<10)  /* Read Protocol Error (not supported)  */
  124. #define WS_RET_DIR_VIOL      (1U<<11)  /* DIR viol (BAV sent when not DIR)     */
  125. #define WS_RET_DOR_VIOL      (1U<<12)  /* DOR viol (BRQ sent when not DOR)     */
  126. #define WS_RET_RR_VIOL       (1U<<13)  /* Response was read when not RR        */
  127. #define WS_RET_WR_VIOL       (1U<<14)  /* Command was written while not WR     */
  128. #define WS_ERRORFLAG         (1U<<15)  /* Error Summary flag                   */
  129.  
  130.     /***************************/
  131.     /* Word Serial ABORT codes */
  132.     /***************************/
  133.  
  134. /* WSabort function 'abortop' parameter codes */
  135. #define WS_ABORT_ForcedAbort     1     /* Forced Abort: WSwrt,WSrd,WStrg       */
  136. #define WS_ABORT_UnRecCom        2     /* Unrecognized: WScmd/WSLcmd/WSEcmd    */
  137. #define WS_ABORT_ForcedAbortCom  3     /* Forced Abort: WScmd/WSLcmd/WSEcmd    */
  138. #define WS_ABORT_ForcedAbortAll  4     /* Forced Abort: All WS operations      */
  139. #define WS_ABORT_AsyncAbortAll   5     /* Forced Abort: All WS ops immediately */
  140.  
  141. /* WSabort function return codes */
  142. #define WS_ABORT_OK          NIVXI_OK
  143. #define WS_ABORT_INVLA       (-1)
  144. #define WS_ABORT_INVOP       (-2)
  145.  
  146.     /************************************************/
  147.     /* Word Serial Buffer MODE for Sending/Receving */
  148.     /************************************************/
  149.  
  150. /* Bit definitions for 'mode' field */
  151. #define WSb_MODE_NO_DirDorAbort (1U<<0)/* Poll while !DIR(writes), !DOR(reads)*/
  152. #define WSb_MODE_SendEnd     (1U<<1)   /* Send end with last byte of transfer */
  153. #define WSb_MODE_NoEndEnd    (1U<<1)   /* 0 = end transfer on END bit         */
  154. #define WSb_MODE_EndLF       (1U<<2)   /* End transfer on LF (linefeed)       */
  155. #define WSb_MODE_EndCR       (1U<<3)   /* End transfer on CR (carraige return)*/
  156. #define WSb_MODE_EndEOS      (1U<<4)   /* End transfer on EOS character       */
  157.  
  158.     /*********************************************************/
  159.     /* Word Serial Buffer RETURN VALUES for Sending/Receving */
  160.     /*********************************************************/
  161.  
  162. /* Bit definitions for 'ret' return code for commander driver */
  163.  
  164. /* successful (ERRORFLAG cleared, IODONE set) */
  165. #define WSb_RET_IODONE       (1U<<0)   /* I/O successfully completed           */
  166. #define WSb_RET_END          (1U<<1)   /* END was received on Read             */
  167. #define WSb_RET_TC           (1U<<2)   /* Terminal Count--buffer was filled    */
  168. #define WSb_RET_DirDorAbort  (1U<<3)   /* Device was !DIR(writes), !DOR(reads) */
  169.  
  170. /* unsuccessful (ERRORFLAG set) */
  171. #define WSb_RET_FopenError   (1U<<0)   /* Error opening file                   */
  172. #define WSb_RET_FwriteError  (1U<<1)   /* Error writing to file                */
  173. #define WSb_RET_ForcedAbort  (1U<<4)   /* WSabort called with ForcedAbort      */
  174. #define WSb_RET_InvalidLA    (1U<<5)   /* Invalid Logical Address to talk to   */
  175. #define WSb_RET_MQE          (1U<<6)   /* Mulitple Query Error                 */
  176. #define WSb_RET_BERR         (1U<<7)   /* Bus error occurred during transfer   */
  177. #define WSb_RET_TIMO         (1U<<8)   /* A timeout occurred during transfer   */
  178. #define WSb_RET_UnSupCom     (1U<<9)   /* Unsupported Cmd event/protocol error */
  179. #define WSb_RET_RDERR_NSUP   (1U<<10)  /* Read Protocol Error (not supported)  */
  180. #define WSb_RET_DIR_VIOL     (1U<<11)  /* DIR viol (BAV sent when not DIR)     */
  181. #define WSb_RET_DOR_VIOL     (1U<<12)  /* DOR viol (BRQ sent when not DOR)     */
  182. #define WSb_RET_RR_VIOL      (1U<<13)  /* Response was read when not RR        */
  183. #define WSb_RET_WR_VIOL      (1U<<14)  /* Command was written while not WR     */
  184. #define WSb_ERRORFLAG        (1U<<15)  /* Error Summary flag                   */
  185.  
  186. /******************************************************************************/
  187. /****************  S E R V A N T   W O R D   S E R I A L  *********************/
  188. /******************************************************************************/
  189.  
  190.     /****************************************/
  191.     /* Word Serial Servant Response Sending */
  192.     /****************************************/
  193.  
  194. /* General */
  195. #define WSS_NOT_SUPPORTED    NO_HARDWARE_SUPPORT
  196.  
  197. /* MODE parameter */
  198. #define WSS_MODE_DIR         (1U<<0)   /* Send DIR (reads) Response int/signal */
  199. #define WSS_MODE_DOR         (1U<<0)   /* Send DOR (writes) Response int/signal*/
  200. #define WSS_MODE_END         (1U<<1)   /* Send END bit with last byte (writes) */
  201.  
  202. /* GenProtError return values */
  203. #define WSS_RET_ERR_PENDING  1         /* Previous error is pending            */
  204.  
  205. /* WSSrd, WSSwrt, WSSsendResp, WSSLsendResp return values */
  206. #define WSS_RET_SUCCESSFUL   NIVXI_OK  /* I/O successfully completed           */
  207. #define WSS_RET_OK_NOT_ENABLED 1       /* Must call WSSenable to start IO      */
  208. #define WSS_RET_MQE          -2        /* Multiple Query Error--reponse pending*/
  209.  
  210.     /****************************************/
  211.     /* Word Serial Servant ABORT type codes */
  212.     /****************************************/
  213.  
  214. /* WSSabort function 'abortop' parameter codes */
  215. #define WSS_ABORT_Write      (1U<<0)   /* Abort WSSwrt                         */
  216. #define WSS_ABORT_Read       (1U<<1)   /* Abort WSSrd                          */
  217. #define WSS_ABORT_Response   (1U<<2)   /* Abort WSSsendResp,WSSLsendResp       */
  218. #define WSS_ABORT_All        (1U<<15)  /* Abort all WS/WSS operations          */
  219.  
  220.     /*****************************************************************/
  221.     /* Word Serial Servant Buffer RETURN VALUES for Sending/Receving */
  222.     /****************************************************************/
  223.  
  224. /* Bit definitions for 'ret' return code for servant driver */
  225.  
  226. /* successful (ERRORFLAG cleared, IODONE set) */
  227. #define WSSb_RET_IODONE      (1U<<0)   /* I/O successfully completed           */
  228. #define WSSb_RET_END         (1U<<1)   /* END was received on Read             */
  229. #define WSSb_RET_TC          (1U<<2)   /* Terminal Count--buffer was filled    */
  230.  
  231. /* unsuccessful (ERRORFLAG set) */
  232. #define WSSb_RET_ForcedAbort (1U<<4)   /* WSabort called with ForcedAbort      */
  233. #define WSSb_RET_DIR_VIOL    (1U<<11)  /* DIR viol (BAV sent when not DIR)     */
  234. #define WSSb_RET_DOR_VIOL    (1U<<12)  /* DOR viol (BRQ sent when not DOR)     */
  235. #define WSSb_RET_RR_VIOL     (1U<<13)  /* Response was read when not RR        */
  236. #define WSSb_RET_WR_VIOL     (1U<<14)  /* Command was written while not WR     */
  237. #define WSSb_ERRORFLAG       (1U<<15)  /* Error Summary flag                   */
  238.  
  239. #endif
  240.  
  241.