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

RCCVmeInterface.h

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 // 20/02/2002  V 1.0 PM - First implementation
00009 //  3/04/2002  V 1.1 PM - Modifications in the error handling sector
00010 // 18/04/2002  V 1.2 PM - Modifications in the interrupt handling
00011 // 22/04/2002  V 1.3 PM - New methods for blocking and resuming 
00012 //                        interrupt notification and for setting and
00013 //                        reading an interrupt data word          
00014 // 13/08/2002  V 1.4 PM - Modifications for RCC v3
00015 //             
00016 
00017 #ifndef SCTPIXELROD_RCCVMEINTERFACE_H
00018 #define SCTPIXELROD_RCCVMEINTERFACE_H
00019 
00020 #include <vector>
00021 
00022 #include "VmeInterface.h"
00023 #include "VmePort.h"
00024 #include "rcc_error/rcc_error.h"
00025 
00026 #include "vme_rcc/vme_rcc.h"
00027 
00028 namespace SctPixelRod {
00029 
00030 class RCCVmeInterface : public VmeInterface {
00031 public:
00033   RCCVmeInterface();
00035   ~RCCVmeInterface();                                                                  
00036 
00038   virtual void declareInterruptHandler(VmeInterruptHandler &handler);
00040   virtual void cleanInterruptHandlers();
00042   virtual void removeInterruptHandler(VmeInterruptHandler &handler);
00044   virtual inline void activateSoftVector(unsigned char vect, unsigned char subvect) {
00045     if (subvect>0 && subvect<=32) {
00046       m_softVectMask[vect] |= 1 << (subvect-1);
00047     }
00048   };
00050   virtual void reEnableInterrupt(); 
00052   virtual void blockInterruptNotification(); 
00054   virtual void resumeInterruptNotification(); 
00056   virtual void setInterruptData(long data) {
00057     m_interruptData = data;
00058   };
00060   virtual long getInterruptData() {
00061     return m_interruptData;
00062   };
00063 
00065   virtual long getBusErrors();
00067   virtual void busErrorReport();
00068   virtual void busErrorReport(const unsigned long handle);
00069   virtual void busErrorReport(VmePort &port);
00071   virtual long getLastErrcode() { return m_lastErrcode; }
00073   virtual std::string getErrorMessage(const long errcode);
00074 
00076   virtual unsigned char read8  (const unsigned long handle, const unsigned long offset);  
00078   virtual unsigned short read16 (const unsigned long handle, const unsigned long offset);  
00080   virtual unsigned long read32 (const unsigned long handle, const unsigned long offset);  
00082   virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value);   
00084   virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value);    
00086   virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value);   
00087 
00089   virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);  
00091   virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);   
00093   virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);  
00095   virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);   
00096 
00098   virtual unsigned long registerPort(VmePort &port);         
00100   virtual void deletePort(VmePort &port);
00102   virtual void *getPortMap(const unsigned long handle);
00103 
00104 private:
00105   std::vector<VmePort *> m_ports;
00106   VME_BlockTransferList_t m_btList;
00107   int m_dmaBuf;
00108   long m_dmaBufSize;
00109   VME_BusErrorInfo_t m_busErrInfo;
00110   static long m_busErrors;                       // Number of bus error since last call to getBusErrors()
00111   int  m_lastErrcode;                            // Return code of the last operation 
00112   VME_InterruptList_t  m_irq[8];                 // Enabled interrupt vectors
00113 
00114   static int m_irqId[8];                                // Interrupt idetifier
00115   static long m_interruptData;                          // Interrupt data word
00116   static sigset_t m_sigMask;                            // Mask for blocking signals
00117   static RCCVmeInterface *m_if;                         // Static pointer to THE interface
00118   static unsigned char m_softVectMask[256];             // Interrupt subvector array
00119   static VmeInterruptHandler* m_hardIH[8][256][10];     // Vector of basic IH (always executed)
00120   static VmeInterruptHandler* m_softIH[32][10];         // Vector of slaves IH (executed when the subvector mask set
00121                                                         // by the basic IH equals the one defined in the slave IH
00122 
00123   // Covversion from generic to specific address modifiers codes
00124   int m_RCCAddrMod(VmeInterface::AddrMod mod);
00126   void m_blockTransferRead(unsigned long *buf);
00128   void m_blockTransferWrite(const unsigned long *buf);
00130   static void m_busErrorHandler(int signum);
00132   static void m_exitHandler(int signum);
00134   static void m_interruptHandler(int signum);
00135   static void m_interruptSignal(int signum);
00136 };                                             // End of RCCVmeInterface declaration
00137 
00138 } // End namespace SctPixelRod
00139 
00140 #endif // SCTPIXELROD_RCCVMEINTERFACE_H
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 

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