00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef SCTPIXELROD_DUMMY_VMEINTERFACE_H
00012 #define SCTPIXELROD_DUMMY_VMEINTERFACE_H
00013
00014 #include <vector>
00015
00016 #include "VmeInterface.h"
00017 #include "VmePort.h"
00018
00019
00020 namespace SctPixelRod {
00021
00022 class DummyVmeInterface : public VmeInterface {
00023 public:
00025 DummyVmeInterface();
00027 ~DummyVmeInterface();
00028
00030 virtual void declareInterruptHandler(VmeInterruptHandler &handler);
00032 virtual void removeInterruptHandler(VmeInterruptHandler &handler);
00034 virtual void cleanInterruptHandlers();
00036 virtual inline void activateSoftVector(unsigned char vect, unsigned char subvect) {
00037 if (subvect>0 && subvect<=32) {
00038 m_softVectMask |= 1 << (subvect-1);
00039 }
00040 };
00042 virtual void reEnableInterrupt() { };
00044 virtual void blockInterruptNotification();
00046 virtual void resumeInterruptNotification();
00048 virtual void setInterruptData(long data) {
00049 m_interruptData = data;
00050 };
00052 virtual long getInterruptData() {
00053 return m_interruptData;
00054 };
00055
00057 virtual long getBusErrors();
00059 virtual void busErrorReport();
00060 virtual void busErrorReport(const unsigned long handle);
00061 virtual void busErrorReport(VmePort &port);
00063 virtual long getLastErrcode() { return 0; }
00065 virtual std::string getErrorMessage(const long errcode);
00066
00068 virtual unsigned char read8 (const unsigned long handle, const unsigned long offset);
00069
00070 virtual unsigned short read16 (const unsigned long handle, const unsigned long offset);
00072 virtual unsigned long read32 (const unsigned long handle, const unsigned long offset);
00074 virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value);
00076 virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value);
00078 virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value);
00079
00081 virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);
00083 virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);
00085 virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);
00087 virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);
00088
00090 virtual unsigned long registerPort(VmePort &port);
00092 virtual void deletePort(VmePort &port);
00094 virtual void *getPortMap(const unsigned long handle);
00095
00096 private:
00097 std::vector<VmePort *> m_ports;
00098 sigset_t m_sigMask;
00099
00100 static unsigned char m_softVectMask;
00101 static long m_interruptData;
00102 static DummyVmeInterface *m_if;
00103 static std::vector<VmeInterruptHandler *> m_hardIH;
00104 static std::vector<VmeInterruptHandler *> m_softIH[32];
00105
00106
00108 static void m_interruptHandler(int signum);
00109 };
00110
00111 }
00112
00113 #endif // SCTPIXELROD_RCCVMEINTERFACE_H