Skip to content
Snippets Groups Projects
Commit d299d44f authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

instantiate tec lib classes properly, fix byte orders in dummy

parent 935d5bf6
No related branches found
No related tags found
No related merge requests found
#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
......
#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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment