Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | 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 // 19/02/2004  V 2.5 PM - Safe single word R/W methods added            
00021 //
00022 
00036 #ifndef SCTPIXELROD_VMEINTERFACE_H
00037 #define SCTPIXELROD_VMEINTERFACE_H
00038 
00039 #include <vector>
00040 #include <string>
00041 
00042 #include "BaseException.h"
00043 
00044 namespace SctPixelRod {
00045 
00046 class VmePort;
00047 class VmeInterruptHandler;
00048 
00049 #define VMEADD_MISALIGNED      11001
00050 #define PCIADD_MISALIGNED      11002
00051 #define PCI_VME_MISALIGNED     11003
00052 #define DMAMEM_ALLOC_ERROR     11004
00053 #define BT_READ_ERROR          12000
00054 #define BT_WRITE_ERROR         13000
00055 
00057 class VmeException : public BaseException {
00058 public:
00059   enum ErrorClass {OK, INIT_ERROR, BUS_ERROR, MAP_ERROR, DMA_ERROR};
00061   VmeException(ErrorClass ec, long ecod, VmePort *port=NULL) : 
00062      BaseException("VME Error"), m_errorClass(ec), m_errorCode(ecod), m_port(port) {}; 
00063 
00065   ErrorClass getErrorClass() { return m_errorClass; };
00067   long getErrorCode() { return m_errorCode; };
00069   VmePort *getPort() { return m_port; };
00070 private:
00071   ErrorClass m_errorClass;
00072   int m_errorCode;
00073   VmePort *m_port;
00074 };
00075 
00076 class VmeInterface {
00077 public:
00078   enum AddrMod { A16, A24, A32 };
00079 
00081   VmeInterface() {};
00083   virtual ~VmeInterface() {};                                                                  
00084 
00086   virtual void declareInterruptHandler(VmeInterruptHandler &handler) = 0;
00088   virtual void cleanInterruptHandlers() = 0;
00090   virtual void removeInterruptHandler(VmeInterruptHandler &handler) = 0;
00092   virtual void activateSoftVector(unsigned char vect, unsigned char subvect) = 0; 
00094   virtual void reEnableInterrupt() = 0; 
00096   virtual void blockInterruptNotification() = 0; 
00098   virtual void resumeInterruptNotification() = 0; 
00100   virtual void setInterruptData(long data) = 0;
00102   virtual long getInterruptData() = 0;
00103   
00105   virtual long getBusErrors() = 0;
00107   virtual void busErrorReport() = 0;
00108   virtual void busErrorReport(const unsigned long handle) = 0;
00109   virtual void busErrorReport(VmePort &port) = 0;
00111   virtual long getLastErrcode() = 0;
00113   virtual std::string getErrorMessage(const long errcode) = 0;
00114 
00116   virtual unsigned char read8  (const unsigned long handle, const unsigned long offset) = 0;  
00117   virtual unsigned char readS8  (const unsigned long handle, const unsigned long offset) = 0;  
00118   // Word read (automatic mapping)
00119   virtual unsigned short read16 (const unsigned long handle, const unsigned long offset) = 0;  
00120   virtual unsigned short readS16 (const unsigned long handle, const unsigned long offset) = 0;  
00122   virtual unsigned long read32 (const unsigned long handle, const unsigned long offset) = 0;  
00123   virtual unsigned long readS32 (const unsigned long handle, const unsigned long offset) = 0;  
00125   virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value) = 0;   
00126   virtual void writeS8 (const unsigned long handle, const unsigned long offset, const unsigned char value) = 0;   
00128   virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value)= 0;    
00129   virtual void writeS16(const unsigned long handle, const unsigned long offset, const unsigned short value)= 0;    
00131   virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value) = 0;   
00132   virtual void writeS32(const unsigned long handle, const unsigned long offset, const unsigned long value) = 0;   
00133 
00135   virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len) = 0;  
00137   virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len) = 0;   
00139   virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len) = 0;  
00141   virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len) = 0;   
00142 
00144   virtual unsigned long registerPort(VmePort &port) = 0;         
00146   virtual void deletePort(VmePort &port) = 0;
00148   virtual void *getPortMap(const unsigned long handle) = 0;
00149 
00150 };                                             // End of VmeInterface declaration
00151 
00152 } // End namespace SctPixelRod
00153 
00154 #endif // SCTPIXELROD_VMEINTERFACE_H
00155 
00156 
00157 
00158 
00159 
00160 

Generated on Thu Jul 15 09:51:02 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5