mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02:00
ctb: added command 'rx_dbitreorder' that sets a flag in the receiver to set the reorder flag. By default it is 1. Setting to false means 'do not reorder' and to keep what the board spits out, which is that all signals in a sample are grouped together
This commit is contained in:
@ -218,6 +218,8 @@ int ClientInterface::functionTable(){
|
||||
flist[F_RECEIVER_SET_TRANSCEIVER_MASK] = &ClientInterface::set_transceiver_mask;
|
||||
flist[F_RECEIVER_SET_ROW] = &ClientInterface::set_row;
|
||||
flist[F_RECEIVER_SET_COLUMN] = &ClientInterface::set_column;
|
||||
flist[F_GET_RECEIVER_DBIT_REORDER] = &ClientInterface::get_dbit_reorder;
|
||||
flist[F_SET_RECEIVER_DBIT_REORDER] = &ClientInterface::set_dbit_reorder;
|
||||
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
@ -1789,4 +1791,25 @@ int ClientInterface::set_column(Interface &socket) {
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::get_dbit_reorder(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
int retval = impl()->getDbitReorder();
|
||||
LOG(logDEBUG1) << "Dbit reorder retval: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_dbit_reorder(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
if (arg < 0) {
|
||||
throw RuntimeError("Invalid dbit reorder: " + std::to_string(arg));
|
||||
}
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting Dbit offset: " << arg;
|
||||
impl()->setDbitReorder(arg);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
|
@ -164,6 +164,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_transceiver_mask(ServerInterface &socket);
|
||||
int set_row(ServerInterface &socket);
|
||||
int set_column(ServerInterface &socket);
|
||||
int get_dbit_reorder(ServerInterface &socket);
|
||||
int set_dbit_reorder(ServerInterface &socket);
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -75,10 +75,10 @@ void DataProcessor::SetCtbDbitList(std::vector<int> value) {
|
||||
ctbDbitList = value;
|
||||
}
|
||||
|
||||
void DataProcessor::SetReorder(const bool value) { reorder = value; }
|
||||
|
||||
void DataProcessor::SetCtbDbitOffset(int value) { ctbDbitOffset = value; }
|
||||
|
||||
void DataProcessor::SetCtbDbitReorder(bool value) { ctbDbitReorder = value; }
|
||||
|
||||
void DataProcessor::SetQuadEnable(bool value) { quadEnable = value; }
|
||||
|
||||
void DataProcessor::SetFlipRows(bool fd) {
|
||||
@ -556,7 +556,7 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
||||
0; // number of bytes for selected digital data given by dtbDbitList
|
||||
|
||||
// store each selected bit from all samples consecutively
|
||||
if (reorder) {
|
||||
if (ctbDbitReorder) {
|
||||
int numBitsPerDbit = numDigitalSamples; // num bits per selected digital
|
||||
// Bit for all samples
|
||||
if ((numBitsPerDbit % 8) != 0)
|
||||
@ -575,7 +575,7 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
||||
std::vector<uint8_t> result(totalNumBytes, 0);
|
||||
uint8_t *dest = &result[0];
|
||||
|
||||
if (reorder) {
|
||||
if (ctbDbitReorder) {
|
||||
// loop through digital bit enable vector
|
||||
int bitoffset = 0;
|
||||
for (auto bi : ctbDbitList) {
|
||||
|
@ -46,8 +46,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetStreamingStartFnum(uint32_t value);
|
||||
void SetFramePadding(bool enable);
|
||||
void SetCtbDbitList(std::vector<int> value);
|
||||
void SetReorder(const bool reorder);
|
||||
void SetCtbDbitOffset(int value);
|
||||
void SetCtbDbitReorder(bool value);
|
||||
void SetQuadEnable(bool value);
|
||||
void SetFlipRows(bool fd);
|
||||
void SetNumberofTotalFrames(uint64_t value);
|
||||
@ -168,8 +168,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
struct timespec timerbegin {};
|
||||
bool framePadding;
|
||||
std::vector<int> ctbDbitList;
|
||||
bool reorder{false}; // true if data should be reordered TODO: add as mode
|
||||
int ctbDbitOffset;
|
||||
int ctbDbitOffset{0};
|
||||
bool ctbDbitReorder{false};
|
||||
std::atomic<bool> startedFlag{false};
|
||||
std::atomic<uint64_t> firstIndex{0};
|
||||
bool quadEnable{false};
|
||||
|
@ -202,6 +202,7 @@ void Implementation::SetupDataProcessor(int i) {
|
||||
dataProcessor[i]->SetFramePadding(framePadding);
|
||||
dataProcessor[i]->SetCtbDbitList(ctbDbitList);
|
||||
dataProcessor[i]->SetCtbDbitOffset(ctbDbitOffset);
|
||||
dataProcessor[i]->SetCtbDbitReorder(ctbDbitReorder);
|
||||
dataProcessor[i]->SetQuadEnable(quadEnable);
|
||||
dataProcessor[i]->SetFlipRows(flipRows);
|
||||
dataProcessor[i]->SetNumberofTotalFrames(numberOfTotalFrames);
|
||||
@ -1766,6 +1767,15 @@ void Implementation::setDbitOffset(const int s) {
|
||||
LOG(logINFO) << "Dbit offset: " << ctbDbitOffset;
|
||||
}
|
||||
|
||||
bool Implementation::getDbitReorder() const { return ctbDbitReorder; }
|
||||
|
||||
void Implementation::setDbitReorder(const bool reorder) {
|
||||
ctbDbitReorder = reorder;
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetCtbDbitReorder(ctbDbitReorder);
|
||||
LOG(logINFO) << "Dbit reorder: " << ctbDbitReorder;
|
||||
}
|
||||
|
||||
uint32_t Implementation::getTransceiverEnableMask() const {
|
||||
return generalData->transceiverMask;
|
||||
}
|
||||
|
@ -252,6 +252,10 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
int getDbitOffset() const;
|
||||
/* [Ctb] */
|
||||
void setDbitOffset(const int s);
|
||||
bool getDbitReorder() const;
|
||||
/* [Ctb] */
|
||||
void setDbitReorder(const bool reorder);
|
||||
|
||||
uint32_t getTransceiverEnableMask() const;
|
||||
/* [Ctb] */
|
||||
void setTransceiverEnableMask(const uint32_t mask);
|
||||
@ -368,6 +372,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
std::vector<int64_t> rateCorrections;
|
||||
std::vector<int> ctbDbitList;
|
||||
int ctbDbitOffset{0};
|
||||
bool ctbDbitReorder{true};
|
||||
|
||||
// callbacks
|
||||
void (*startAcquisitionCallBack)(const startCallbackHeader,
|
||||
|
Reference in New Issue
Block a user