versadac  1
versadac - Scalable Recorder Firmware
eio_ai.h
1 /*******************************************************************************
2 FILE : eio_ai.h
3 VERSION : $Id: eio_ai.h 5305 2006-10-27 12:09:59Z martinto $
4 AUTHOR : David Cozens
5 SYSTEM : Diab C for PowerPC under vxWorks
6 DESCRIPTION : Data types and function prototypes for the generic EIO AI API.
7 *******************************************************************************/
8 #ifndef __EIO_AI_H
9 #define __EIO_AI_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 /* Measured value status */
15 typedef enum
16 {
17  EIO_AI_MEASURED_VALUE_STATUS_GOOD,
18  EIO_AI_MEASURED_VALUE_STATUS_OVER_RANGE,
19  EIO_AI_MEASURED_VALUE_STATUS_UNDER_RANGE,
20  EIO_AI_MEASURED_VALUE_STATUS_RANGING,
21  EIO_AI_MEASURED_VALUE_STATUS_HARDWARE_CAPABILITIES_EXCEEDED,
22  EIO_AI_MEASURED_VALUE_STATUS_HARDWARE_ERROR,
23  EIO_AI_MEASURED_VALUE_STATUS_BAD_CALIBRATION,
24  EIO_AI_MEASURED_VALUE_STATUS_CALIBRATING,
25  EIO_AI_MEASURED_VALUE_STATUS_MADE_SAFE,
26  EIO_AI_MEASURED_VALUE_STATUS_BREAK_DETECT
27 }EioAIMeasuredValueStatus;
28 
29 /* Auxiliary measurement status, (CJ or Aux resistance) */
30 typedef enum
31 {
32  EIO_AI_AUX_STATUS_GOOD,
33  EIO_AI_AUX_STATUS_NO_SENSOR,
34  EIO_AI_AUX_STATUS_OUT_OF_RANGE,
35  EIO_AI_AUX_STATUS_HARDWARE_ERROR,
36  EIO_AI_AUX_STATUS_BAD_CALIBRATION,
37  EIO_AI_AUX_STATUS_CALIBRATING,
38  EIO_AI_AUX_STATUS_OHMS_2_WIRE,
39  EIO_AI_AUX_STATUS_OHMS_3_WIRE,
40  EIO_AI_AUX_STATUS_RANGING
41 }EioAIAuxStatus;
42 
43 /* AI runtime data */
44 typedef struct
45 {
46  float value;
47  float auxValue;
48  EioAIMeasuredValueStatus status;
49  EioAIAuxStatus auxStatus;
50  EioBoolean userCalibrated;
52 
53 /* Input types */
54 typedef enum
55 {
56  EIO_AI_TYPE_OFF,
57  EIO_AI_TYPE_mV,
58  EIO_AI_TYPE_mA,
59  EIO_AI_TYPE_OHMS_2_WIRE,
60  EIO_AI_TYPE_OHMS_3_WIRE,
61  EIO_AI_TYPE_OHMS_4_WIRE,
62  EIO_AI_TYPE_DIGITAL,
63  EIO_AI_TYPE_POTENTIOMETER,
64  EIO_AI_NUMBER_OF_TYPES
65 }EioAIType;
66 
67 /* break response behaviour */
68 typedef enum
69 {
70  EIO_AI_BREAK_RESPONSE_NONE,
71  EIO_AI_BREAK_RESPONSE_DRIVE_HIGH,
72  EIO_AI_BREAK_RESPONSE_DRIVE_LOW,
73  EIO_AI_BREAK_RESPONSE_DETECT_ONLY
74 }EioAIBreakResponse;
75 
76 typedef struct
77 {
78  EioAIType inputType;
79  EioAIBreakResponse breakResponse;
80  EioUint32 filterTimeuS;
81  EioUint32 changeCounter;
82  float rangeLow;
83  float rangeHigh;
84  float resistance;
85  EioBoolean useAdaptiveFilter;
86  EioBoolean cjRequired;
88 
89 /* prototypes for runtime data and configuration */
90 EioAIMeasuredValueData* eioAIGetMeasuredValueDataPtr( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber);
91 void eioAIGetMeasuredValueData( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAIMeasuredValueData *dataPtr);
92 void eioAISetConfiguration( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAIType inputType, EioAIBreakResponse breakResponse, EioUint32 filterTimeuS, float rangeLow, float rangeHigh, float resistance, EioBoolean useAdaptiveFilter, EioBoolean cjRequired);
93 void eioAISecondarySetMeasuredValueData( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAIMeasuredValueData *dataPtr);
94 
95 
96 /* calibration type */
97 typedef enum
98 {
99  EIO_AI_CAL_TYPE_FACTORY,
100  EIO_AI_CAL_TYPE_USER_REFERENCE
101 }EioAICalType;
102 
103 /* Calibration range type */
104 typedef enum
105 {
106  EIO_AI_CAL_RANGE_TYPE_mV,
107  EIO_AI_CAL_RANGE_TYPE_mA,
108  EIO_AI_CAL_RANGE_TYPE_Ohms
109 }EioAICalRangeType;
110 
111 /* Calibration status */
112 typedef enum
113 {
114  EIO_AI_CAL_STATE_BUSY,
115  EIO_AI_CAL_STATE_POINT_DONE,
116  EIO_AI_CAL_STATE_ABORTED
117 }EioAICalStatus;
118 
119 /* Calibration prototypes */
120 EioBoolean eioAICalIsPointRangeCalibrated( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
121 EioBoolean eioAICalIsCalibrationTypeSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType);
122 void eioAICalSetDefaultCalibration( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType);
123 void eioAICalPointCalibrationStart( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType);
124 EioAICalStatus eioAICalGetCalState( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber);
125 void eioAICalPointCalibrationComplete( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType);
126 void eioAICalPointCalibrationAbort( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber);
127 void eioAICalSetCalibrationRange( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
128 EioBoolean eioAICalIsVREFCalRequired( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType);
129 EioUint8 eioAICalGetNumberOfCalibrationRanges( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType);
130 EioAICalRangeType eioAICalGetRangeType( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
131 float eioAICalGetRangeLowLimit( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
132 float eioAICalGetRangeHighLimit( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
133 EioUint8 eioAICalGetNumberOfCalibrationPoints( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
134 float eioAICalGetNominalCalibrationPoint( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber, EioUint8 calibrationPointIndex);
135 void eioAICalSetActualCalibrationPoint( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber, float value, EioUint8 calibrationPointIndex);
136 EioBoolean eioAICalIsCustomCalibrationPointSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAICalType calType, EioUint8 rangeNumber);
137 void eioAICalRestartMeasurement( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber);
138 void eioAICalSetVREFValue( EioSystem *ioSystem, EioUint8 moduleNumber, EioUint8 pointNumber, float Vref);
139 
140 /* Capability discovery prototypes */
141 float eioAIGetHighestMeasureableValue( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAIType inputType);
142 float eioAIGetLowestMeasureableValue( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAIType inputType);
143 EioBoolean eioAIIsTypeSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAIType inputType);
144 EioBoolean eioAIIsCJSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber);
145 EioBoolean eioAIIsBreakResponseSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAIType inputType, float rangeLow, float rangeHigh, EioAIBreakResponse breakResponse);
146 EioUint32 eioAIGetMaxFilterTimeuS( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber);
147 EioBoolean eioAIIsAdaptiveFilterSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber);
148 float eioAIGetInputImpedence( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber, EioAIType inputType, float rangeLow, float rangeHigh);
149 EioBoolean eioAIUserShuntResistorSupported( EioSystem *ioSystem, EioModuleType moduleType, EioUint8 pointNumber);
150 
151 #ifdef __cplusplus
152 } /* extern "C" */
153 #endif
154 #endif /* __EIO_AI_H */
Definition: eio_ai.h:44
Definition: eio_syst.h:52
Definition: eio_ai.h:76