areaDetector  3-5-0
EPICS areaDetector framework
asynPortDriver.h
Go to the documentation of this file.
1 #ifndef asynPortDriver_H
2 #define asynPortDriver_H
3 
4 #include <vector>
5 #include <string>
6 
7 #include <epicsTypes.h>
8 #include <epicsMutex.h>
9 
10 #include <asynStandardInterfaces.h>
11 #include <asynParamType.h>
12 #include <paramErrors.h>
13 
14 class paramList;
15 
16 epicsShareFunc void* findAsynPortDriver(const char *portName);
17 typedef void (*userTimeStampFunction)(void *userPvt, epicsTimeStamp *pTimeStamp);
18 
19 #ifdef __cplusplus
20 
22 #define asynCommonMask 0x00000001
23 #define asynDrvUserMask 0x00000002
24 #define asynOptionMask 0x00000004
25 #define asynInt32Mask 0x00000008
26 #define asynUInt32DigitalMask 0x00000010
27 #define asynFloat64Mask 0x00000020
28 #define asynOctetMask 0x00000040
29 #define asynInt8ArrayMask 0x00000080
30 #define asynInt16ArrayMask 0x00000100
31 #define asynInt32ArrayMask 0x00000200
32 #define asynFloat32ArrayMask 0x00000400
33 #define asynFloat64ArrayMask 0x00000800
34 #define asynGenericPointerMask 0x00001000
35 #define asynEnumMask 0x00002000
36 
37 
38 
41 class epicsShareClass asynPortDriver {
42 public:
43  asynPortDriver(const char *portName, int maxAddr, int interfaceMask, int interruptMask,
44  int asynFlags, int autoConnect, int priority, int stackSize);
45  asynPortDriver(const char *portName, int maxAddr, int paramTableSize, int interfaceMask, int interruptMask,
46  int asynFlags, int autoConnect, int priority, int stackSize) EPICS_DEPRECATED;
47  virtual ~asynPortDriver();
48  virtual asynStatus lock();
49  virtual asynStatus unlock();
50  virtual asynStatus getAddress(asynUser *pasynUser, int *address);
51  virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
52  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
53  virtual asynStatus readUInt32Digital(asynUser *pasynUser, epicsUInt32 *value, epicsUInt32 mask);
54  virtual asynStatus writeUInt32Digital(asynUser *pasynUser, epicsUInt32 value, epicsUInt32 mask);
55  virtual asynStatus setInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 mask, interruptReason reason);
56  virtual asynStatus clearInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 mask);
57  virtual asynStatus getInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 *mask, interruptReason reason);
58  virtual asynStatus getBounds(asynUser *pasynUser, epicsInt32 *low, epicsInt32 *high);
59  virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value);
60  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
61  virtual asynStatus readOctet(asynUser *pasynUser, char *value, size_t maxChars,
62  size_t *nActual, int *eomReason);
63  virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars,
64  size_t *nActual);
65  virtual asynStatus flushOctet(asynUser *pasynUser);
66  virtual asynStatus setInputEosOctet(asynUser *pasynUser, const char *eos, int eosLen);
67  virtual asynStatus getInputEosOctet(asynUser *pasynUser, char *eos, int eosSize, int *eosLen);
68  virtual asynStatus setOutputEosOctet(asynUser *pasynUser, const char *eos, int eosLen);
69  virtual asynStatus getOutputEosOctet(asynUser *pasynUser, char *eos, int eosSize, int *eosLen);
70  virtual asynStatus readInt8Array(asynUser *pasynUser, epicsInt8 *value,
71  size_t nElements, size_t *nIn);
72  virtual asynStatus writeInt8Array(asynUser *pasynUser, epicsInt8 *value,
73  size_t nElements);
74  virtual asynStatus doCallbacksInt8Array(epicsInt8 *value,
75  size_t nElements, int reason, int addr);
76  virtual asynStatus readInt16Array(asynUser *pasynUser, epicsInt16 *value,
77  size_t nElements, size_t *nIn);
78  virtual asynStatus writeInt16Array(asynUser *pasynUser, epicsInt16 *value,
79  size_t nElements);
80  virtual asynStatus doCallbacksInt16Array(epicsInt16 *value,
81  size_t nElements, int reason, int addr);
82  virtual asynStatus readInt32Array(asynUser *pasynUser, epicsInt32 *value,
83  size_t nElements, size_t *nIn);
84  virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value,
85  size_t nElements);
86  virtual asynStatus doCallbacksInt32Array(epicsInt32 *value,
87  size_t nElements, int reason, int addr);
88  virtual asynStatus readFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
89  size_t nElements, size_t *nIn);
90  virtual asynStatus writeFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
91  size_t nElements);
92  virtual asynStatus doCallbacksFloat32Array(epicsFloat32 *value,
93  size_t nElements, int reason, int addr);
94  virtual asynStatus readFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
95  size_t nElements, size_t *nIn);
96  virtual asynStatus writeFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
97  size_t nElements);
98  virtual asynStatus doCallbacksFloat64Array(epicsFloat64 *value,
99  size_t nElements, int reason, int addr);
100  virtual asynStatus readGenericPointer(asynUser *pasynUser, void *pointer);
101  virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *pointer);
102  virtual asynStatus doCallbacksGenericPointer(void *pointer, int reason, int addr);
103  virtual asynStatus readOption(asynUser *pasynUser, const char *key, char *value, int maxChars);
104  virtual asynStatus writeOption(asynUser *pasynUser, const char *key, const char *value);
105  virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn);
106  virtual asynStatus writeEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements);
107  virtual asynStatus doCallbacksEnum(char *strings[], int values[], int severities[], size_t nElements, int reason, int addr);
108  virtual asynStatus drvUserCreate(asynUser *pasynUser, const char *drvInfo,
109  const char **pptypeName, size_t *psize);
110  virtual asynStatus drvUserGetType(asynUser *pasynUser,
111  const char **pptypeName, size_t *psize);
112  virtual asynStatus drvUserDestroy(asynUser *pasynUser);
113  virtual void report(FILE *fp, int details);
114  virtual asynStatus connect(asynUser *pasynUser);
115  virtual asynStatus disconnect(asynUser *pasynUser);
116 
117  virtual asynStatus createParam( const char *name, asynParamType type, int *index);
118  virtual asynStatus createParam(int list, const char *name, asynParamType type, int *index);
119  virtual asynStatus getNumParams( int *numParams);
120  virtual asynStatus getNumParams(int list, int *numParams);
121  virtual asynStatus findParam( const char *name, int *index);
122  virtual asynStatus findParam(int list, const char *name, int *index);
123  virtual asynStatus getParamName( int index, const char **name);
124  virtual asynStatus getParamName(int list, int index, const char **name);
125  virtual asynStatus getParamType( int index, asynParamType *type);
126  virtual asynStatus getParamType(int list, int index, asynParamType *type);
127  virtual asynStatus setParamStatus( int index, asynStatus status);
128  virtual asynStatus setParamStatus(int list, int index, asynStatus status);
129  virtual asynStatus getParamStatus( int index, asynStatus *status);
130  virtual asynStatus getParamStatus(int list, int index, asynStatus *status);
131  virtual asynStatus setParamAlarmStatus( int index, int status);
132  virtual asynStatus setParamAlarmStatus(int list, int index, int status);
133  virtual asynStatus getParamAlarmStatus( int index, int *status);
134  virtual asynStatus getParamAlarmStatus(int list, int index, int *status);
135  virtual asynStatus setParamAlarmSeverity( int index, int severity);
136  virtual asynStatus setParamAlarmSeverity(int list, int index, int severity);
137  virtual asynStatus getParamAlarmSeverity( int index, int *severity);
138  virtual asynStatus getParamAlarmSeverity(int list, int index, int *severity);
139  virtual void reportSetParamErrors(asynStatus status, int index, int list, const char *functionName);
140  virtual void reportGetParamErrors(asynStatus status, int index, int list, const char *functionName);
141  virtual asynStatus setIntegerParam( int index, int value);
142  virtual asynStatus setIntegerParam(int list, int index, int value);
143  virtual asynStatus setUIntDigitalParam( int index, epicsUInt32 value, epicsUInt32 valueMask);
144  virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask);
145  virtual asynStatus setUIntDigitalParam( int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
146  virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
147  virtual asynStatus setUInt32DigitalInterrupt( int index, epicsUInt32 mask, interruptReason reason);
148  virtual asynStatus setUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask, interruptReason reason);
149  virtual asynStatus clearUInt32DigitalInterrupt( int index, epicsUInt32 mask);
150  virtual asynStatus clearUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask);
151  virtual asynStatus getUInt32DigitalInterrupt( int index, epicsUInt32 *mask, interruptReason reason);
152  virtual asynStatus getUInt32DigitalInterrupt(int list, int index, epicsUInt32 *mask, interruptReason reason);
153  virtual asynStatus setDoubleParam( int index, double value);
154  virtual asynStatus setDoubleParam(int list, int index, double value);
155  virtual asynStatus setStringParam( int index, const char *value);
156  virtual asynStatus setStringParam(int list, int index, const char *value);
157  virtual asynStatus setStringParam( int index, const std::string& value);
158  virtual asynStatus setStringParam(int list, int index, const std::string& value);
159  virtual asynStatus getIntegerParam( int index, epicsInt32 * value);
160  virtual asynStatus getIntegerParam(int list, int index, epicsInt32 * value);
161  virtual asynStatus getUIntDigitalParam( int index, epicsUInt32 *value, epicsUInt32 mask);
162  virtual asynStatus getUIntDigitalParam(int list, int index, epicsUInt32 *value, epicsUInt32 mask);
163  virtual asynStatus getDoubleParam( int index, double * value);
164  virtual asynStatus getDoubleParam(int list, int index, double * value);
165  virtual asynStatus getStringParam( int index, int maxChars, char *value);
166  virtual asynStatus getStringParam(int list, int index, int maxChars, char *value);
167  virtual asynStatus getStringParam( int index, std::string& value);
168  virtual asynStatus getStringParam(int list, int index, std::string& value);
169  virtual asynStatus callParamCallbacks();
170  virtual asynStatus callParamCallbacks( int addr);
171  virtual asynStatus callParamCallbacks(int list, int addr);
172  virtual asynStatus updateTimeStamp();
173  virtual asynStatus updateTimeStamp(epicsTimeStamp *pTimeStamp);
174  virtual asynStatus getTimeStamp(epicsTimeStamp *pTimeStamp);
175  virtual asynStatus setTimeStamp(const epicsTimeStamp *pTimeStamp);
176  asynStandardInterfaces *getAsynStdInterfaces();
177  virtual void reportParams(FILE *fp, int details);
178 
179  char *portName;
181  int maxAddr;
182  void callbackTask();
183 
184 protected:
185  void initialize(const char *portNameIn, int maxAddrIn, int interfaceMask, int interruptMask, int asynFlags,
186  int autoConnect, int priority, int stackSize);
187  asynUser *pasynUserSelf;
188  asynStandardInterfaces asynStdInterfaces;
190 private:
191  std::vector<paramList*> params;
192  epicsMutexId mutexId;
193  char *inputEosOctet;
194  int inputEosLenOctet;
195  char *outputEosOctet;
196  int outputEosLenOctet;
197  template <typename epicsType, typename interruptType>
198  asynStatus doCallbacksArray(epicsType *value, size_t nElements,
199  int reason, int address, void *interruptPvt);
200 
201  friend class paramList;
202 };
203 
204 #endif /* cplusplus */
205 
206 #endif
epicsShareFunc void * findAsynPortDriver(const char *portName)
Utility function that returns a pointer to an asynPortDriver object from its name.
Definition: asynPortDriver.cpp:3440
Class to support parameter library (also called parameter list); set and get values indexed by parame...
Definition: asynPortDriver.cpp:47
void(* userTimeStampFunction)(void *userPvt, epicsTimeStamp *pTimeStamp)
Definition: asynPortDriver.h:17
Base class for asyn port drivers; handles most of the bookkeeping for writing an asyn port driver wit...
Definition: asynPortDriver.h:41
name
Definition: makeDbAndEdl.py:232
list value
Definition: makeDbAndEdl.py:234
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
asynStandardInterfaces asynStdInterfaces
The asyn interfaces this driver implements.
Definition: asynPortDriver.h:188
asynUser * pasynUserSelf
asynUser connected to ourselves for asynTrace
Definition: asynPortDriver.h:187
int maxAddr
The maximum asyn address (addr) supported by this driver.
Definition: asynPortDriver.h:181
Definition: NDFileHDF5Layout.h:42