Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Related Pages  

VmeInterface.h

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 //  8/11/2001  V 1.0 PM - Session management and error handling 
00009 // 29/11/2001  V 1.1 PM - ATLAS coding rules compliance 
00010 // 20/02/2002  V 2.0 PM - First implementation after the splitting
00011 //                        VmeInterface/VmePort 
00012 // 25/03/2002  V 2.1 TM - Data types unsigned, addr_mod->AddrMod, 
00013 //                        namespace added            
00014 //  4/04/2002  V 2.2 PM - Modification in the error handling methods
00015 // 18/04/2002  V 2.3 PM - Modifications in the interrupt handling
00016 //                        and in the error reporting methods
00017 // 22/04/2002  V 2.4 PM - New methods for blocking and resuming 
00018 //                        interrupt notification and for reading and
00019 //                        setting an interrupt data word           
00020 //
00021 
00035 #ifndef SCTPIXELROD_VMEINTERFACE_H
00036 #define SCTPIXELROD_VMEINTERFACE_H
00037 
00038 #include <vector>
00039 #include <string>
00040 
00041 #include "BaseException.h"
00042 
00043 namespace SctPixelRod {
00044 
00045 class VmePort;
00046 class VmeInterruptHandler;
00047 
00048 #define VMEADD_MISALIGNED      11001
00049 #define PCIADD_MISALIGNED      11002
00050 #define PCI_VME_MISALIGNED     11003
00051 #define DMAMEM_ALLOC_ERROR     11004
00052 #define BT_READ_ERROR          12000
00053 #define BT_WRITE_ERROR         13000
00054 
00056 class VmeException : public BaseException {
00057 public:
00058   enum ErrorClass {OK, INIT_ERROR, BUS_ERROR, MAP_ERROR, DMA_ERROR};
00060   VmeException(ErrorClass ec, long ecod, VmePort *port=NULL) : 
00061      BaseException("VME Error"), m_errorClass(ec), m_errorCode(ecod), m_port(port) {}; 
00062 
00064   ErrorClass getErrorClass() { return m_errorClass; };
00066   long getErrorCode() { return m_errorCode; };
00068   VmePort *getPort() { return m_port; };
00069 private:
00070   ErrorClass m_errorClass;
00071   int m_errorCode;
00072   VmePort *m_port;
00073 };
00074 
00075 class VmeInterface {
00076 public:
00077   enum AddrMod { A16, A24, A32 };
00078 
00080   VmeInterface() {};
00082   virtual ~VmeInterface() {};                                                                  
00083 
00085   virtual void declareInterruptHandler(VmeInterruptHandler &handler) = 0;
00087   virtual void cleanInterruptHandlers() = 0;
00089   virtual void removeInterruptHandler(VmeInterruptHandler &handler) = 0;
00091   virtual void activateSoftVector(unsigned char vect, unsigned char subvect) = 0; 
00093   virtual void reEnableInterrupt() = 0; 
00095   virtual void blockInterruptNotification() = 0; 
00097   virtual void resumeInterruptNotification() = 0; 
00099   virtual void setInterruptData(long data) = 0;
00101   virtual long getInterruptData() = 0;
00102   
00104   virtual long getBusErrors() = 0;
00106   virtual void busErrorReport() = 0;
00107   virtual void busErrorReport(const unsigned long handle) = 0;
00108   virtual void busErrorReport(VmePort &port) = 0;
00110   virtual long getLastErrcode() = 0;
00112   virtual std::string getErrorMessage(const long errcode) = 0;
00113 
00115   virtual unsigned char read8  (const unsigned long handle, const unsigned long offset) = 0;  
00116   // Word read (automatic mapping)
00117   virtual unsigned short read16 (const unsigned long handle, const unsigned long offset) = 0;  
00119   virtual unsigned long read32 (const unsigned long handle, const unsigned long offset) = 0;  
00121   virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value) = 0;   
00123   virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value)= 0;    
00125   virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value) = 0;   
00126 
00128   virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len) = 0;  
00130   virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len) = 0;   
00132   virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len) = 0;  
00134   virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len) = 0;   
00135 
00137   virtual unsigned long registerPort(VmePort &port) = 0;         
00139   virtual void deletePort(VmePort &port) = 0;
00141   virtual void *getPortMap(const unsigned long handle) = 0;
00142 
00143 };                                             // End of VmeInterface declaration
00144 
00145 } // End namespace SctPixelRod
00146 
00147 #endif // SCTPIXELROD_VMEINTERFACE_H
00148 
00149 
00150 
00151 
00152 
00153 

Generated on Tue Dec 9 10:07:57 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3