asyn 4-28
/home/epics/devel/asyn-R4-29/asyn/asynPortDriver/asynPortDriver.h
Go to the documentation of this file.
00001 #ifndef asynPortDriver_H
00002 #define asynPortDriver_H
00003 
00004 #include <epicsTypes.h>
00005 #include <epicsMutex.h>
00006 
00007 #include <asynStandardInterfaces.h>
00008 #include "paramVal.h"
00009 
00010 class paramList;
00011 
00012 epicsShareFunc void* findAsynPortDriver(const char *portName);
00013 typedef void (*userTimeStampFunction)(void *userPvt, epicsTimeStamp *pTimeStamp);
00014 
00015 #ifdef __cplusplus
00016 
00018 #define asynCommonMask          0x00000001
00019 #define asynDrvUserMask         0x00000002
00020 #define asynOptionMask          0x00000004
00021 #define asynInt32Mask           0x00000008
00022 #define asynUInt32DigitalMask   0x00000010
00023 #define asynFloat64Mask         0x00000020
00024 #define asynOctetMask           0x00000040
00025 #define asynInt8ArrayMask       0x00000080
00026 #define asynInt16ArrayMask      0x00000100
00027 #define asynInt32ArrayMask      0x00000200
00028 #define asynFloat32ArrayMask    0x00000400
00029 #define asynFloat64ArrayMask    0x00000800
00030 #define asynGenericPointerMask  0x00001000
00031 #define asynEnumMask            0x00002000
00032 
00033 
00034 
00037 class epicsShareClass asynPortDriver {
00038 public:
00039     asynPortDriver(const char *portName, int maxAddr, int paramTableSize, int interfaceMask, int interruptMask,
00040                    int asynFlags, int autoConnect, int priority, int stackSize);
00041     virtual ~asynPortDriver();
00042     virtual asynStatus lock();
00043     virtual asynStatus unlock();
00044     virtual asynStatus getAddress(asynUser *pasynUser, int *address); 
00045     virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
00046     virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
00047     virtual asynStatus readUInt32Digital(asynUser *pasynUser, epicsUInt32 *value, epicsUInt32 mask);
00048     virtual asynStatus writeUInt32Digital(asynUser *pasynUser, epicsUInt32 value, epicsUInt32 mask);
00049     virtual asynStatus setInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 mask, interruptReason reason);
00050     virtual asynStatus clearInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 mask);
00051     virtual asynStatus getInterruptUInt32Digital(asynUser *pasynUser, epicsUInt32 *mask, interruptReason reason);
00052     virtual asynStatus getBounds(asynUser *pasynUser, epicsInt32 *low, epicsInt32 *high);
00053     virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value);
00054     virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
00055     virtual asynStatus readOctet(asynUser *pasynUser, char *value, size_t maxChars,
00056                                         size_t *nActual, int *eomReason);
00057     virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars,
00058                                         size_t *nActual);
00059     virtual asynStatus flushOctet(asynUser *pasynUser);
00060     virtual asynStatus setInputEosOctet(asynUser *pasynUser, const char *eos, int eosLen);
00061     virtual asynStatus getInputEosOctet(asynUser *pasynUser, char *eos, int eosSize, int *eosLen);
00062     virtual asynStatus setOutputEosOctet(asynUser *pasynUser, const char *eos, int eosLen);
00063     virtual asynStatus getOutputEosOctet(asynUser *pasynUser, char *eos, int eosSize, int *eosLen);
00064     virtual asynStatus readInt8Array(asynUser *pasynUser, epicsInt8 *value, 
00065                                         size_t nElements, size_t *nIn);
00066     virtual asynStatus writeInt8Array(asynUser *pasynUser, epicsInt8 *value,
00067                                         size_t nElements);
00068     virtual asynStatus doCallbacksInt8Array(epicsInt8 *value,
00069                                         size_t nElements, int reason, int addr);
00070     virtual asynStatus readInt16Array(asynUser *pasynUser, epicsInt16 *value,
00071                                         size_t nElements, size_t *nIn);
00072     virtual asynStatus writeInt16Array(asynUser *pasynUser, epicsInt16 *value,
00073                                         size_t nElements);
00074     virtual asynStatus doCallbacksInt16Array(epicsInt16 *value,
00075                                         size_t nElements, int reason, int addr);
00076     virtual asynStatus readInt32Array(asynUser *pasynUser, epicsInt32 *value,
00077                                         size_t nElements, size_t *nIn);
00078     virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value,
00079                                         size_t nElements);
00080     virtual asynStatus doCallbacksInt32Array(epicsInt32 *value,
00081                                         size_t nElements, int reason, int addr);
00082     virtual asynStatus readFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
00083                                         size_t nElements, size_t *nIn);
00084     virtual asynStatus writeFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
00085                                         size_t nElements);
00086     virtual asynStatus doCallbacksFloat32Array(epicsFloat32 *value,
00087                                         size_t nElements, int reason, int addr);
00088     virtual asynStatus readFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
00089                                         size_t nElements, size_t *nIn);
00090     virtual asynStatus writeFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
00091                                         size_t nElements);
00092     virtual asynStatus doCallbacksFloat64Array(epicsFloat64 *value,
00093                                         size_t nElements, int reason, int addr);
00094     virtual asynStatus readGenericPointer(asynUser *pasynUser, void *pointer);
00095     virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *pointer);
00096     virtual asynStatus doCallbacksGenericPointer(void *pointer, int reason, int addr);
00097     virtual asynStatus readOption(asynUser *pasynUser, const char *key, char *value, int maxChars);
00098     virtual asynStatus writeOption(asynUser *pasynUser, const char *key, const char *value);
00099     virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn);
00100     virtual asynStatus writeEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements);
00101     virtual asynStatus doCallbacksEnum(char *strings[], int values[], int severities[], size_t nElements, int reason, int addr);
00102     virtual asynStatus drvUserCreate(asynUser *pasynUser, const char *drvInfo, 
00103                                      const char **pptypeName, size_t *psize);
00104     virtual asynStatus drvUserGetType(asynUser *pasynUser,
00105                                         const char **pptypeName, size_t *psize);
00106     virtual asynStatus drvUserDestroy(asynUser *pasynUser);
00107     virtual void report(FILE *fp, int details);
00108     virtual asynStatus connect(asynUser *pasynUser);
00109     virtual asynStatus disconnect(asynUser *pasynUser);
00110    
00111     virtual asynStatus createParam(          const char *name, asynParamType type, int *index);
00112     virtual asynStatus createParam(int list, const char *name, asynParamType type, int *index);
00113     virtual asynStatus findParam(          const char *name, int *index);
00114     virtual asynStatus findParam(int list, const char *name, int *index);
00115     virtual asynStatus getParamName(          int index, const char **name);
00116     virtual asynStatus getParamName(int list, int index, const char **name);
00117     virtual asynStatus setParamStatus(          int index, asynStatus status);
00118     virtual asynStatus setParamStatus(int list, int index, asynStatus status);
00119     virtual asynStatus getParamStatus(          int index, asynStatus *status);
00120     virtual asynStatus getParamStatus(int list, int index, asynStatus *status);
00121     virtual void       reportSetParamErrors(asynStatus status, int index, int list, const char *functionName);
00122     virtual void       reportGetParamErrors(asynStatus status, int index, int list, const char *functionName);
00123     virtual asynStatus setIntegerParam(          int index, int value);
00124     virtual asynStatus setIntegerParam(int list, int index, int value);
00125     virtual asynStatus setUIntDigitalParam(          int index, epicsUInt32 value, epicsUInt32 valueMask);
00126     virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask);
00127     virtual asynStatus setUIntDigitalParam(          int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
00128     virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
00129     virtual asynStatus setUInt32DigitalInterrupt(          int index, epicsUInt32 mask, interruptReason reason);
00130     virtual asynStatus setUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask, interruptReason reason);
00131     virtual asynStatus clearUInt32DigitalInterrupt(         int index, epicsUInt32 mask);
00132     virtual asynStatus clearUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask);
00133     virtual asynStatus getUInt32DigitalInterrupt(          int index, epicsUInt32 *mask, interruptReason reason);
00134     virtual asynStatus getUInt32DigitalInterrupt(int list, int index, epicsUInt32 *mask, interruptReason reason);
00135     virtual asynStatus setDoubleParam(          int index, double value);
00136     virtual asynStatus setDoubleParam(int list, int index, double value);
00137     virtual asynStatus setStringParam(          int index, const char *value);
00138     virtual asynStatus setStringParam(int list, int index, const char *value);
00139     virtual asynStatus getIntegerParam(          int index, int * value);
00140     virtual asynStatus getIntegerParam(int list, int index, int * value);
00141     virtual asynStatus getUIntDigitalParam(          int index, epicsUInt32 *value, epicsUInt32 mask);
00142     virtual asynStatus getUIntDigitalParam(int list, int index, epicsUInt32 *value, epicsUInt32 mask);
00143     virtual asynStatus getDoubleParam(          int index, double * value);
00144     virtual asynStatus getDoubleParam(int list, int index, double * value);
00145     virtual asynStatus getStringParam(          int index, int maxChars, char *value);
00146     virtual asynStatus getStringParam(int list, int index, int maxChars, char *value);
00147     virtual asynStatus callParamCallbacks();
00148     virtual asynStatus callParamCallbacks(          int addr);
00149     virtual asynStatus callParamCallbacks(int list, int addr);
00150     virtual asynStatus updateTimeStamp();
00151     virtual asynStatus updateTimeStamp(epicsTimeStamp *pTimeStamp);
00152     virtual asynStatus getTimeStamp(epicsTimeStamp *pTimeStamp);
00153     virtual asynStatus setTimeStamp(const epicsTimeStamp *pTimeStamp);
00154     asynStandardInterfaces *getAsynStdInterfaces();
00155     virtual void reportParams(FILE *fp, int details);
00156 
00157     char *portName;         
00159     int maxAddr;            
00160     void callbackTask();
00161 
00162 protected:
00163     asynUser *pasynUserSelf;    
00164     asynStandardInterfaces asynStdInterfaces;   
00166 private:
00167     paramList **params;
00168     epicsMutexId mutexId;
00169     char *inputEosOctet;
00170     int inputEosLenOctet;
00171     char *outputEosOctet;
00172     int outputEosLenOctet;
00173     template <typename epicsType, typename interruptType> 
00174         asynStatus doCallbacksArray(epicsType *value, size_t nElements,
00175                                     int reason, int address, void *interruptPvt);
00176 
00177 };
00178 
00179 #endif /* cplusplus */
00180     
00181 #endif