Skip to content
Snippets Groups Projects
Commit 62ecc7ac authored by Alexander van Amesfoort's avatar Alexander van Amesfoort
Browse files

Task #8990: TBB_Writer: Use proper constant for invalid sb storage idx, and...

Task #8990: TBB_Writer: Use proper constant for invalid sb storage idx, and add some comments. No change to program logic.
parent 5bea21c0
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#define TBB_SPECTRAL_MODE 2 #define TBB_SPECTRAL_MODE 2
#define RSP_NR_SUBBANDS 512 #define RSP_NR_SUBBANDS 512
#define INVALID_SUBBAND_STORAGE_INDEX UINT_MAX
namespace LOFAR namespace LOFAR
{ {
...@@ -238,6 +239,7 @@ namespace LOFAR ...@@ -238,6 +239,7 @@ namespace LOFAR
/* /*
* Out-of-order or duplicate frames are very unlikely in the LOFAR TBB setup, * Out-of-order or duplicate frames are very unlikely in the LOFAR TBB setup,
* but let us know if it ever happens, then we will adapt this code and appendFlags(). * but let us know if it ever happens, then we will adapt this code and appendFlags().
* Update: it happens when data is dumped (incorrectly) across the frozen TBB write pointer. (TODO: deal with this one time data shift)
*/ */
if (frame.header.time < itsTime || (frame.header.time == itsTime && frame.header.sampleNr < itsExpSampleNr)) { if (frame.header.time < itsTime || (frame.header.time == itsTime && frame.header.sampleNr < itsExpSampleNr)) {
LOG_WARN_STR("TBB: Unhandled out-of-order or duplicate frame: " << LOG_WARN_STR("TBB: Unhandled out-of-order or duplicate frame: " <<
...@@ -273,7 +275,7 @@ namespace LOFAR ...@@ -273,7 +275,7 @@ namespace LOFAR
/* /*
* On a data checksum error, flag these samples. * On a data checksum error, flag these samples.
* Flag zeroed payloads too, as incredibly unlikely to be correct, but not rejected by crc32tbb. * Flag zeroed payloads too, as incredibly unlikely to be correct (unless wave generator used and set to zero amp (pointless)), but not rejected by crc32tbb.
*/ */
if (!crc32tbb(&frame.payload, frame.header.nOfSamplesPerFrame)) { if (!crc32tbb(&frame.payload, frame.header.nOfSamplesPerFrame)) {
appendFlags(offset, frame.header.nOfSamplesPerFrame); appendFlags(offset, frame.header.nOfSamplesPerFrame);
...@@ -297,6 +299,7 @@ namespace LOFAR ...@@ -297,6 +299,7 @@ namespace LOFAR
/* /*
* Out-of-order or duplicate frames are very unlikely in the LOFAR TBB setup, * Out-of-order or duplicate frames are very unlikely in the LOFAR TBB setup,
* but let us know if it ever happens, then we will adapt this code and appendFlags(). * but let us know if it ever happens, then we will adapt this code and appendFlags().
* Update: it happens when data is dumped (incorrectly) across the frozen TBB write pointer. (TODO: deal with this one time data shift)
*/ */
uint32_t sliceNr = frame.header.bandSliceNr >> TBB_SLICE_NR_SHIFT; // cannot sanitize fully: too large values indicate lost data: flag uint32_t sliceNr = frame.header.bandSliceNr >> TBB_SLICE_NR_SHIFT; // cannot sanitize fully: too large values indicate lost data: flag
if (frame.header.time < itsTime || (frame.header.time == itsTime && sliceNr < itsExpSliceNr)) { if (frame.header.time < itsTime || (frame.header.time == itsTime && sliceNr < itsExpSliceNr)) {
...@@ -329,7 +332,7 @@ namespace LOFAR ...@@ -329,7 +332,7 @@ namespace LOFAR
/* /*
* On a data checksum error, flag these samples. * On a data checksum error, flag these samples.
* Flag zeroed payloads too, as incredibly unlikely to be correct, but not rejected by crc32tbb. * Flag zeroed payloads too, as incredibly unlikely to be correct (unless wave generator used and set to zero amp (pointless)), but not rejected by crc32tbb.
* *
* TBB Design Doc states the crc32 is computed for transient data only, but it is also valid for spectral data. * TBB Design Doc states the crc32 is computed for transient data only, but it is also valid for spectral data.
* Except that it looks invalid for the first spectral frame each second, so skip checking those. // TODO: enable 'sliceNr != 0 && ' below after verifying with recent real data * Except that it looks invalid for the first spectral frame each second, so skip checking those. // TODO: enable 'sliceNr != 0 && ' below after verifying with recent real data
...@@ -595,7 +598,7 @@ namespace LOFAR ...@@ -595,7 +598,7 @@ namespace LOFAR
} }
// "Invert" tbbSubbandList, such that we can later simply lookup where to store a subband. // "Invert" tbbSubbandList, such that we can later simply lookup where to store a subband.
info.storageIndices.resize(RSP_NR_SUBBANDS, (unsigned)-1); info.storageIndices.resize(RSP_NR_SUBBANDS, INVALID_SUBBAND_STORAGE_INDEX); // TODO: check for the invalid idx at frame rx
for (unsigned i = 0; i < tbbSubbandList.size(); ++i) { for (unsigned i = 0; i < tbbSubbandList.size(); ++i) {
unsigned sbNr = tbbSubbandList[i]; unsigned sbNr = tbbSubbandList[i];
if (sbNr >= RSP_NR_SUBBANDS) { if (sbNr >= RSP_NR_SUBBANDS) {
......
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