///////////////////////////////////////////////////////////////////// // TpllPixController.h ///////////////////////////////////////////////////////////////////// // // 12/06/03 Version 1.0 (PM) // Initial release // //! TPLL Driver #ifndef _PIXLIB_TPLLPIXCONTROLLER #define _PIXLIB_TPLLPIXCONTROLLER #include "PixController.h" #define PLL_FACE 0x00 #define PLL_COMMAND_REGISTER 0x01 #define PLL_STATUS 0x02 #define PLL_DATA_STATUS 0x03 #define PLL_CONTROL_STATUS 0x04 #define PLL_TRIGGER_FIFO 0x05 #define PLL_DATA_FIFO 0x06 #define PLL_CONTROL_FIFO 0x07 #define PLL_FREQUENCY 0x08 #define PLL_XCKR_PHASE 0x0B #define PLL_EVENT_FILTER 0x0C #define PLL_SERIAL_NUMBER 0x0F namespace SctPixelRod { class VmePort; } namespace PixLib { class Bits; //! Pix Controller Exception class; an object of this type is thrown in case of a ROD error class TpllPixControllerExc : public PixControllerExc { public: enum ErrorType{OK, BAD_SLOT_NUM}; //! Constructor TpllPixControllerExc(ErrorType type, ErrorLevel el, std::string name, int info1, int info2) : PixControllerExc(el, name), m_errorType(type), m_info1(info1), m_info2(info2) {}; TpllPixControllerExc(ErrorType type, ErrorLevel el, std::string name, int info1) : PixControllerExc(el, name), m_errorType(type), m_info1(info1), m_info2(0) {}; TpllPixControllerExc(ErrorType type, ErrorLevel el, std::string name) : PixControllerExc(el, name), m_errorType(type), m_info1(0), m_info2(0) {}; //! Dump the error virtual void dump(std::ostream &out) { out << "Pixel Controller " << getCtrlName(); out << " -- Type : " << dumpType(); out << " -- Level : " << dumpLevel() << std::endl; } //! m_errorType accessor ErrorType getErrorType() { return m_errorType; }; private: std::string dumpType() { std::string message; switch (m_errorType) { case OK : return "No errors"; case BAD_SLOT_NUM : std::ostringstream(message) << "Invalid TPLL base address (" << m_info1 << ")" ; return message; default : return "Uknown error"; } } ErrorType m_errorType; int m_info1, m_info2; }; class TpllPixController : public PixController { public: TpllPixController(PixModuleGroup &modGrp, DBInquire *dbInquire); //! Constructor TpllPixController(PixModuleGroup &modGrp); //! Constructor virtual ~TpllPixController(); //! Destructor virtual void initHW(); //! Hardware (re)init virtual void testHW(); //! Hardware test virtual void sendCommand(Bits commands, int moduleMask); //! Send command no out virtual void sendCommandOutSync(Bits commands, int moduleMask, std::vector& output); //! Send command sync virtual void sendCommandOutAsync(Bits commands, int moduleMask, int commandID); //! Send command async virtual bool checkOutReady(int commandID); //! Wait for command termination virtual void getOutput(int commandID, std::vector& output); //! Get command output virtual void writeModuleConfig(int , Module& ) {}; //! Write module configuration virtual void readModuleConfig(int , Module& ) {}; //! Read module configuration virtual void sendModuleConfig(unsigned int ) {}; //! Send module configuration virtual void sendPixel(unsigned int moduleMask){}; //! send specif. pixel register cfg. virtual void sendGlobal(unsigned int moduleMask){}; //! send specif. gloabal register cfg. virtual void sendPixel(unsigned int moduleMask, std::string regName, bool allDcsIdentical=false) {}; //! send pixel register cfg. virtual void sendPixel(unsigned int moduleMask, std::string regName, int DC){} ; //! send pixel register cfg. for specific DC virtual void sendGlobal(unsigned int moduleMask, std::string regName){}; //! send gloabal register cfg. virtual void setCalibrationMode() {}; virtual void setConfigurationMode() {}; virtual void setRunMode() {}; virtual void writeScanConfig(PixScan &) {}; //! Write scan parameters virtual void writeScanConfig(PixScanConfig &) {}; //! Write scan parameters virtual void startScan() {}; //! Start a scan virtual bool fitHistos() { return false; }; //! fit histos virtual void getErrorHistos(unsigned int , Histo* &) {}; //! Read collected error arrays virtual void getHisto(HistoType type, unsigned int xmod, unsigned int slv, std::vector< std::vector >& his); //! Read an histogram virtual void getFitResults(HistoType type, unsigned int mod, unsigned int slv, std::vector< Histo * > &thr, std::vector< Histo * > &noise, std::vector< Histo * > &chi2); //! Read a Fit from Dsp virtual bool moduleActive(int ) { return false; }; //! True if a module is active during scan or datataking virtual void writeRunConfig(PixRunConfig &cfg); //! Get the run configuration virtual void startRun(int ntrig = 0); //! Start a run virtual void stopRun(); //! Terminates a run virtual void stopScan(); //! Aborts a running scan virtual int runStatus(); //! Check the status of the run virtual int nTrigger(); //! Returns the number of trigger processed so far virtual bool primitiveExists(std::string str); //! Ask if a given primitive is implemented // new function for MonLeak and HitBusScaler virtual void shiftPixMask(int mask, int steps=1); void tpllConfig(); private: virtual void configInit(); //! Init configuration structure SctPixelRod::VmePort *m_port; unsigned long *m_map; unsigned int m_tpllSlot; }; } #endif