Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
11 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: DEVICE.H
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of DEVICE.H
  13. //----------------------------------------------------------------------------
  14. /***************************************************************************
  15. Module Name: DEVICE.H
  16. Purpose: the declaration of functions, data structures, status codes,
  17. constants, and messages
  18. Version: 1.00
  19. Date: 10/01/1996
  20. Copyright (c) 1996 Advantech Corp. Ltd.
  21. All rights reserved.
  22. ****************************************************************************/
  23. #ifndef _INC_DEVICE
  24. #define _INC_DEVICE
  25. #include "OS.H"
  26. #include "DRIVER.H"
  27. #ifdef _WIN31
  28. #define FLOAT float
  29. #define CHAR char
  30. #define USHORT unsigned short
  31. #define ULONG unsigned long
  32. #endif
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. #define PUBLIC extern
  38. #define PRIVATE static
  39. /**************************************************************************
  40. Device Configuration Definition
  41. ***************************************************************************/
  42. typedef struct tagDEVCONFIG_ALL
  43. {
  44. DWORD dwBoardID; // board ID code
  45. USHORT usBaseAddress; // beginning address of ports to be controlled
  46. USHORT usInterrupt; // interrupt number
  47. USHORT usDMA; // DMA level
  48. USHORT usTimerClock; // clock selection
  49. USHORT usIoPortCount; // number of bytes to be controlled
  50. USHORT usAllowConflicts; // 1 allow IO conflicts
  51. USHORT usChanConfig; // 0-single ended, 1-differential
  52. USHORT usGainCtrMode; // 1-by jumper, 0-programmable
  53. USHORT usPolarity; // 0-bipolar, 1-unipolar
  54. USHORT usDasGain; // not used if GainCtrMode = 1
  55. USHORT usNumExpChan; // attached expansion channels
  56. USHORT usCjcChannel; // cold junction channel
  57. DAUGHTERSET Daughter[MAX_DAUGHTER_NUM]; // expansion board settings
  58. AOSET AoSettings[MAX_AO_RANGE]; // analog output settings
  59. WORD wDigPortCfg[MAX_DIO_PORT]; // port configuration for input or output
  60. WORD wDigGroupCfg[MAX_DIO_PORT]; // port Group configuration
  61. } DEVCONFIG_ALL, FAR * LPDEVCONFIG_ALL;
  62. /**************************************************************************
  63. Device Configuration Definition
  64. ***************************************************************************/
  65. typedef struct tagDEVCONFIG_AD
  66. {
  67. DWORD dwBoardID; // board ID code
  68. USHORT usBaseAddress; // beginning address of ports to be controlled
  69. USHORT usInterrupt; // interrupt number
  70. USHORT usDMA; // DMA level
  71. USHORT usTimerClock; // clock selection
  72. USHORT usIoPortCount; // number of bytes to be controlled
  73. USHORT usAllowConflicts; // 1 allow IO conflicts
  74. USHORT usChanConfig; // 0-single ended, 1-differential
  75. USHORT usGainCtrMode; // 1-by jumper, 0-programmable
  76. USHORT usPolarity; // 0-bipolar, 1-unipolar
  77. USHORT usDasGain; // not used if GainCtrMode = 1
  78. USHORT usNumExpChan; // attached expansion channels
  79. USHORT usCjcChannel; // cold junction channel
  80. DAUGHTERSET Daughter[MAX_DAUGHTER_NUM]; // expansion board settings
  81. AOSET AoSettings[MAX_AO_RANGE]; // analog output settings
  82. } DEVCONFIG_AD, FAR * LPDEVCONFIG_AD;
  83. /**************************************************************************
  84. DEVCONFIG_AO Definition
  85. ***************************************************************************/
  86. typedef struct tagDEVCONFIG_AO
  87. {
  88. DWORD dwBoardID; // board ID code
  89. USHORT usBaseAddress; // beginning address of ports to be controlled
  90. USHORT usInterrupt; // interrupt number
  91. USHORT usDMA; // DMA level
  92. USHORT usTimerClock; // clock selection
  93. USHORT usIoPortCount; // number of bytes to be controlled
  94. USHORT usAllowConflicts; // 1 allow IO conflicts
  95. AOSET AoSettings[MAX_AO_RANGE]; // analog output settings
  96. } DEVCONFIG_AO, FAR * LPDEVCONFIG_AO;
  97. /**************************************************************************
  98. DEVCONFIG_DIO Definition
  99. ***************************************************************************/
  100. typedef struct tagDEVCONFIG_DIO
  101. {
  102. DWORD dwBoardID; // board ID code
  103. USHORT usBaseAddress; // beginning address of ports to be controlled
  104. USHORT usInterrupt; // interrupt number
  105. USHORT usDMA; // DMA level
  106. USHORT usTimerClock; // clock selection
  107. USHORT usIoPortCount; // number of bytes to be controlled
  108. USHORT usAllowConflicts; // 1 allow IO conflicts
  109. WORD wDigPortCfg[MAX_DIO_PORT]; // port configuration for input or output
  110. WORD wDigGroupCfg[MAX_DIO_PORT]; // port Group configuration
  111. } DEVCONFIG_DIO, FAR * LPDEVCONFIG_DIO;
  112. /**************************************************************************
  113. DEVCONFIG_ADAM Definition
  114. ***************************************************************************/
  115. typedef struct tagDEVCONFIG_ADAM
  116. {
  117. DWORD dwBoardID; // board ID code
  118. USHORT usBaseAddress; // beginning address of ports to be controlled
  119. USHORT usDelay; // delay time before reading response; unit-ms
  120. USHORT usTimeOut; // time out for reading response; unit-ms
  121. USHORT usRetry; // retry
  122. USHORT usAlarmEnabled; // 0-disable, 1-enabled
  123. USHORT usSlotNo; // slot number
  124. USHORT usChecksumEnabled; // checksum enabled
  125. USHORT usDataFormat; // 0-Dec, 2-Hex; for 5080
  126. USHORT usCounterMode; // 0-counter mode 0; 1-counter mode 1; 2-freq mode
  127. CHAR szPreamble[20]; // prefix strings
  128. CHAR szPostamble[20]; // postfix strings
  129. } DEVCONFIG_ADAM, FAR * LPDEVCONFIG_ADAM;
  130. /**************************************************************************
  131. DEVCONFIG_DEVNET Definition
  132. ***************************************************************************/
  133. typedef struct tagDEVCONFIG_DEVNET
  134. {
  135. DWORD dwBoardID; // board ID code
  136. USHORT usInterrupt; // interrupt number
  137. USHORT usDelayTime; // EPR
  138. USHORT usAlarmEnabled; // 0-disable, 1-enabled
  139. DWORD dwMemoryAddress; // beginning address of memory mapped IO to be controlled
  140. DWORD dwMemoryCount; // number of bytes to be controlled
  141. USHORT usMyMacID; // host MAC ID
  142. USHORT usBaudRate; // baud rate
  143. USHORT usPortNum; // port number
  144. USHORT usSlotNo; // slot number
  145. USHORT usMacID; // MAC ID
  146. USHORT usEventEnabled; // 0-disable, 1-enabled
  147. CHAR APEventName[15]; // Event name
  148. HANDLE hEventAP; // Event handle
  149. WORD wStatus; // status of single slot (device)
  150. } DEVCONFIG_DEVNET, FAR * LPDEVCONFIG_DEVNET;
  151. /**************************************************************************
  152. DEVCONFIG_QCOUNTER Definition
  153. ***************************************************************************/
  154. typedef struct tagDEVCONFIG_QCOUNTER
  155. {
  156. DWORD dwBoardID; // board ID code
  157. USHORT usBaseAddress; // beginning address of ports to be controlled
  158. USHORT usInterrupt; // interrupt number
  159. USHORT usDMA; // DMA level
  160. USHORT usTimerClock; // clock selection
  161. USHORT usIoPortCount; // number of bytes to be controlled
  162. USHORT usAllowConflicts; // 1 allow IO conflicts
  163. USHORT usCascadeMode; // Cascade Mode ,=0 no cascade, =1 cascade
  164. USHORT usTimeBase; // Timer Latch setting for time base
  165. USHORT usTimeDivider; // Timer Latch setting for time divider
  166. } DEVCONFIG_QCOUNTER, FAR * LPDEVCONFIG_QCOUNTER;
  167. /**************************************************************************
  168. DEVCONFIG_836 Definition
  169. ***************************************************************************/
  170. typedef struct tagDEVCONFIG_836
  171. {
  172. DWORD dwBoardID; // board ID code
  173. USHORT usBaseAddress; // beginning address of ports to be controlled
  174. USHORT usInterrupt; // interrupt number
  175. USHORT usIoPortCount; // number of bytes to be controlled
  176. USHORT usAllowConflicts; // 1 allow IO conflicts
  177. USHORT usCountEdge; // =0 Positive, =1 Negative
  178. USHORT usFilterEnabled; // 0-disable, 1-enable
  179. DWORD dwMaxInFreq; // Max input frequency in Hz
  180. } DEVCONFIG_836, FAR * LPDEVCONFIG_836;
  181. /**************************************************************************
  182. Direct I/O Definition
  183. ***************************************************************************/
  184. typedef struct tagDEVCONFIG_IO
  185. {
  186. DWORD dwBoardID; // board ID code
  187. USHORT usBaseAddress; // beginning address of ports to be controlled
  188. USHORT usInterrupt; // interrupt number
  189. USHORT usIoPortCount; // number of bytes to be controlled
  190. USHORT usAllowConflicts; // 1 allow IO conflicts
  191. CHAR szDescription[50]; // Description
  192. } DEVCONFIG_IO, FAR * LPDEVCONFIG_IO;
  193. /**************************************************************************
  194. DEVCONFIG_175X Definition
  195. ***************************************************************************/
  196. typedef struct tagDEVCONFIG_175X
  197. {
  198. DWORD dwBoardID; // board ID code
  199. USHORT usCardNo; // card no of this series
  200. USHORT usBaseAddress; // beginning address of ports to be controlled
  201. USHORT usInterrupt; // interrupt number
  202. USHORT usIoPortCount; // number of bytes to be controlled
  203. USHORT usAllowConflicts; // 1 allow IO conflicts
  204. USHORT usIntMode; // divide two parts, 0XBB0XAA (8 bits)
  205. // this bit 7 and 3 fixed to zero
  206. // the meant of BB port1 mode
  207. // the meant of AA port0 mode
  208. // bit 6 is port 1 interrupt trigger edge
  209. // bit 2 is port 0 interrupt trigger edge
  210. // (= 1 Rising, = 0 falling)
  211. USHORT usCascadeMode; // cascade Mode ,=0 no cascade, =1 cascade
  212. DWORD dwTimer1Count; // timer1 (hi is Counter1, lo is Counter0)
  213. USHORT dwCounter2Count; // counter 2 count value
  214. WORD wDigPortCfg[MAX_DIO_PORT]; // port configuration for input or output
  215. } DEVCONFIG_175X, FAR * LPDEVCONFIG_175X;
  216. typedef struct _AD_WRITE_INPUT {
  217. ULONG PortNumber; // Port # to write to
  218. union { // Data to be output to port
  219. ULONG LongData;
  220. USHORT ShortData;
  221. UCHAR CharData;
  222. };
  223. } AD_WRITE_INPUT;
  224. /**************************************************************************
  225. DEVCONFIG_SIMU Definition
  226. ***************************************************************************/
  227. typedef struct tagDEVCONFIG_SIMU
  228. {
  229. DWORD dwBoardID; // board ID code
  230. USHORT usBaseAddress; // beginning address of ports to be controlled
  231. USHORT usSimulate; // 1: Simulate IO
  232. USHORT usDataType; // 0: Float, 1: Long, 2:Byte
  233. } DEVCONFIG_SIMU, FAR * LPDEVCONFIG_SIMU;
  234. #ifdef __cplusplus
  235. }
  236. #endif
  237. #endif