Skip to content
Snippets Groups Projects
Commit 58c445e7 authored by wierenga's avatar wierenga
Browse files

BugID: 708

Move expected result definition to RCUProtocolWrite.cc.
parent 5c787fb5
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
#include "StationSettings.h" #include "StationSettings.h"
#include "RCUProtocolWrite.h"
#include "RCUResultRead.h" #include "RCUResultRead.h"
#include "Cache.h" #include "Cache.h"
...@@ -37,22 +38,10 @@ using namespace LOFAR; ...@@ -37,22 +38,10 @@ using namespace LOFAR;
using namespace RSP; using namespace RSP;
using namespace EPA_Protocol; using namespace EPA_Protocol;
#define RESULT_DELAY_PERIOD 2
namespace LOFAR {
namespace RSP {
// construct expected i2c result
static uint8 i2c_result[] = { 0x00, // PROTOCOL_C_SEND_BLOCK OK
0xFF, // <<< replace with expected data >>>
0xFF, // <<< replace with expected data >>>
0xFF, // <<< replace with expected data >>>
0x00, // PROTOCOL_C_RECEIVE_BLOCK OK
0x00, // PROTOCOL_C_END OK
};
};
};
RCUResultRead::RCUResultRead(GCFPortInterface& board_port, int board_id) RCUResultRead::RCUResultRead(GCFPortInterface& board_port, int board_id)
: SyncAction(board_port, board_id, StationSettings::instance()->nrBlpsPerBoard() * MEPHeader::N_POL), m_delay(0) // *N_POL for X and Y : SyncAction(board_port, board_id, StationSettings::instance()->nrBlpsPerBoard() * MEPHeader::N_POL) // *N_POL for X and Y
{ {
memset(&m_hdr, 0, sizeof(MEPHeader)); memset(&m_hdr, 0, sizeof(MEPHeader));
} }
...@@ -73,23 +62,16 @@ void RCUResultRead::sendrequest() ...@@ -73,23 +62,16 @@ void RCUResultRead::sendrequest()
return; return;
} }
// delay 4 periods
if (m_delay++ < 4) {
setContinue(true);
return;
}
m_delay = 0;
// set appropriate header // set appropriate header
MEPHeader::FieldsType hdr; MEPHeader::FieldsType hdr;
if (0 == global_rcu % 2) { if (0 == global_rcu % MEPHeader::N_POL) {
hdr = MEPHeader::RCU_RESULTX_HDR; hdr = MEPHeader::RCU_RESULTX_HDR;
} else { } else {
hdr = MEPHeader::RCU_RESULTY_HDR; hdr = MEPHeader::RCU_RESULTY_HDR;
} }
EPAReadEvent rcuresult; EPAReadEvent rcuresult;
rcuresult.hdr.set(hdr, 1 << (getCurrentIndex() / MEPHeader::N_POL), MEPHeader::READ, sizeof(i2c_result)); rcuresult.hdr.set(hdr, 1 << (getCurrentIndex() / MEPHeader::N_POL), MEPHeader::READ, sizeof(RCUProtocolWrite::i2c_result));
m_hdr = rcuresult.hdr; // remember header to match with ack m_hdr = rcuresult.hdr; // remember header to match with ack
getBoardPort().send(rcuresult); getBoardPort().send(rcuresult);
...@@ -121,9 +103,9 @@ GCFEvent::TResult RCUResultRead::handleack(GCFEvent& event, GCFPortInterface& /* ...@@ -121,9 +103,9 @@ GCFEvent::TResult RCUResultRead::handleack(GCFEvent& event, GCFPortInterface& /*
// reverse and copy control bytes into i2c_result // reverse and copy control bytes into i2c_result
RCUSettings::Control& rcucontrol = Cache::getInstance().getBack().getRCUSettings()()((global_rcu)); RCUSettings::Control& rcucontrol = Cache::getInstance().getBack().getRCUSettings()()((global_rcu));
uint32 control = htonl(rcucontrol.getRaw()); uint32 control = htonl(rcucontrol.getRaw());
memcpy(i2c_result + 1, &control, 3); memcpy(RCUProtocolWrite::i2c_result + 1, &control, 3);
if (0 == memcmp(i2c_result, ack.result, sizeof(i2c_result))) { if (0 == memcmp(RCUProtocolWrite::i2c_result, ack.result, sizeof(RCUProtocolWrite::i2c_result))) {
Cache::getInstance().getRCUProtocolState().confirmed(global_rcu); Cache::getInstance().getRCUProtocolState().confirmed(global_rcu);
} else { } else {
LOG_ERROR("RCUResultRead::handleack: unexpected I2C result response"); LOG_ERROR("RCUResultRead::handleack: unexpected I2C result response");
......
...@@ -60,7 +60,6 @@ namespace LOFAR { ...@@ -60,7 +60,6 @@ namespace LOFAR {
private: private:
EPA_Protocol::MEPHeader m_hdr; EPA_Protocol::MEPHeader m_hdr;
int m_delay; // used to delay reading back results
}; };
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment