asyn 4-21
/home/epics/devel/asynR4-21/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 
00014 #ifdef __cplusplus
00015 
00017 #define asynCommonMask          0x00000001
00018 #define asynDrvUserMask         0x00000002
00019 #define asynOptionMask          0x00000004
00020 #define asynInt32Mask           0x00000008
00021 #define asynUInt32DigitalMask   0x00000010
00022 #define asynFloat64Mask         0x00000020
00023 #define asynOctetMask           0x00000040
00024 #define asynInt8ArrayMask       0x00000080
00025 #define asynInt16ArrayMask      0x00000100
00026 #define asynInt32ArrayMask      0x00000200
00027 #define asynFloat32ArrayMask    0x00000400
00028 #define asynFloat64ArrayMask    0x00000800
00029 #define asynGenericPointerMask  0x00001000
00030 #define asynEnumMask            0x00002000
00031 
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 readInt8Array(asynUser *pasynUser, epicsInt8 *value, 
00061                                         size_t nElements, size_t *nIn);
00062     virtual asynStatus writeInt8Array(asynUser *pasynUser, epicsInt8 *value,
00063                                         size_t nElements);
00064     virtual asynStatus doCallbacksInt8Array(epicsInt8 *value,
00065                                         size_t nElements, int reason, int addr);
00066     virtual asynStatus readInt16Array(asynUser *pasynUser, epicsInt16 *value,
00067                                         size_t nElements, size_t *nIn);
00068     virtual asynStatus writeInt16Array(asynUser *pasynUser, epicsInt16 *value,
00069                                         size_t nElements);
00070     virtual asynStatus doCallbacksInt16Array(epicsInt16 *value,
00071                                         size_t nElements, int reason, int addr);
00072     virtual asynStatus readInt32Array(asynUser *pasynUser, epicsInt32 *value,
00073                                         size_t nElements, size_t *nIn);
00074     virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value,
00075                                         size_t nElements);
00076     virtual asynStatus doCallbacksInt32Array(epicsInt32 *value,
00077                                         size_t nElements, int reason, int addr);
00078     virtual asynStatus readFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
00079                                         size_t nElements, size_t *nIn);
00080     virtual asynStatus writeFloat32Array(asynUser *pasynUser, epicsFloat32 *value,
00081                                         size_t nElements);
00082     virtual asynStatus doCallbacksFloat32Array(epicsFloat32 *value,
00083                                         size_t nElements, int reason, int addr);
00084     virtual asynStatus readFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
00085                                         size_t nElements, size_t *nIn);
00086     virtual asynStatus writeFloat64Array(asynUser *pasynUser, epicsFloat64 *value,
00087                                         size_t nElements);
00088     virtual asynStatus doCallbacksFloat64Array(epicsFloat64 *value,
00089                                         size_t nElements, int reason, int addr);
00090     virtual asynStatus readGenericPointer(asynUser *pasynUser, void *pointer);
00091     virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *pointer);
00092     virtual asynStatus doCallbacksGenericPointer(void *pointer, int reason, int addr);
00093     virtual asynStatus readOption(asynUser *pasynUser, const char *key, char *value, int maxChars);
00094     virtual asynStatus writeOption(asynUser *pasynUser, const char *key, const char *value);
00095     virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn);
00096     virtual asynStatus writeEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements);
00097     virtual asynStatus doCallbacksEnum(char *strings[], int values[], int severities[], size_t nElements, int reason, int addr);
00098     virtual asynStatus drvUserCreate(asynUser *pasynUser, const char *drvInfo, 
00099                                      const char **pptypeName, size_t *psize);
00100     virtual asynStatus drvUserGetType(asynUser *pasynUser,
00101                                         const char **pptypeName, size_t *psize);
00102     virtual asynStatus drvUserDestroy(asynUser *pasynUser);
00103     virtual void report(FILE *fp, int details);
00104     virtual asynStatus connect(asynUser *pasynUser);
00105     virtual asynStatus disconnect(asynUser *pasynUser);
00106    
00107     virtual asynStatus createParam(          const char *name, asynParamType type, int *index);
00108     virtual asynStatus createParam(int list, const char *name, asynParamType type, int *index);
00109     virtual asynStatus findParam(          const char *name, int *index);
00110     virtual asynStatus findParam(int list, const char *name, int *index);
00111     virtual asynStatus getParamName(          int index, const char **name);
00112     virtual asynStatus getParamName(int list, int index, const char **name);
00113     virtual asynStatus setParamStatus(          int index, asynStatus status);
00114     virtual asynStatus setParamStatus(int list, int index, asynStatus status);
00115     virtual asynStatus getParamStatus(          int index, asynStatus *status);
00116     virtual asynStatus getParamStatus(int list, int index, asynStatus *status);
00117     virtual void       reportSetParamErrors(asynStatus status, int index, int list, const char *functionName);
00118     virtual void       reportGetParamErrors(asynStatus status, int index, int list, const char *functionName);
00119     virtual asynStatus setIntegerParam(          int index, int value);
00120     virtual asynStatus setIntegerParam(int list, int index, int value);
00121     virtual asynStatus setUIntDigitalParam(          int index, epicsUInt32 value, epicsUInt32 valueMask);
00122     virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask);
00123     virtual asynStatus setUIntDigitalParam(          int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
00124     virtual asynStatus setUIntDigitalParam(int list, int index, epicsUInt32 value, epicsUInt32 valueMask, epicsUInt32 interruptMask);
00125     virtual asynStatus setUInt32DigitalInterrupt(          int index, epicsUInt32 mask, interruptReason reason);
00126     virtual asynStatus setUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask, interruptReason reason);
00127     virtual asynStatus clearUInt32DigitalInterrupt(         int index, epicsUInt32 mask);
00128     virtual asynStatus clearUInt32DigitalInterrupt(int list, int index, epicsUInt32 mask);
00129     virtual asynStatus getUInt32DigitalInterrupt(          int index, epicsUInt32 *mask, interruptReason reason);
00130     virtual asynStatus getUInt32DigitalInterrupt(int list, int index, epicsUInt32 *mask, interruptReason reason);
00131     virtual asynStatus setDoubleParam(          int index, double value);
00132     virtual asynStatus setDoubleParam(int list, int index, double value);
00133     virtual asynStatus setStringParam(          int index, const char *value);
00134     virtual asynStatus setStringParam(int list, int index, const char *value);
00135     virtual asynStatus getIntegerParam(          int index, int * value);
00136     virtual asynStatus getIntegerParam(int list, int index, int * value);
00137     virtual asynStatus getUIntDigitalParam(          int index, epicsUInt32 *value, epicsUInt32 mask);
00138     virtual asynStatus getUIntDigitalParam(int list, int index, epicsUInt32 *value, epicsUInt32 mask);
00139     virtual asynStatus getDoubleParam(          int index, double * value);
00140     virtual asynStatus getDoubleParam(int list, int index, double * value);
00141     virtual asynStatus getStringParam(          int index, int maxChars, char *value);
00142     virtual asynStatus getStringParam(int list, int index, int maxChars, char *value);
00143     virtual asynStatus callParamCallbacks();
00144     virtual asynStatus callParamCallbacks(          int addr);
00145     virtual asynStatus callParamCallbacks(int list, int addr);
00146     virtual void reportParams(FILE *fp, int details);
00147 
00148     char *portName;         
00150     int maxAddr;            
00151     void callbackTask();
00152 
00153 protected:
00154     asynUser *pasynUserSelf;    
00155     asynStandardInterfaces asynStdInterfaces;   
00157 private:
00158     paramList **params;
00159     epicsMutexId mutexId;
00160     template <typename epicsType, typename interruptType> 
00161         asynStatus doCallbacksArray(epicsType *value, size_t nElements,
00162                                     int reason, int address, void *interruptPvt);
00163 
00164 };
00165 
00166 #endif /* cplusplus */
00167     
00168 #endif