@@ -737,16 +737,24 @@ class ProgramDmaBench : public Program
737737
738738 // check that the TimeFrame starts at the beginning of the superpage
739739 const auto triggerType = DataFormat::getTriggerType (reinterpret_cast <const char *>(pageAddress));
740- const auto pagesCounter = DataFormat::getPagesCounter (reinterpret_cast <const char *>(pageAddress));
740+ const auto orbit = DataFormat::getOrbit (reinterpret_cast <const char *>(pageAddress));
741+ // const auto pagesCounter = DataFormat::getPagesCounter(reinterpret_cast<const char*>(pageAddress));
741742
742- if (Utilities::getBit (triggerType, 11 ) == 0x1 &&
743- pagesCounter == 0x0 &&
744- !atStartOfSuperpage) {
745- // log TF not at the beginning of the superpage error
746- mErrorCount ++;
747- if (mErrorCount < MAX_RECORDED_ERRORS) {
748- mErrorStream << b::format (" [RDHERR]\t event:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% mpacket_cnt:%6% levent:%7% TF unaligned w/ start of superpage\n " ) % eventNumber % linkId % memBytes % pageSize % packetCounter % mPacketCounters [linkId] % mEventCounters [linkId];
743+ // std::cout << atStartOfSuperpage << " 0x" << std::hex << orbit << " 0x" << std::hex << mNextTFOrbit << std::endl;
744+
745+ if (Utilities::getBit (triggerType, 9 ) == 0x1 || Utilities::getBit (triggerType, 7 ) == 0x1 ) { // If SOX, use current orbit as the first one
746+ mNextTFOrbit = (orbit + mTimeFrameLength ) % (0x100000000 );
747+ } else if (orbit >= mNextTFOrbit ) {
748+ // next orbit should be previous orbit + time frame length
749+ if (!atStartOfSuperpage) {
750+ // log TF not at the beginning of the superpage error
751+ mErrorCount ++;
752+ if (mErrorCount < MAX_RECORDED_ERRORS) {
753+ mErrorStream << b::format (" [RDHERR]\t event:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% orbit:%6$#x nextTForbit:%7$#x atSPStart:%8% TF unaligned w/ start of superpage\n " ) % eventNumber % linkId % memBytes % pageSize % packetCounter % orbit % mNextTFOrbit % atStartOfSuperpage;
754+ }
749755 }
756+ // Update next TF orbit expected
757+ mNextTFOrbit = (orbit + mTimeFrameLength ) % (0x100000000 );
750758 }
751759
752760 // Skip data check if fast check enabled or FEE data source selected
@@ -854,8 +862,7 @@ class ProgramDmaBench : public Program
854862 }
855863 }
856864 // Update next TF orbit expected
857- mNextTFOrbit = (orbit / mTimeFrameLength ) * (mTimeFrameLength + 1 );
858- // std::cout << mNextTFOrbit << std::endl;
865+ mNextTFOrbit = (orbit + mTimeFrameLength ) % (0x100000000 );
859866 }
860867
861868 if (mFastCheckEnabled ) {
0 commit comments