1. Ctb transceiver ro (#773)

*  transceiverenable, tsamples, romode for tranceiver and digital_transceiver

* 202 spec instr only for transceiver mode

* removed check for empty in trans readout and clean memory before reading from fifo

* ctb read fifo strobe for all after reading all channels, adding 1us after selecting channel, changing fw date

* updated 10gb transceiver enable

----
* added transceiver (tsamples, romode(transceiver, digital_transceiver), transceiverenable (mask)

* clean memory before reading from fifo (for analog and digital as well)

* read fifo then read strobe (also corresp fw) fixes number of reads (also for analg and digital)-> increases all pipelines by 1

* fixed bug in rearranging digital data in receiver

* fixed bug in streaming size of data after rearranging

* fixed bug in setbit, clearbit,and getbit

* status checks fifo before returning idle (transmitting if data in fifo if transceiver more enabled)

* soem matterhorn specifics that will need to be put into pattern in a month or two. this is temporary.

* NOTE: breaking api. rxParameters struct has transceiverenabel and tsamples given from det to receiver
This commit is contained in:
2023-07-14 16:29:21 +02:00
committed by GitHub
parent a56be25500
commit c628ae2192
30 changed files with 1118 additions and 238 deletions

View File

@ -496,8 +496,10 @@ void DataProcessor::PadMissingPackets(sls_receiver_header header, char *data) {
/** ctb specific */
void DataProcessor::RearrangeDbitData(size_t &size, char *data) {
int nAnalogDataBytes = generalData->GetNumberOfAnalogDatabytes();
int nDigitalDataBytes = generalData->GetNumberOfDigitalDatabytes();
int nTransceiverDataBytes = generalData->GetNumberOfTransceiverDatabytes();
// TODO! (Erik) Refactor and add tests
int ctbDigitalDataBytes = size - nAnalogDataBytes - ctbDbitOffset;
int ctbDigitalDataBytes = nDigitalDataBytes - ctbDbitOffset;
// no digital data
if (ctbDigitalDataBytes == 0) {
@ -506,11 +508,15 @@ void DataProcessor::RearrangeDbitData(size_t &size, char *data) {
return;
}
const int numSamples = (ctbDigitalDataBytes / sizeof(uint64_t));
const int numDigitalSamples = (ctbDigitalDataBytes / sizeof(uint64_t));
// ceil as numResult8Bits could be decimal
const int numResult8Bits = ceil((numSamples * ctbDbitList.size()) / 8.00);
std::vector<uint8_t> result(numResult8Bits);
// const int numResult8Bits = ceil((numDigitalSamples * ctbDbitList.size())
// / 8.00);
int numBitsPerDbit = numDigitalSamples;
if ((numBitsPerDbit % 8) != 0)
numBitsPerDbit += (8 - (numDigitalSamples % 8));
const int totalNumBytes = (numBitsPerDbit / 8) * ctbDbitList.size();
std::vector<uint8_t> result(totalNumBytes);
uint8_t *dest = &result[0];
auto *source = (uint64_t *)(data + nAnalogDataBytes + ctbDbitOffset);
@ -518,14 +524,14 @@ void DataProcessor::RearrangeDbitData(size_t &size, char *data) {
// loop through digital bit enable vector
int bitoffset = 0;
for (auto bi : ctbDbitList) {
// where numbits * numsamples is not a multiple of 8
// where numbits * numDigitalSamples is not a multiple of 8
if (bitoffset != 0) {
bitoffset = 0;
++dest;
}
// loop through the frame digital data
for (auto *ptr = source; ptr < (source + numSamples);) {
for (auto *ptr = source; ptr < (source + numDigitalSamples);) {
// get selected bit from each 8 bit
uint8_t bit = (*ptr++ >> bi) & 1;
*dest |= bit << bitoffset;
@ -540,8 +546,14 @@ void DataProcessor::RearrangeDbitData(size_t &size, char *data) {
// copy back to memory and update size
memcpy(data + nAnalogDataBytes, result.data(),
numResult8Bits * sizeof(uint8_t));
size = numResult8Bits * sizeof(uint8_t) + nAnalogDataBytes + ctbDbitOffset;
totalNumBytes * sizeof(uint8_t));
size = totalNumBytes * sizeof(uint8_t) + nAnalogDataBytes + ctbDbitOffset +
nTransceiverDataBytes;
LOG(logDEBUG1) << "totalNumBytes: " << totalNumBytes
<< " nAnalogDataBytes:" << nAnalogDataBytes
<< " ctbDbitOffset:" << ctbDbitOffset
<< " nTransceiverDataBytes:" << nTransceiverDataBytes
<< " size:" << size;
}
void DataProcessor::CropImage(size_t &size, char *data) {