From 5a4dfd128d9dbe58c106fc39d4ddf8cd3dda03d0 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Thu, 17 Sep 2015 12:29:16 +0200 Subject: [PATCH] 10g partial_frames should also work now --- .../src/UDPStandardImplementation.cpp | 97 +++++++++++-------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 10ed49463..b0a24ebc0 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -2047,9 +2047,21 @@ int UDPStandardImplementation::startWriting(){ cprintf(GREEN,"packet %d blank frame 0x%x\n",i,(void*)(blankframe[i])); #endif } + + if(tengigaEnable){ + switch(dynamicRange){ + case 4: LAST_PACKET_VALUE = 0x10; break; + case 8: LAST_PACKET_VALUE = 0x20; break; + case 16: LAST_PACKET_VALUE = 0x40; break; + case 32: LAST_PACKET_VALUE = 0x80; break; + default: break; + } + } } + + //allow them all to be popped initially for(i=0;ipacketnum)); -//#endif +#endif }else if(numpackets[i] == EIGER_HEADER_LENGTH){ cprintf(BG_RED, "got header in writer, weirdd packetsize:%d\n",numpackets[i]); exit(-1); } -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 else { cprintf(BG_RED, "got weird in writer, weirdd packetsize:%d\n",numpackets[i]); } -//#endif +#endif if(myDetectorType == EIGER){ tofree[tofreeoffset[i]] = wbuf[i]; tofreeoffset[i]++; @@ -2126,9 +2138,9 @@ int UDPStandardImplementation::startWriting(){ //END OF ACQUISITION if(endofacquisition){ -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 cprintf(GREEN,"%d Both dummy frames\n", ithread); -//#endif +#endif //remaining packets to be written if((myDetectorType == EIGER) && ((tempoffset[0]!=0) || (tempoffset[1]!=(packetsPerFrame/numListeningThreads)))); @@ -2157,15 +2169,16 @@ int UDPStandardImplementation::startWriting(){ if(numpackets[i] == EIGER_HEADER_LENGTH) {cprintf(BG_RED,"weird, frame packet recieved\n"); exit(-1);} //dummy packet else if(!numpackets[i]){ -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 cprintf(RED, "Dummy packet: %d from fifo %d\n", numpackets[i],i); -//#endif +#endif + cout<<"packetsperframe:"<missingpacket)); exit(-1); }else -//#ifdef PADDING +#ifdef PADDING cprintf(GREEN, "blank packet i:%d pnum:%d fnum:%d missingpacket:0x%x\n",i, tempoffset[i],tempframenum[i],*( (uint16_t*) tempframe_header->missingpacket)); -//#endif +#endif tempoffset[i]++; blankoffset++; } @@ -2194,12 +2207,12 @@ int UDPStandardImplementation::startWriting(){ popready[i] = false; } } -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 else{ cprintf(RED, "WARNING: Got a weird packet size: %d from fifo %d\n", numpackets[i],i); continue; } -//#endif +#endif } @@ -2209,9 +2222,9 @@ int UDPStandardImplementation::startWriting(){ //not a full frame if(!fullframe[i]){ wbuf_footer = (eiger_packet_footer_t*)(wbuf[i] + footer_offset + HEADER_SIZE_NUM_TOT_PACKETS); -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 cprintf(GREEN,"**pnum of %d: %d\n",i,(*( (uint16_t*) wbuf_footer->packetnum))); -//#endif +#endif //update frame number tempframenum[i] =(uint32_t)(*( (uint64_t*) wbuf_footer)); @@ -2223,18 +2236,18 @@ int UDPStandardImplementation::startWriting(){ //WRONG FRAME - leave if(tempframenum[i] != presentframenum){ -//#ifdef PADDING +#ifdef PADDING cout<<"wrong packet"<packetnum)); -//#endif +#endif tempframenum[i] = presentframenum; //add missing packets numberofmissingpackets[i] = (LAST_PACKET_VALUE - lastpacketheader[i]); @@ -2257,12 +2270,12 @@ int UDPStandardImplementation::startWriting(){ (void*)(tempbuffer[tempoffset[i]])); exit(-1); }else -//#ifdef PADDING +#ifdef PADDING cprintf(GREEN, "blank packet i:%d pnum:%d fnum:%d missingpacket:0x%x add:0x%x\n", i,tempoffset[i],tempframenum[i], *( (uint16_t*) tempframe_header->missingpacket), (void*)(tempbuffer[tempoffset[i]])); -//#endif +#endif tempoffset[i] ++; blankoffset ++; } @@ -2274,12 +2287,12 @@ int UDPStandardImplementation::startWriting(){ //CORRECT FRAME - continue building frame else { -//#ifdef PADDING +#ifdef PADDING cout<<"correct packet"<packetnum); #ifdef VERYVERBOSE @@ -2308,12 +2321,12 @@ int UDPStandardImplementation::startWriting(){ (void*)(tempbuffer[tempoffset[i]])); exit(-1); }else -//#ifdef PADDING +#ifdef PADDING cprintf(GREEN, "blank packet i:%d pnum:%d fnum:%d missingpacket:0x%x add:0x%x\n", i,tempoffset[i],tempframenum[i], *( (uint16_t*) tempframe_header->missingpacket), (void*)(tempbuffer[tempoffset[i]])); -//#endif +#endif tempoffset[i] ++; blankoffset ++; } @@ -2328,31 +2341,31 @@ int UDPStandardImplementation::startWriting(){ tempbuffer[tempoffset[i]] = wbuf[i] + HEADER_SIZE_NUM_TOT_PACKETS; tempframe_header = (eiger_packet_header_t*) tempbuffer[tempoffset[i]]; tempframe_footer = (eiger_packet_footer_t*) (tempbuffer[tempoffset[i]] + footer_offset); -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 cprintf(GREEN,"**fifo:%d currentpacketheader: %d tempoffset:%d\n", i,*( (uint16_t*) tempframe_footer->packetnum),tempoffset[i]); -//#endif +#endif if(*( (uint16_t*) tempframe_footer->packetnum)!= (tempoffset[i]-(i*packetsPerFrame/numListeningThreads))+1){ cprintf(BG_RED, "pnum mismatch num4 earlier! i:%d pnum:%d pnum orig:%d fnum:%d add:0x%x\n", i,*( (uint16_t*) tempframe_footer->packetnum),*( (uint16_t*) wbuf_footer->packetnum), tempframenum[i],(void*)(tempbuffer[tempoffset[i]])); exit(-1); } -//#ifdef PADDING +#ifdef PADDING cprintf(GREEN, "normal packet i:%d pnum:%d fnum:%d missingpacket:0x%x add:0x%x\n", i,tempoffset[i],tempframenum[i], *( (uint16_t*) tempframe_header->missingpacket), (void*)(tempbuffer[tempoffset[i]])); -//#endif +#endif tempoffset[i] ++; //update last packet lastpacketheader[i] = currentpacketheader[i]; popready[i] = true; //last frame got, this will save time and also for last frames, it doesnt wait for stop receiver if(currentpacketheader[i] == LAST_PACKET_VALUE){ -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 cprintf(GREEN, "Got last packet\n"); -//#endif +#endif fullframe[i] = true; popready[i] = false; } @@ -2373,10 +2386,10 @@ int UDPStandardImplementation::startWriting(){ numMissingPackets += (numberofmissingpackets[0]+numberofmissingpackets[1]); numTotMissingPacketsInFile += numMissingPackets; numTotMissingPackets += numMissingPackets; -//#ifdef EIGER_DEBUG2 +#ifdef EIGER_DEBUG2 cprintf(GREEN,"**fnum:%d**\n",currframenum); -//#endif -//#ifdef EIGER_DEBUG3 +#endif +#ifdef EIGER_DEBUG3 if(numberofmissingpackets[0]) cprintf(RED, "fifo 0 missing packets:%d fnum:%d\n",numberofmissingpackets[0],currframenum); if(numberofmissingpackets[1]) @@ -2390,7 +2403,7 @@ int UDPStandardImplementation::startWriting(){ cprintf(RED,"found the missing packet at pnum:%d\n",j); } } -//#endif +#endif //write and copy to gui @@ -2432,14 +2445,14 @@ int UDPStandardImplementation::startWriting(){ } } -//#ifdef EIGER_DEBUG3 +#ifdef EIGER_DEBUG3 for(int i=0;ipacketnum)); } -//#endif +#endif }