1 #ifndef _ots_OtsUDPFirmwareCore_h_
2 #define _ots_OtsUDPFirmwareCore_h_
5 #include "otsdaq-components/DAQHardware/FrontEndFirmwareBase.h"
32 virtual void init (
void);
39 virtual std::string write (
char* address,
char* data);
40 virtual void write (std::string& buffer,
char* address,
char* data,
bool clearBuffer=
true);
41 virtual void write (std::string& buffer, uint32_t address, uint32_t data,
bool clearBuffer=
true);
42 virtual void write (std::string& buffer, uint64_t address, uint64_t data,
bool clearBuffer=
true);
43 virtual void waitClear (std::string& buffer, uint32_t address, uint32_t data, uint32_t timeout = 255,
bool clearBuffer=
true){}
45 virtual std::string read (
char* address);
46 virtual void read (std::string& buffer,
char* address,
bool clearBuffer=
true);
47 virtual void read (std::string& buffer, uint64_t address,
bool clearBuffer=
true);
48 virtual void read (std::string& buffer, uint32_t address,
bool clearBuffer=
true);
51 virtual void setDataDestination (std::string& buffer,
const std::string& ip,
const uint16_t port,
bool clearBuffer=
true);
53 virtual uint32_t createRegisterFromValue (std::string& readBuffer, std::string& receivedValue);
56 void writeAdvanced (std::string& buffer,
const char* address,
const char* data, uint8_t size = 1, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
57 void writeAdvanced (std::string& buffer,
const uint64_t& address,
const char* data, uint8_t size, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
58 void writeAdvanced (std::string& buffer,
const uint64_t& address,
const uint64_t& data, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
59 void writeAdvanced (std::string& buffer,
const uint64_t& address,
const std::vector<uint64_t>& data, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
60 void readAdvanced (std::string& buffer,
char* address, uint8_t size = 1, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
61 void readAdvanced (std::string& buffer,
const uint64_t& address, uint8_t size = 1, uint8_t commandTypeOptions = 0,
bool clearBuffer=
true);
67 void writeDataDestinationIP (std::string& buffer,
const uint64_t value,
bool clearBuffer=
true);
68 void writeDataDestinationMAC (std::string& buffer,
const uint64_t value,
bool clearBuffer=
true);
69 void writeDataDestinationPort (std::string& buffer,
const uint64_t value,
bool clearBuffer=
true);
71 void readDataDestinationIP (std::string& buffer);
72 void readDataDestinationMAC (std::string& buffer);
73 void readDataDestinationPort (std::string& buffer);
75 void setDataDestinationAsSelf (std::string& buffer) { buffer.resize(0); buffer += (char)2; }
79 virtual void setControlDestination (std::string& buffer,
const std::string& ip,
const uint16_t port);
81 void writeControlDestinationIP (std::string& buffer,
const uint64_t value);
82 void writeControlDestinationMAC (std::string& buffer,
const uint64_t value);
83 void writeControlDestinationPort (std::string& buffer,
const uint64_t value);
85 void readControlDestinationIP (std::string& buffer);
86 void readControlDestinationMAC (std::string& buffer);
87 void readControlDestinationPort (std::string& buffer);
89 void setControlDestinationAsSelf (std::string& buffer) { buffer.resize(0); buffer += (char)1; }
92 void UDPFirmwareSpecialPing (std::string& buffer) { buffer.resize(0); buffer += (char)0; }
93 void UDPFirmwareSpecialNoOp (std::string& buffer) { buffer.resize(0); buffer += (char)3; }
95 void readUDPFirmwareVersion (std::string& buffer);
96 void softEthernetReset (std::string& buffer);
97 void hardEthernetReset (std::string& buffer);
98 void clearEthernetReset (std::string& buffer);
100 void startBurst (std::string& buffer);
101 void stopBurst (std::string& buffer);
104 static const uint8_t FIFO_ADDRESS_CMD_TYPE;