areaDetector 1-8
|
00001 #ifndef asynNDArrayDriver_H 00002 #define asynNDArrayDriver_H 00003 00004 #include "asynPortDriver.h" 00005 #include "NDArray.h" 00006 00008 #define MAX_FILENAME_LEN 256 00009 00011 typedef enum { 00012 NDFileModeSingle, 00013 NDFileModeCapture, 00015 NDFileModeStream 00016 } NDFileMode_t; 00017 00018 typedef enum { 00019 NDFileWriteOK, 00020 NDFileWriteError 00021 } NDFileWriteStatus_t; 00022 00027 /* String asyn interface access Description */ 00028 #define NDPortNameSelfString "PORT_NAME_SELF" 00030 /* Parameters defining characteristics of the array data from the detector. 00031 * NDArraySizeX and NDArraySizeY are the actual dimensions of the array data, 00032 * including effects of the region definition and binning */ 00033 #define NDArraySizeXString "ARRAY_SIZE_X" 00034 #define NDArraySizeYString "ARRAY_SIZE_Y" 00035 #define NDArraySizeZString "ARRAY_SIZE_Z" 00036 #define NDArraySizeString "ARRAY_SIZE" 00037 #define NDNDimensionsString "ARRAY_NDIMENSIONS" 00038 #define NDDimensionsString "ARRAY_DIMENSIONS" 00039 #define NDDataTypeString "DATA_TYPE" 00040 #define NDColorModeString "COLOR_MODE" 00041 #define NDUniqueIdString "UNIQUE_ID" 00042 #define NDTimeStampString "TIME_STAMP" 00043 #define NDBayerPatternString "BAYER_PATTERN" 00045 /* Statistics on number of arrays collected */ 00046 #define NDArrayCounterString "ARRAY_COUNTER" 00048 /* File name related parameters for saving data. 00049 * Drivers are not required to implement file saving, but if they do these parameters 00050 * should be used. 00051 * The driver will normally combine NDFilePath, NDFileName, and NDFileNumber into 00052 * a file name that order using the format specification in NDFileTemplate. 00053 * For example NDFileTemplate might be "%s%s_%d.tif" */ 00054 #define NDFilePathString "FILE_PATH" 00055 #define NDFilePathExistsString "FILE_PATH_EXISTS" 00056 #define NDFileNameString "FILE_NAME" 00057 #define NDFileNumberString "FILE_NUMBER" 00058 #define NDFileTemplateString "FILE_TEMPLATE" 00059 #define NDAutoIncrementString "AUTO_INCREMENT" 00060 #define NDFullFileNameString "FULL_FILE_NAME" 00061 #define NDFileFormatString "FILE_FORMAT" 00062 #define NDAutoSaveString "AUTO_SAVE" 00063 #define NDWriteFileString "WRITE_FILE" 00064 #define NDReadFileString "READ_FILE" 00065 #define NDFileWriteModeString "WRITE_MODE" 00066 #define NDFileWriteStatusString "WRITE_STATUS" 00067 #define NDFileWriteMessageString "WRITE_MESSAGE" 00068 #define NDFileNumCaptureString "NUM_CAPTURE" 00069 #define NDFileNumCapturedString "NUM_CAPTURED" 00070 #define NDFileCaptureString "CAPTURE" 00072 #define NDFileDeleteDriverFileString "DELETE_DRIVER_FILE" 00075 #define NDAttributesFileString "ND_ATTRIBUTES_FILE" 00077 /* The detector array data */ 00078 #define NDArrayDataString "ARRAY_DATA" 00079 #define NDArrayCallbacksString "ARRAY_CALLBACKS" 00081 /* NDArray Pool status */ 00082 #define NDPoolMaxBuffersString "POOL_MAX_BUFFERS" 00083 #define NDPoolAllocBuffersString "POOL_ALLOC_BUFFERS" 00084 #define NDPoolFreeBuffersString "POOL_FREE_BUFFERS" 00085 #define NDPoolMaxMemoryString "POOL_MAX_MEMORY" 00086 #define NDPoolUsedMemoryString "POOL_USED_MEMORY" 00087 00093 class epicsShareFunc asynNDArrayDriver : public asynPortDriver { 00094 public: 00095 asynNDArrayDriver(const char *portName, int maxAddr, int numParams, int maxBuffers, size_t maxMemory, 00096 int interfaceMask, int interruptMask, 00097 int asynFlags, int autoConnect, int priority, int stackSize); 00098 00099 /* These are the methods that we override from asynPortDriver */ 00100 virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, 00101 size_t *nActual); 00102 virtual asynStatus readGenericPointer(asynUser *pasynUser, void *genericPointer); 00103 virtual asynStatus writeGenericPointer(asynUser *pasynUser, void *genericPointer); 00104 virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value); 00105 virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value); 00106 virtual void report(FILE *fp, int details); 00107 00108 /* These are the methods that are new to this class */ 00109 virtual int checkPath(); 00110 virtual int createFileName(int maxChars, char *fullFileName); 00111 virtual int createFileName(int maxChars, char *filePath, char *fileName); 00112 virtual int readNDAttributesFile(const char *fileName); 00113 virtual int getAttributes(NDAttributeList *pAttributeList); 00114 00115 protected: 00116 int NDPortNameSelf; 00117 #define FIRST_NDARRAY_PARAM NDPortNameSelf 00118 int NDArraySizeX; 00119 int NDArraySizeY; 00120 int NDArraySizeZ; 00121 int NDArraySize; 00122 int NDNDimensions; 00123 int NDDimensions; 00124 int NDDataType; 00125 int NDColorMode; 00126 int NDUniqueId; 00127 int NDTimeStamp; 00128 int NDBayerPattern; 00129 int NDArrayCounter; 00130 int NDFilePath; 00131 int NDFilePathExists; 00132 int NDFileName; 00133 int NDFileNumber; 00134 int NDFileTemplate; 00135 int NDAutoIncrement; 00136 int NDFullFileName; 00137 int NDFileFormat; 00138 int NDAutoSave; 00139 int NDWriteFile; 00140 int NDReadFile; 00141 int NDFileWriteMode; 00142 int NDFileWriteStatus; 00143 int NDFileWriteMessage; 00144 int NDFileNumCapture; 00145 int NDFileNumCaptured; 00146 int NDFileCapture; 00147 int NDFileDeleteDriverFile; 00148 int NDAttributesFile; 00149 int NDArrayData; 00150 int NDArrayCallbacks; 00151 int NDPoolMaxBuffers; 00152 int NDPoolAllocBuffers; 00153 int NDPoolFreeBuffers; 00154 int NDPoolMaxMemory; 00155 int NDPoolUsedMemory; 00156 #define LAST_NDARRAY_PARAM NDPoolUsedMemory 00157 00158 NDArray **pArrays; 00159 NDArrayPool *pNDArrayPool; 00160 class NDAttributeList *pAttributeList; 00162 }; 00163 00164 #define NUM_NDARRAY_PARAMS (&LAST_NDARRAY_PARAM - &FIRST_NDARRAY_PARAM + 1) 00165 #endif