Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | 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 // 19/02/2004  V 1.5 PM - Safe single word R/W methods added            
00016 //             
00017 
00018 #ifndef SCTPIXELROD_RCCVMEINTERFACE_H
00019 #define SCTPIXELROD_RCCVMEINTERFACE_H
00020 
00021 #include <vector>
00022 
00023 #include "VmeInterface.h"
00024 #include "VmePort.h"
00025 #include "rcc_error/rcc_error.h"
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);  
00077   virtual unsigned char readS8  (const unsigned long handle, const unsigned long offset);  
00079   virtual unsigned short read16 (const unsigned long handle, const unsigned long offset);  
00080   virtual unsigned short readS16 (const unsigned long handle, const unsigned long offset);  
00082   virtual unsigned long read32 (const unsigned long handle, const unsigned long offset);  
00083   virtual unsigned long readS32 (const unsigned long handle, const unsigned long offset);  
00084 
00086   virtual void write8 (const unsigned long handle, const unsigned long offset, const unsigned char value);   
00087   virtual void writeS8 (const unsigned long handle, const unsigned long offset, const unsigned char value);   
00089   virtual void write16(const unsigned long handle, const unsigned long offset, const unsigned short value);    
00090   virtual void writeS16(const unsigned long handle, const unsigned long offset, const unsigned short value);    
00092   virtual void write32(const unsigned long handle, const unsigned long offset, const unsigned long value);   
00093   virtual void writeS32(const unsigned long handle, const unsigned long offset, const unsigned long value);   
00094 
00096   virtual void blockRead32 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);  
00098   virtual void blockRead64 (VmePort &port, const unsigned long offset, unsigned long *buf, const long len);   
00100   virtual void blockWrite32(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);  
00102   virtual void blockWrite64(VmePort &port, const unsigned long offset, const unsigned long *buf, const long len);   
00103 
00105   virtual unsigned long registerPort(VmePort &port);         
00107   virtual void deletePort(VmePort &port);
00109   virtual void *getPortMap(const unsigned long handle);
00110 
00111 private:
00112   std::vector<VmePort *> m_ports;
00113   VME_BlockTransferList_t m_btList;
00114   int m_dmaBuf;
00115   long m_dmaBufSize;
00116   VME_BusErrorInfo_t m_busErrInfo;
00117   static long m_busErrors;                       // Number of bus error since last call to getBusErrors()
00118   int  m_lastErrcode;                            // Return code of the last operation 
00119   VME_InterruptList_t  m_irq[8];                 // Enabled interrupt vectors
00120 
00121   static int m_irqId[8];                                // Interrupt idetifier
00122   static long m_interruptData;                          // Interrupt data word
00123   static sigset_t m_sigMask;                            // Mask for blocking signals
00124   static RCCVmeInterface *m_if;                         // Static pointer to THE interface
00125   static unsigned char m_softVectMask[256];             // Interrupt subvector array
00126   static VmeInterruptHandler* m_hardIH[8][256][10];     // Vector of basic IH (always executed)
00127   static VmeInterruptHandler* m_softIH[32][10];         // Vector of slaves IH (executed when the subvector mask set
00128                                                         // by the basic IH equals the one defined in the slave IH
00129 
00130   // Covversion from generic to specific address modifiers codes
00131   int m_RCCAddrMod(VmeInterface::AddrMod mod);
00133   void m_blockTransferRead(unsigned long *buf);
00135   void m_blockTransferWrite(const unsigned long *buf);
00137   static void m_busErrorHandler(int signum);
00139   static void m_exitHandler(int signum);
00141   static void m_interruptHandler(int signum);
00142   static void m_interruptSignal(int signum);
00143 };                                             // End of RCCVmeInterface declaration
00144 
00145 } // End namespace SctPixelRod
00146 
00147 #endif // SCTPIXELROD_RCCVMEINTERFACE_H
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 

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