diff --git a/modules/src/TecModule.cc b/modules/src/TecModule.cc index b48f181e69867d822fa27f66f9badf2bef843486..5626b177601c84e6f161d00235a52caa4837dbac 100644 --- a/modules/src/TecModule.cc +++ b/modules/src/TecModule.cc @@ -1,6 +1,7 @@ #include "TecModule.h" #include "TecParameters.h" #include <tec/TecChimeraInterface.h> +#include <tec/TecController.h> /**********************************************************************************************************************/ @@ -24,7 +25,29 @@ TecModule::TecModule(EntityOwner* owner, const std::string& name, const std::str void TecModule::mainLoop() { std::cout << "Processing TecModule::mainLoop()" << std::endl; - TecChimeraInterface tec{triggerCommands, responseStatus, commandMemoryRaw, true}; + auto tecIface = std::make_shared<TecChimeraInterface>( + triggerCommands, responseStatus, commandMemoryRaw_wr, commandMemoryRaw_rd, true); + TecController tec{tecIface}; + tec.addFrame(0, TecFrame::TecParameter::ExpFanControlEnable, TecFrame::TecFrameType::TecParameterValueSet, 1); + std::cout << "constructAllFrames:" << std::endl; + tec.constructAllFrames(); + for(uint8_t i = 0; i < tec.getFrameCount(); i++) { + tec.getFrameAt(i)->print(); + } + std::cout << "copyCommandsToHardware:" << std::endl; + tec.copyCommandsToHardware(); + std::cout << "triggerHardwareCommands:" << std::endl; + tec.triggerHardwareCommands(); + std::cout << "readHardwareResponses:" << std::endl; + tec.readHardwareResponses(); + std::cout << "copyResponsesFromHardware:" << std::endl; + tec.copyResponsesFromHardware(); + std::cout << "parseAllFrames:" << std::endl; + tec.parseAllFrames(); + for(uint8_t i = 0; i < tec.getFrameCount(); i++) { + tec.getFrameAt(i)->print(); + } + std::cout << "done." << std::endl; // Here the group maps need to be filled by iterating the descriptor list and obtaining the corresponding inputs from // the groupCommandMap diff --git a/tests/src/TecDummy.cc b/tests/src/TecDummy.cc index 19565eabc66af507c14f8c461d8d3061683b3c6d..ff510a9f7a9a193b69052285d3ca9f346aa3c973 100644 --- a/tests/src/TecDummy.cc +++ b/tests/src/TecDummy.cc @@ -1,4 +1,5 @@ #include "TecDummy.h" +#include <arpa/inet.h> TecDummy::BackendRegisterer TecDummy::backendRegisterer; @@ -12,15 +13,19 @@ TecDummy::BackendRegisterer::BackendRegisterer() { /*********************************************************************************************************************/ void TecDummy::read(uint8_t bar, uint32_t address, int32_t* data, size_t sizeInBytes) { + std::cout << "HIER0" << std::endl; DummyBackend::read(bar, address, data, sizeInBytes); + std::cout << "HIER1" << std::endl; if(bar != TecDummy_bar || address != TecDummy_address_loopDone) return; + std::cout << "HIER2" << std::endl; if(reg_loopStart != 1) return; + std::cout << "HIER3" << std::endl; // convert command into string // FIXME: this can be done better if the DummyRegisterRawAccessor would allow us to use the raw pointer to this... std::string commandString(reg_command.getNumberOfElements() * 4, 0); for(size_t i = 0; i < reg_command.getNumberOfElements(); ++i) { - uint32_t word = reg_command[i]; + uint32_t word = ntohl(reg_command[i]); std::memcpy(&(commandString[4 * i]), &word, 4); } @@ -31,7 +36,7 @@ void TecDummy::read(uint8_t bar, uint32_t address, int32_t* data, size_t sizeInB for(size_t i = 0; i < reply.length(); ++i) { uint32_t word; std::memcpy(&word, &(reply[4 * i]), 4); - reg_command[i] = word; + reg_command[i] = htonl(word); } reg_loopDone = 1;