1 #ifndef _ots_FSSRFirmware_h_
2 #define _ots_FSSRFirmware_h_
7 #include "otsdaq-components/DAQHardware/FirmwareSequence.h"
8 #include "otsdaq-components/DetectorConfiguration/ROCStream.h"
47 class FrontEndFirmwareBase;
53 FSSRFirmwareBase (
const std::string& communicationFirmwareType,
unsigned int communicationFirmwareVersion = -1,
unsigned int version = -1);
57 std::string universalRead (
char* address);
58 std::string universalWrite (
char* address,
char* data);
61 uint32_t createRegisterFromValue (std::string& readBuffer, std::string& receivedValue);
64 std::string configureClocks (std::string source,
double frequency);
65 std::string resetDetector (
int channel=-1);
66 std::string enableTrigger (
void);
70 void resetDCM (std::string& buffer);
71 void alignReadOut (std::string& buffer, uint32_t value);
77 void makeDACBuffer (std::string& buffer,
unsigned int channel,
const ROCStream& rocStream);
78 void makeDACBuffer (std::vector<std::string>& buffer,
unsigned int channel,
const ROCStream& rocStream);
79 void makeMaskBuffer (std::string& buffer,
unsigned int channel,
const ROCStream& rocStream);
80 void setFrequencyFromClockState (std::string& buffer,
double frequency);
81 bool isClockStateExternal (
void);
83 std::string readFromAddress (uint64_t address);
86 std::string resetBCO (
void);
87 std::string armBCOReset (
void);
88 std::string startStream (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
89 std::string stopStream (
void);
94 void makeMaskBuffer (std::string& buffer,
unsigned int channel,
const ROCStream& rocStream,
const std::string& registerName);
96 void setCSRRegister (uint32_t total);
98 uint32_t stripCSRRegisterValue_;
100 void setPacketSizeStripCSR (uint32_t size);
101 void enableChannelsStripCSR (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
102 void setExternalBCOClockSourceStripCSR(std::string clockSource);
103 void setHaltStripCSR (
bool set);
104 void enableBCOStripCSR (
bool enable);
105 void flushBuffersStripCSR (
void);
106 void resetTriggerCounterStripCSR (std::string& buffer);
107 void resetBCOCounterStripCSR (
void);
108 void enableTriggerStripCSR (
bool enable);
109 void sendTriggerDataStripCSR (
bool send);
110 void sendTriggerNumberStripCSR (
bool send);
111 void sendBCOStripCSR (
bool send);
112 void enableStreamStripCSR (
bool enable);
113 void resetDCMStripCSR (
bool clear);
114 uint32_t waitDCMResetStripCSR (
void);
115 std::string readCSRRegister (
void);
117 std::string readSCCSRRegister (
void);
119 uint32_t stripResetRegisterValue_;
121 void resetStripResetRegisterValue(
void)
123 stripResetRegisterValue_ = 0;
125 void resetDAC (
void);
126 void resetLink (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
127 void clearErrors (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
128 void clearFIFO (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
129 void resetChip (
bool channel0,
bool channel1,
bool channel2,
bool channel3,
bool channel4,
bool channel5);
131 uint32_t stripBCODCMRegisterValue_;
132 void setFrequencyRatio (std::string& buffer,
int numerator,
int denominator);
134 void configureStripTriggerUnbiased (std::string& buffer);
135 void configureTriggerInputs (std::string& buffer);
137 uint32_t stripTriggerCSRRegisterValue_;
140 void BCOOffset (uint32_t offset);
141 void selectSpyFIFO (uint32_t input);
142 void halt (
bool halt);
145 std::string resetSlaveBCO(
void);
147 static const std::string PURDUE_FIRMWARE_NAME;
148 static const std::string OTS_FIRMWARE_NAME;
153 unsigned int version_;
154 const std::string communicationFirmwareType_;