#ifndef TPCCOMMANDCODERDB_H #define TPCCOMMANDCODERDB_H #include "RCUCommandCoder.h" #include "AltroCommandCoder.h" #include "BoardControllerCommandCoder.h" #include "RCUControlEngine.h" #include "CommandCoderBase.hpp" #include "ReadoutList.h" #include "Acl.h" #include "Afl.h" #include "../Container/RcuContainer.h" #include "../DB/FERODBFieldPositions.h" #include "../DB/DBQueryCreator.h" #include "../DB/OracleDB.h" #include "../Mapping/Mapping.h" #include "../Logger/Logger.h" #include "../CentralHeaders/TpcException.h" #include #include #include #define AFL_REG_ADD 0x5100 #define ALTROIF_REG_ADD 0x5101 #define TRGCONF_REG_ADD 0x5102 #define RDOMOD_REG_ADD 0x5103 #define ALTROCFG1_REG_ADD 0x5104 #define ALTROCFG2_REG_ADD 0x5105 #define RCUID_REG_ADD 0x5108 #define EN_INT_BA_REG_ADD 0x510b #define TTC_CONTROL_REG_ADD 0x4000 #define TTC_L1_LATENCY_REG_ADD 0x4006 #define TTC_L2_LATENCY_REG_ADD 0x4007 #define TTC_L1_MSG_LATENCY_REG_ADD 0x400a using namespace std; class TPCCommandCoderDB: public CommandCoderBase { public: TPCCommandCoderDB(); ~TPCCommandCoderDB(); uint32_t* getDataBlock(); int32_t createDataBlock(char* target, int tag); vector& getError(); std::string& getCoCoInfo(); int32_t getWatchDogTimeOut() { return fwatchDogTimeout; }; bool getConfigBCs() { return fConfigBCs; }; int32_t getDebugLevel() { return fLogger->getDebugLevel(); }; bool isConnected() { return fDB->isConnected(); }; void reset(); void setDebugLevel(int32_t dbl) { fLogger->setDebugLevel(dbl); }; void setConfigBCs(bool cbcs) { fConfigBCs = cbcs; }; private: int32_t strtonum(string number); RcuContainer *fDataBlock; // The Data to be sent to the FeeServer RCUCommandCoder *fRCU; // RCU Command Coder AltroCommandCoder *fALTRO; // ALTRO Command Coder BoardControllerCommandCoder *fBC; // BC Command Coder RCUControlEngine *fRCUce; // RCU Control Engine FERODBFieldPositions *fDBfp; // OracleDB *fDB; // The DB DBQueryCreator *fDBqc; // DB Query Creator Acl *fACL; // The Active Channel List (ACL, for RCU Fw V1) Afl *fAFL; // The Active Frontend List (AFL) ReadoutList *fReadoutList; // The Readout List (for RCU Fw V2) Logger *fLogger; // Logging class string fVersion; // TPC Command Coder Version string vector fError; // Error string int32_t fdbSystem; // Which DB system (P2 or RCU Lab or ...?) int32_t fwatchDogTimeout; // Timeout in seconds for the data block created bool fEnIntBA; // Flag to enable interrupt handling bool fConfigBCs; // Flag to configure FEC Board Controllers on/off bool fConfigTCparam; // Flag to enable fast configuration writes only non-zero values bool fFirstCall; // CoCo called first time? bool fBinaryFiles; // Flag to enable writing binary data to files (IMEM and RCU CFG) string fDebugFileName; // Filename for debug output string fOutputFilePath; // Path for file for config output for offline string fOutputFileNameAltro; // Filename for ALTRO config output for offline string fOutputFileNameRcu; // Filename for RCU config output for offline string fCoCoBinaryFilePath; // Path (on machine where CoCo runs) to binary files to be read by feeserver string fDcsBinaryFilePath; // Path (on DCS boards) to binary files to be read by feeserver string fImemFileName; // Filename for binary IMEM data to be read by feeserver string fRcuCfgFileName; // Filename for binary RCU CFG data to be read by feeserver ofstream *fDbOfs; // Output File Stream for Debugging information ofstream *fOfsAltro; // Output File Stream for ALTRO Config information ofstream *fOfsRcu; // Output File Stream for RCU Config information ofstream *fOfsIMEM; // Output File Stream for binary IMEM data ofstream *fOfsRcuCfg; // Output File Stream for binary IMEM data string pdbUser; // Username for connecting to DB string pdbPassword; // Password for connecting to DB string pdbConnectString; // Connect string for connecting to DB }; extern "C" { CommandCoderBase *getCoCoInst(); } #endif // TPCCOMMANDCODERDB_H