00001 #ifndef _ots_FSSRPurdueFirmware_h_ 00002 #define _ots_FSSRPurdueFirmware_h_ 00003 00004 #include <string> 00005 #include "otsdaq-components/DAQHardware/FSSRFirmwareBase.h" 00006 //#include "otsdaq-components/DAQHardware/FirmwareSequence.h" 00007 //#include "otsdaq-components/DetectorConfiguration/ROCStream.h" 00008 //#include "otsdaq-components/DAQHardware/OtsUDPFirmwareCore.h" 00009 00010 namespace ots 00011 { 00012 00013 class FrontEndFirmwareBase; 00014 00015 class FSSRPurdueFirmware : public FSSRFirmwareBase 00016 { 00017 00018 public: 00019 FSSRPurdueFirmware (std::string communicationFirmwareType, unsigned int communicationFirmwareVersion = -1, unsigned int applicationFirmwareVersion = -1); 00020 virtual ~FSSRPurdueFirmware(void); 00021 virtual void init(void); 00022 00023 protected: 00024 00025 /* 00026 //FEW specific methods 00027 std::string configureClocks(std::string source, double frequency); 00028 std::string resetDetector (int channel=-1); 00029 std::string enableTrigger (void); 00030 00031 void readBurstDestinationIP(std::string& buffer); 00032 void readBurstDestinationMAC(std::string& buffer); 00033 void readBurstDestinationPort(std::string& buffer); 00034 00035 void writeBurstDestinationIP (std::string& buffer, const uint64_t value); 00036 void writeBurstDestinationMAC (std::string& buffer, const uint64_t value); 00037 void writeBurstDestinationPort(std::string& buffer, const uint64_t value); 00038 00039 00040 void makeDACSequence (FirmwareSequence<uint64_t>& sequence, unsigned int channel, const ROCStream& rocStream); 00041 void makeMaskSequence (FirmwareSequence<uint64_t>& sequence, unsigned int channel, const ROCStream& rocStream); 00042 void makeDACSequence (FirmwareSequence<uint32_t>& sequence, unsigned int channel, const ROCStream& rocStream); 00043 void makeDACBuffer (std::string& buffer, unsigned int channel, const ROCStream& rocStream); 00044 void makeDACBuffer (std::vector<std::string>& buffer, unsigned int channel, const ROCStream& rocStream); 00045 void makeMaskSequence (FirmwareSequence<uint32_t>& sequence, unsigned int channel, const ROCStream& rocStream); 00046 void makeMaskBuffer (std::string& buffer, unsigned int channel, const ROCStream& rocStream); 00047 void setFrequencyFromClockState (std::string& buffer, double frequency); 00048 bool isClockStateExternal (void); 00049 00050 //FER specific methods 00051 std::string resetBCO (void); 00052 std::string startStream (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00053 std::string stopStream (void); 00054 00055 //protected: 00056 void makeMaskSequence(FirmwareSequence<uint64_t>& sequence, unsigned int channel, const ROCStream& rocStream, const std::string& registerName); 00057 void makeMaskSequence(FirmwareSequence<uint32_t>& sequence, unsigned int channel, const ROCStream& rocStream, const std::string& registerName); 00058 void makeMaskBuffer (std::string& buffer, unsigned int channel, const ROCStream& rocStream, const std::string& registerName); 00059 00060 void setCSRRegister (uint32_t total); 00061 void writeCSRRegister (std::string& buffer); 00062 00063 uint32_t stripCSRRegisterValue_; 00064 //Set values for register STRIP_CSR (Strip Control Register) 00065 void setPacketSizeStripCSR (uint32_t size); 00066 void enableChannelsStripCSR (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00067 void setExternalBCOClockSourceStripCSR(std::string clockSource); 00068 void setHaltStripCSR (bool set); 00069 void enableBCOStripCSR (bool enable); 00070 void flushBuffersStripCSR (void); 00071 void resetTriggerCounterStripCSR (std::string& buffer); 00072 void resetBCOCounterStripCSR (void); 00073 void enableTriggerStripCSR (bool enable); 00074 void sendTriggerDataStripCSR (bool send); 00075 void sendTriggerNumberStripCSR (bool send); 00076 void sendBCOStripCSR (bool send); 00077 void enableStreamStripCSR (bool enable); 00078 void resetDCMStripCSR (bool clear); 00079 uint32_t waitDCMResetStripCSR (void); 00080 std::string readCSRRegister (void); 00081 00082 uint32_t stripResetRegisterValue_; 00083 //Set values for register STRIP_RESET (Strip Reset) 00084 void resetStripResetRegisterValue(void) 00085 { 00086 stripResetRegisterValue_ = 0; 00087 } 00088 void resetDAC (void); 00089 void resetLink (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00090 void clearErrors (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00091 void clearFIFO (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00092 void resetChip (bool channel0, bool channel1, bool channel2, bool channel3, bool channel4, bool channel5); 00093 00094 uint32_t stripBCODCMRegisterValue_; 00095 void setFrequencyRatio (std::string& buffer, int numerator, int denominator); 00096 00097 void configureStripTriggerUnbiased (std::string& buffer); 00098 void configureTriggerInputs (std::string& buffer); 00099 00100 uint32_t stripTriggerCSRRegisterValue_; 00101 //Registers setters 00102 void BCOOffset(uint32_t offset); 00103 void selectSpyFIFO(uint32_t input); 00104 void halt(bool halt); 00105 00106 00107 std::string resetSlaveBCO(void); 00108 */ 00109 }; 00110 00111 } 00112 00113 #endif