00001 #ifndef CAENCHAIN_H
00002 #define CAENCHAIN_H
00003
00004 #include <stdio.h>
00005 #include <sys/types.h>
00006 #include <sys/stat.h>
00007 #include <sys/mman.h>
00008 #include <errno.h>
00009 #include <fcntl.h>
00010 #include <unistd.h>
00011 #include <signal.h>
00012 #include <sys/ioctl.h>
00013
00014 #ifndef CAENCARD_H
00015 #include "CAENcard.h"
00016 #endif
00017
00018
00019 #define CAEN_CHAIN_MMAP_LEN 0x00008000
00020
00031 class CAENchain {
00032 private:
00034 unsigned int *firstSlot, *lastSlot;
00035
00037 int *refCount;
00038
00040 volatile unsigned short int *MCSTbuf;
00041
00043 int *MCSTfd, *CBLTfd;
00044
00046 int chainInit(int first, int last, int crate);
00047
00049 void destruct();
00050
00051 public:
00053 CAENchain(int first = 0, int last = 0, int crate = 0);
00054
00056 CAENchain& operator=(const CAENchain& chain);
00057
00059 ~CAENchain(){ destruct(); };
00060
00062 CAENcard slot(int slotNum);
00063
00065 CAENcard operator[](int index);
00066
00068 int length();
00069
00071 void setCrate(int crateNum);
00072
00074 void clearData();
00075
00077 void reset();
00078
00080 int readEvent(void* buf);
00082 int readEvent(DAQWordBuffer& wbuf, int start);
00084 int readEvent(DAQWordBufferPtr& wp);
00086 int readEvent(DAQDWordBuffer& dwbuf, int start);
00088 int readEvent(DAQDWordBufferPtr& dwp);
00089 };
00090
00091 #endif