/* ===================================================================== * Container for the Altro/Channel data block. * We assume RCU Firmware V2. The structure is: * * 1) FEE_CONFIGURE for ALTRO or Channel block, parameter = number of words (235+1+9). * 2) HW_Address * 3) Checksum * * 4) RCU_WRITE_INSTRUCTION, parameter = number of words * * 5) Payload: Up to 4096 words for Rcu Fw v2; config data for several ALTROs * * 6) CE_CMD_TAILER - End of RCU_WRITE_INSTRUCTION * * 7) RCU_EXEC * 8) CE_CMD_TAILER - End of RCU_EXEC * * 9) FEE_VERIFICATION (ALTRO or Channel Block) * 10) CE_CMD_TAILER - End of FEE_VERIFICATION * * 11) FEE_CONFIGURE_END - End of FEE_CONFIGURE (ALTRO or Channel Block) * 12) HW_Address, same as above * 13) CE_CMD_TAILER - End of FEE_CONFIGURE_END * * 14) CE_CMD_TAILER - End of FEE_CONFIGURE (ALTRO or Channel Block) * ===================================================================== */ /* * Author: C. Lippmann, Christian.Lippmann@cern.ch */ #ifndef ALTROCONTAINER_H #define ALTROCONTAINER_H #include #include "../CommandCoder/RCUCommandCoder.h" #include "../CommandCoder/RCUControlEngine.h" #include "../CentralHeaders/TpcException.h" using namespace std; //=========================================================================== // Instruction Memory Container base class //=========================================================================== class InstructionMemoryContainer { public: InstructionMemoryContainer(); InstructionMemoryContainer(uint32_t hardwareAddress); virtual ~InstructionMemoryContainer() { }; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Warning: Final size is only available after getDataBlock() was called!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! uint32_t size() { return fPayload.size(); } vector::iterator begin() { return fPayload.begin(); } vector::iterator end() { return fPayload.end(); } uint32_t getHardwareAddress() { return fHardwareAddress; }; uint32_t getCheckSum() { return fCheckSum; }; bool getVerification() { return fVerif; }; bool getReadResult() { return fRead; }; virtual void setReadResult(bool read) { fRead = read; }; virtual void setHardwareAddress(uint32_t hardwareAddress); virtual void setVerification(bool verif); virtual void reset(); virtual bool empty(); virtual void fill(uint32_t data); virtual void fill(uint64_t data); virtual void finalize(); virtual uint32_t* getDataBlock(); protected: void calculateCheckSum(); vector fPayload; // The Data RCUControlEngine fRCUce; // RCUControlEngine RCUCommandCoder fRCU; // RCUCommandCoder uint32_t fDeviceType; // 3 for Altro, 4 for Channel uint32_t fCheckSum; uint32_t fHardwareAddress; uint32_t fConfigId; uint32_t fMaxSize; // Maximum size for data (Imem size) bool fVerif; bool fRead; }; //=========================================================================== // Channel Container derived class //=========================================================================== class ChannelContainer : public InstructionMemoryContainer { public: ChannelContainer(); ChannelContainer(uint32_t hardwareAddress); ~ChannelContainer() { }; private: }; //=========================================================================== // Altro Container derived class //=========================================================================== class AltroContainer : public InstructionMemoryContainer { public: AltroContainer(); AltroContainer(uint32_t hardwareAddress); ~AltroContainer() { }; void reset(); bool empty(); void finalize(); uint32_t* getDataBlock(); bool getReadResult() { return fRead; }; bool getAltroInstructionStore() { return fStore; }; void setReadResult(bool read) { fRead = read; }; void setAltroInstructionStore(bool store = true); private: bool fStore; bool fRead; }; #endif // ALTROCONTAINER_H