@@ -204,7 +204,6 @@ class ProgramDmaBench : public Program
204204 options.add_options ()(" no-tf-check" ,
205205 po::bool_switch (&mOptions .noTimeFrameCheck ),
206206 " Skip error checking" );
207-
208207 }
209208
210209 virtual void run (const po::variables_map& map)
@@ -308,7 +307,6 @@ class ProgramDmaBench : public Program
308307 mTimeFrameCheckEnabled = false ;
309308 std::cout << " TimeFrame check disabled" << std::endl;
310309 }
311-
312310 }
313311
314312 // Get DMA channel object
@@ -601,19 +599,8 @@ class ProgramDmaBench : public Program
601599 {
602600 size_t pageSize = (mDataSource == DataSource::Internal) ? mPageSize : DataFormat::getOffset (reinterpret_cast <const char *>(pageAddress));
603601
604- bool isEmpty = false ;
605- if (pageSize != mPageSize ) {
606- pageSize = mPageSize ;
607- isEmpty = true ;
608- // write to file
609- uint32_t emptySP = 0x0badf00d ;
610- for (int i = 0 ; i < 4 ; i++) { // Marker is 128bits long
611- mReadoutStream .write (reinterpret_cast <const char *>(&emptySP), sizeof (emptySP));
612- }
613- }
614-
615602 // Read out to file
616- printToFile (pageAddress, pageSize, readoutCount, superpageCount, atStartOfSuperpage, isEmpty );
603+ printToFile (pageAddress, pageSize, readoutCount, superpageCount, atStartOfSuperpage, pageSize == 0 );
617604
618605 // Data error checking
619606 if (!mOptions .noErrorCheck ) {
@@ -732,7 +719,7 @@ class ProgramDmaBench : public Program
732719 if (mPacketCounters [linkId] == PACKET_COUNTER_INITIAL_VALUE) {
733720 if (mErrorCount < MAX_RECORDED_ERRORS) {
734721 mErrorStream << b::format (" resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n " ) % eventNumber % linkId % packetCounter %
735- mPacketCounters [linkId] % mEventCounters [linkId];
722+ mPacketCounters [linkId] % mEventCounters [linkId];
736723 }
737724 mPacketCounters [linkId] = packetCounter;
738725 } else if (((mPacketCounters [linkId] + mErrorCheckFrequency ) % (mMaxRdhPacketCounter + 1 )) != packetCounter) { // packetCounter is 8bits long
@@ -863,7 +850,7 @@ class ProgramDmaBench : public Program
863850 if (mPacketCounters [linkId] == PACKET_COUNTER_INITIAL_VALUE) {
864851 if (mErrorCount < MAX_RECORDED_ERRORS) {
865852 mErrorStream << b::format (" resync packet counter for e%d l:%d packet_cnt:%x mpacket_cnt:%x, le:%d \n " ) % eventNumber % linkId % packetCounter %
866- mPacketCounters [linkId] % mEventCounters [linkId];
853+ mPacketCounters [linkId] % mEventCounters [linkId];
867854 }
868855 mPacketCounters [linkId] = packetCounter;
869856 } else if (((mPacketCounters [linkId] + mErrorCheckFrequency ) % (mMaxRdhPacketCounter + 1 )) != packetCounter) {
@@ -1054,8 +1041,7 @@ class ProgramDmaBench : public Program
10541041 if (atStartOfSuperpage && mOptions .printSuperpageChange ) {
10551042 mReadoutStream << " Superpage #" << std::hex << " 0x" << superpageNumber << ' \n ' ;
10561043 }
1057- // TODO: for debugging: maybe add an option here?
1058- if (isEmpty) {
1044+ if (isEmpty && mOptions .printSuperpageChange ) {
10591045 mReadoutStream << " !!EMPTY DMA PAGE!!\n " ;
10601046 }
10611047 mReadoutStream << " Event #" << std::hex << " 0x" << pageNumber << ' \n ' ;
@@ -1070,19 +1056,19 @@ class ProgramDmaBench : public Program
10701056 }
10711057 mReadoutStream << ' \n ' ;
10721058 } else if (mOptions .fileOutputBin ) {
1073- // TODO: for debugging
1074- if (isEmpty) {
1075- uint32_t emptySP = 0xdeadbeef ;
1076- for (int i = 0 ; i < 4 ; i++) { // Marker is 128bits long
1077- mReadoutStream .write (reinterpret_cast <const char *>(&emptySP), sizeof (emptySP));
1078- }
1079- }
10801059 if (atStartOfSuperpage && mOptions .printSuperpageChange ) {
10811060 uint32_t newSP = 0x0badf00d ;
10821061 for (int i = 0 ; i < 4 ; i++) { // Marker is 128bits long
10831062 mReadoutStream .write (reinterpret_cast <const char *>(&newSP), sizeof (newSP));
10841063 }
10851064 }
1065+ if (isEmpty && mOptions .printSuperpageChange ) {
1066+ uint32_t emptySP = 0xdeadbeef ;
1067+ for (int i = 0 ; i < 4 ; i++) { // Marker is 128bits long
1068+ mReadoutStream .write (reinterpret_cast <const char *>(&emptySP), sizeof (emptySP));
1069+ }
1070+ }
1071+
10861072 // TODO Is there a more elegant way to write from volatile memory?
10871073 mReadoutStream .write (reinterpret_cast <const char *>(pageAddress), pageSize);
10881074 }
0 commit comments