$treeview $search $mathjax $extrastylesheet
otsdaq_components
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_PurdueFirmwareCore_h_ 00002 #define _ots_PurdueFirmwareCore_h_ 00003 00004 #include "otsdaq-components/DAQHardware/FirmwareSequence.h" 00005 #include "otsdaq-components/DAQHardware/FrontEndFirmwareBase.h" 00006 00007 #include <cstdint> 00008 #include <string> 00009 00010 namespace ots 00011 { 00012 class PurdueFirmwareCore : public FrontEndFirmwareBase 00013 { 00014 public: 00015 PurdueFirmwareCore(unsigned int version); 00016 virtual ~PurdueFirmwareCore(void); 00017 virtual void init(void); 00018 00019 std::string read(char* address); 00020 std::string write(char* address, char* data); 00021 00022 virtual void write(std::string& buffer, 00023 uint32_t address, 00024 uint32_t data, 00025 bool clearBuffer = true); 00026 virtual void waitSet(std::string& buffer, 00027 uint32_t address, 00028 uint32_t data, 00029 uint32_t timeout = 255, 00030 bool clearBuffer = true); 00031 virtual void waitClear(std::string& buffer, 00032 uint32_t address, 00033 uint32_t data, 00034 uint32_t timeout = 255, 00035 bool clearBuffer = true); 00036 virtual void read(std::string& buffer, uint32_t address, bool clearBuffer = true); 00037 00038 virtual void setDataDestination(std::string& buffer, 00039 const std::string& ip, 00040 const uint16_t port, 00041 bool clearBuffer = true); 00042 00043 /*This prevents "hidden virtual" problem, since PurdueFirmwareCore, unlike the ots 00044 * firmware only defines write/read for 32 bits. if, somehow, a 64 bit write/read gets 00045 * called, it will use the write/read in FrontEndFirmwareBase (which throws exception) 00046 */ 00047 // more: http://stackoverflow.com/questions/6727087/c-virtual-function-being-hidden 00048 00049 using FrontEndFirmwareBase::read; 00050 using FrontEndFirmwareBase::write; 00051 00052 virtual unsigned int getNumberOfBufferedCommands(std::string& buffer); 00053 virtual std::string compareSendAndReceive(const std::string& sentBuffer, 00054 std::string& acknowledgment); 00055 virtual uint32_t createRegisterFromValue(std::string& readBuffer, 00056 std::string& receivedValue); 00057 00058 protected: 00059 // FrontEndFirmwareBase* protocolInstance_; 00060 }; 00061 } 00062 00063 #endif