otsdaq_components  v2_02_00
PurdueFirmwareCore.h
1 #ifndef _ots_PurdueFirmwareCore_h_
2 #define _ots_PurdueFirmwareCore_h_
3 
4 #include "otsdaq-components/DAQHardware/FirmwareSequence.h"
5 #include "otsdaq-components/DAQHardware/FrontEndFirmwareBase.h"
6 
7 #include <string>
8 #include <cstdint>
9 
10 namespace ots
11 {
13 {
14 
15 public:
16  PurdueFirmwareCore (unsigned int version);
17  virtual ~PurdueFirmwareCore (void);
18  virtual void init (void);
19 
20 
21  std::string read (char* address);
22  std::string write (char* address, char* data);
23 
24  virtual void write (std::string& buffer, uint32_t address, uint32_t data, bool clearBuffer=true);
25  virtual void waitSet (std::string& buffer, uint32_t address, uint32_t data, uint32_t timeout = 255, bool clearBuffer=true);
26  virtual void waitClear (std::string& buffer, uint32_t address, uint32_t data, uint32_t timeout = 255, bool clearBuffer=true);
27  virtual void read (std::string& buffer, uint32_t address, bool clearBuffer=true);
28 
29  virtual void setDataDestination (std::string& buffer, const std::string& ip, const uint16_t port, bool clearBuffer=true);
30 
31  /*This prevents "hidden virtual" problem, since PurdueFirmwareCore, unlike the ots firmware
32  * only defines write/read for 32 bits. if, somehow, a 64 bit write/read gets called, it will
33  * use the write/read in FrontEndFirmwareBase (which throws exception) */
34  //more: http://stackoverflow.com/questions/6727087/c-virtual-function-being-hidden
35 
36  using FrontEndFirmwareBase::write;
37  using FrontEndFirmwareBase::read;
38 
39  virtual unsigned int getNumberOfBufferedCommands (std::string& buffer);
40  virtual std::string compareSendAndReceive (const std::string& sentBuffer, std::string& acknowledgment);
41  virtual uint32_t createRegisterFromValue (std::string& readBuffer, std::string& receivedValue);
42 protected:
43  //FrontEndFirmwareBase* protocolInstance_;
44 };
45 
46 }
47 
48 #endif