mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
bug fixxed for 10g writing filter, still debug mode
This commit is contained in:
parent
1b471bc675
commit
b3012acea2
@ -2092,18 +2092,18 @@ int UDPStandardImplementation::startWriting(){
|
||||
//dont pop again if dummy packet
|
||||
else if(numpackets[i] == 0){
|
||||
popready[i] = false;
|
||||
#ifdef EIGER_DEBUG3
|
||||
//#ifdef EIGER_DEBUG3
|
||||
cprintf(GREEN,"%d Dummy frame popped out of fifo %d",ithread, i);
|
||||
#endif
|
||||
//#endif
|
||||
}else{
|
||||
endofacquisition = false;
|
||||
if(numpackets[i] == bufferSize){;
|
||||
#ifdef EIGER_DEBUG3
|
||||
if(numpackets[i] == onePacketSize){;
|
||||
//#ifdef EIGER_DEBUG3
|
||||
wbuf_footer = (eiger_packet_footer_t*)(wbuf[i] + footer_offset + HEADER_SIZE_NUM_TOT_PACKETS);
|
||||
//cprintf(BLUE,"footer value:0x%x\n",i,(uint64_t)(*( (uint64_t*) wbuf_footer)));
|
||||
cprintf(BLUE,"tempframenum[%d]:%d\n",i,(uint32_t)(*( (uint64_t*) wbuf_footer)));
|
||||
cprintf(BLUE,"packetnum[%d]:%d\n",i,*( (uint16_t*) wbuf_footer->packetnum));
|
||||
#endif
|
||||
//#endif
|
||||
}else if(numpackets[i] == EIGER_HEADER_LENGTH){
|
||||
cprintf(BG_RED, "got header in writer, weirdd packetsize:%d\n",numpackets[i]);
|
||||
exit(-1);
|
||||
@ -2126,9 +2126,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 +2157,15 @@ 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<<"tempoffset["<<i<<"]:"<<tempoffset[i]<<" checking against:"<<(((i+1)*packetsPerFrame/numListeningThreads))<<endl;
|
||||
//cannot check for full frame as it will be false if its done with all packets OR waiting for packets
|
||||
if(tempoffset[i]!= (((i+1)*packetsPerFrame/numListeningThreads))){
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
cprintf(RED, "Dummy packet: Adding missing packets\n");
|
||||
#endif
|
||||
//#endif
|
||||
//add missing packets
|
||||
numberofmissingpackets[i] = (LAST_PACKET_VALUE - lastpacketheader[i]);
|
||||
//to decrement from packetsInFile to calculate packet loss
|
||||
@ -2182,10 +2182,10 @@ int UDPStandardImplementation::startWriting(){
|
||||
*( (uint16_t*) blankframe_header->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++;
|
||||
}
|
||||
@ -2209,9 +2209,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 +2223,18 @@ int UDPStandardImplementation::startWriting(){
|
||||
|
||||
//WRONG FRAME - leave
|
||||
if(tempframenum[i] != presentframenum){
|
||||
#ifdef PADDING
|
||||
//#ifdef PADDING
|
||||
cout<<"wrong packet"<<endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#ifdef EIGER_DEBUG3
|
||||
//#ifdef EIGER_DEBUG3
|
||||
cprintf(RED,"fifo:%d packet from next frame %d, add missing packets to the right one %d\n",
|
||||
i,tempframenum[i],presentframenum );
|
||||
cprintf(RED,"current wrong frame:%d wrong frame packet number:%d\n",
|
||||
(uint32_t)(*( (uint64_t*) wbuf_footer)),
|
||||
*( (uint16_t*) wbuf_footer->packetnum));
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
tempframenum[i] = presentframenum;
|
||||
//add missing packets
|
||||
numberofmissingpackets[i] = (LAST_PACKET_VALUE - lastpacketheader[i]);
|
||||
@ -2257,12 +2257,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 +2274,12 @@ int UDPStandardImplementation::startWriting(){
|
||||
|
||||
//CORRECT FRAME - continue building frame
|
||||
else {
|
||||
#ifdef PADDING
|
||||
//#ifdef PADDING
|
||||
cout<<"correct packet"<<endl;
|
||||
#endif
|
||||
#ifdef EIGER_DEBUG3
|
||||
//#endif
|
||||
//#ifdef EIGER_DEBUG3
|
||||
cprintf(GREEN,"**tempfraemnum of %d: %d\n",i,tempframenum[i]);
|
||||
#endif
|
||||
//#endif
|
||||
//update current packet
|
||||
currentpacketheader[i] = *( (uint16_t*) wbuf_footer->packetnum);
|
||||
#ifdef VERYVERBOSE
|
||||
@ -2308,12 +2308,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 ++;
|
||||
}
|
||||
@ -2326,32 +2326,33 @@ 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_footer->packetnum),
|
||||
*( (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;
|
||||
}
|
||||
@ -2372,10 +2373,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])
|
||||
@ -2389,7 +2390,7 @@ int UDPStandardImplementation::startWriting(){
|
||||
cprintf(RED,"found the missing packet at pnum:%d\n",j);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
//write and copy to gui
|
||||
@ -2431,14 +2432,14 @@ int UDPStandardImplementation::startWriting(){
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef EIGER_DEBUG3
|
||||
for(int i=0;i<numListeningThreads;i++){
|
||||
wbuf_footer = (eiger_packet_footer_t*)(wbuf[i] + footer_offset + HEADER_SIZE_NUM_TOT_PACKETS);
|
||||
cprintf(GREEN," end of loop popready[%d]:%d add:0x%x\n",i,popready[i],(void*)(wbuf[i]));
|
||||
cprintf(GREEN,"tempframenum[%d]:%d\n",i,(uint32_t)(*( (uint64_t*) wbuf_footer)));
|
||||
cprintf(GREEN,"packetnum[%d]:%d\n",i,*( (uint16_t*) wbuf_footer->packetnum));
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user