$treeview $search $mathjax $extrastylesheet
otsdaq_components
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_FrontEndFirmwareBase_h_ 00002 #define _ots_FrontEndFirmwareBase_h_ 00003 00004 #include <iostream> 00005 #include <string> 00006 #include <vector> 00007 #include "otsdaq-core/Macros/CoutMacros.h" 00008 #include "otsdaq-core/MessageFacility/MessageFacility.h" 00009 00010 namespace ots 00011 { 00012 class FrontEndFirmwareBase 00013 { 00014 public: 00015 // factory method for choosing network protocol 00016 00017 // FrontEndFirmwareBase (void){;} 00018 FrontEndFirmwareBase(unsigned int version = -1) : version_(version) { ; } 00019 virtual ~FrontEndFirmwareBase(void) { ; } 00020 virtual void init(void) { ; } 00021 00022 const unsigned int getVersion() { return version_; } 00023 00024 // These should never be called directly if used correctly, but 00025 // not all classes will implement every function (so no pure virtuals). Should be 00026 // obvious that the wrong thing is happening if these are called because exceptions 00027 // are thrown! 00028 00029 virtual std::string read(char* address) 00030 { 00031 __SS__; 00032 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00033 return ""; 00034 }; 00035 virtual void read(std::string& buffer, char* address, bool clearBuffer = true) 00036 { 00037 __SS__; 00038 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00039 return; 00040 }; 00041 virtual void read(std::string& buffer, uint64_t address, bool clearBuffer = true) 00042 { 00043 __SS__; 00044 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00045 return; 00046 }; 00047 virtual void read(std::string& buffer, uint32_t address, bool clearBuffer = true) 00048 { 00049 __SS__; 00050 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00051 return; 00052 }; 00053 00054 virtual std::string write(char* address, char* data) 00055 { 00056 __SS__; 00057 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00058 return ""; 00059 }; 00060 virtual void write(std::string& buffer, 00061 char* address, 00062 char* data, 00063 bool clearBuffer = true) 00064 { 00065 __SS__; 00066 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00067 return; 00068 }; 00069 00070 virtual void setDataDestination(std::string& buffer, 00071 const std::string& ip, 00072 const uint16_t port, 00073 bool clearBuffer = true) 00074 { 00075 __SS__; 00076 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00077 return; 00078 }; 00079 virtual void write(std::string& buffer, 00080 uint64_t address, 00081 uint64_t data, 00082 bool clearBuffer = true) 00083 { 00084 __SS__; 00085 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00086 return; 00087 }; 00088 virtual void write(std::string& buffer, 00089 uint32_t address, 00090 uint32_t data, 00091 bool clearBuffer = true) 00092 { 00093 __SS__; 00094 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00095 return; 00096 }; 00097 virtual void waitSet(std::string& buffer, 00098 uint32_t address, 00099 uint32_t data, 00100 uint32_t timeout = 255, 00101 bool clearBuffer = true) 00102 { 00103 __SS__; 00104 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00105 return; 00106 }; 00107 virtual void waitClear(std::string& buffer, 00108 uint32_t address, 00109 uint32_t data, 00110 uint32_t timeout = 255, 00111 bool clearBuffer = true) 00112 { 00113 __SS__; 00114 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00115 return; 00116 }; 00117 virtual unsigned int getNumberOfBufferedCommands(std::string& buffer) 00118 { 00119 __SS__; 00120 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00121 return 0; 00122 }; 00123 // virtual std::string compareSendAndReceive (const std::string& sentBuffer, 00124 // std::string& acknowledgment) {__SS__; __THROW__(ss.str() + 00125 // "Illegal call to undefined base class member function"); return "";}; 00126 virtual uint32_t createRegisterFromValue(std::string& readBuffer, 00127 std::string& receivedValue) 00128 { 00129 __SS__; 00130 __THROW__(ss.str() + "Illegal call to undefined base class member function"); 00131 return 0; 00132 }; 00133 // virtual uint64_t createRegisterFromValue (std::string& readBuffer, 00134 // std::string& receivedValue) {__SS__; __THROW__(ss.str() + "Illegal call to 00135 // undefined base class member function"); return 0;}; 00136 00137 // purdue firmware 00138 // virtual std::string setDataDestination (std::string ip, unsigned int 00139 // port); virtual unsigned int waitSet (std::string& buffer, 00140 // unsigned int address, unsigned int data, unsigned int timeout = 255); virtual 00141 // unsigned int waitClear (std::string& buffer, unsigned int 00142 // address, unsigned int data, unsigned int timeout = 255); virtual unsigned int 00143 // getNumberOfBufferedCommands (std::string& buffer); virtual std::string 00144 // compareSendAndReceive (const std::string& sentBuffer, std::string& 00145 // acknowledgment); virtual uint32_t createRegisterFromValue (std::string& 00146 // readBuffer, std::string& receivedValue); 00147 00148 // FSSROtsFirmware 00149 // virtual void makeDACSequence (FirmwareSequence<uint64_t>& sequence, 00150 // unsigned int channel, const ROCStream& rocStream); virtual void makeMaskSequence 00151 // (FirmwareSequence<uint64_t>& sequence, unsigned int channel, const ROCStream& 00152 // rocStream); 00153 // virtual void makeDACSequence (FirmwareSequence<uint32_t>& sequence, 00154 // unsigned int channel, const ROCStream& rocStream); virtual void makeDACBuffer 00155 // (std::string& buffer, unsigned int channel, const ROCStream& rocStream); virtual 00156 // void makeDACBuffer (std::vector<std::string>& buffer, unsigned 00157 // int channel, const ROCStream& rocStream); virtual void makeMaskSequence 00158 // (FirmwareSequence<uint32_t>& sequence, unsigned int channel, const ROCStream& 00159 // rocStream); 00160 // virtual void makeMaskBuffer (std::string& buffer, unsigned int 00161 // channel, const ROCStream& rocStream); 00162 00163 // for generic interface 00164 /*these functions have to be in FirmwareBase because the FEWOtsGenericInterface wants 00165 *to access them through a pointer to FirmwareBase. Might want to change how that 00166 *works. 00167 */ 00168 // virtual std::string readCSRRegister(void) 00169 // { 00170 // __SS__; __THROW__(ss.str() + "Illegal call to undefined base class member 00171 // function"); std::cout << __COUT_HDR_FL__ << "Something bad happened!" << 00172 // std::endl; return ""; 00173 // }; 00174 // virtual void makeDACBuffer(std::vector<std::string>& buffer, unsigned int 00175 // channel, const ROCStream& rocStream){__SS__; __THROW__(ss.str() + "Illegal call 00176 // to undefined base class member function"); return;}; virtual void 00177 // makeMaskBuffer(std::string& buffer, unsigned int channel, const ROCStream& 00178 // rocStream){__SS__; __THROW__(ss.str() + "Illegal call to undefined base class 00179 // member function"); return;}; 00180 00181 // static FrontEndFirmwareBase* getInstance(std::string choice, unsigned int version); 00182 00183 const unsigned int version_; 00184 }; 00185 } 00186 00187 #endif