00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef SCTPIXELROD_DUMMY_VMEINTERFACE_H
00013 #define SCTPIXELROD_DUMMY_VMEINTERFACE_H
00014
00015 #include <vector>
00016
00017 #include "VmeInterface.h"
00018 #include "VmePort.h"
00019
00020
00021 namespace SctPixelRod {
00022
00023 class DummyVmeInterface : public VmeInterface {
00024 public:
00026 DummyVmeInterface();
00028 ~DummyVmeInterface();
00029
00031 virtual void declareInterruptHandler(VmeInterruptHandler &handler);
00033 virtual void removeInterruptHandler(VmeInterruptHandler &handler);
00035 virtual void cleanInterruptHandlers();
00037 virtual inline void activateSoftVector(unsigned char vect, unsigned char subvect) {
00038 if (subvect>0 && subvect<=32) {
00039 m_softVectMask |= 1 << (subvect-1);
00040 }
00041 };
00043 virtual void reEnableInterrupt() { };
00045 virtual void blockInterruptNotification();
00047 virtual void resumeInterruptNotification();
00049 virtual void setInterruptData(long data) {
00050 m_interruptData = data;
00051 };
00053 virtual long getInterruptData() {
00054 return m_interruptData;
00055 };
00056
00058 virtual long getBusErrors();
00060 virtual void busErrorReport();
00061 virtual void busErrorReport(const unsigned long handle);
00062 virtual void busErrorReport(VmePort &port);
00064 virtual long getLastErrcode() { return 0; }
00066 virtual std::string getErrorMessage(const long errcode);
00067
00069 virtual unsigned char read8 (const unsigned long handle, const unsigned long offset);
00070 virtual unsigned char readS8 (const unsigned long handle, const unsigned long offset);
00071
00072 virtual unsigned short read16 (const unsigned long handle, const unsigned long offset);
00073 virtual unsigned short readS16 (const unsigned long handle, const unsigned long offset);
00075 virtual unsigned long read32 (const unsigned long handle, const unsigned long offset);
00076 virtual unsigned long readS32 (const unsigned long handle, const unsigned long offset);
00078 virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value);
00079 virtual void writeS8 (const unsigned long handle, const unsigned long offset, const unsigned char value);
00081 virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value);
00082 virtual void writeS16(const unsigned long handle, const unsigned long offset, const unsigned short value);
00084 virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value);
00085 virtual void writeS32(const unsigned long handle, const unsigned long offset, const unsigned long value);
00086
00088 virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);
00090 virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);
00092 virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);
00094 virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);
00095
00097 virtual unsigned long registerPort(VmePort &port);
00099 virtual void deletePort(VmePort &port);
00101 virtual void *getPortMap(const unsigned long handle);
00102
00103 private:
00104 std::vector<VmePort *> m_ports;
00105 sigset_t m_sigMask;
00106
00107 static unsigned char m_softVectMask;
00108 static long m_interruptData;
00109 static DummyVmeInterface *m_if;
00110 static std::vector<VmeInterruptHandler *> m_hardIH;
00111 static std::vector<VmeInterruptHandler *> m_softIH[32];
00112
00113
00115 static void m_interruptHandler(int signum);
00116 };
00117
00118 }
00119
00120 #endif // SCTPIXELROD_RCCVMEINTERFACE_H