moench receiver orders packets to frames

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@533 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-04-26 15:23:45 +00:00
parent 8c3e7f6160
commit ded2a4de5c
5 changed files with 120 additions and 20 deletions

View File

@ -66,13 +66,20 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit
pAcquisitionFinished(NULL),
rawDataReadyCallBack(NULL),
pRawDataReady(NULL),
withGotthard(moenchwithGotthardTest)
withGotthard(moenchwithGotthardTest),
frameIndexMask(GOTTHARD_FRAME_INDEX_MASK),
frameIndexOffset(GOTTHARD_FRAME_INDEX_OFFSET)
{
if(myDetectorType == MOENCH){
maxFramesPerFile = MOENCH_MAX_FRAMES_PER_FILE;
bufferSize = MOENCH_BUFFER_SIZE;
packetsPerFrame = MOENCH_PACKETS_PER_FRAME;
if(!withGotthard){
frameIndexMask = MOENCH_FRAME_INDEX_MASK;
frameIndexOffset = MOENCH_FRAME_INDEX_OFFSET;
}
}
strcpy(savefilename,"");
@ -349,7 +356,12 @@ int slsReceiverFunctionList::startListening(){
//start for each scan
if(startFrameIndex==-1){
startFrameIndex=(int)(*((int*)buffer))-packetsPerFrame;
if(!frameIndexOffset)
startFrameIndex = (int)(*((int*)buffer));
else
startFrameIndex = (((int)(*((int*)buffer))) & (frameIndexMask)) >> frameIndexOffset;
startFrameIndex -= packetsPerFrame;
//cout<<"startFrameIndex:"<<startFrameIndex<<endl;
prevframenum=startFrameIndex;
}
@ -369,7 +381,7 @@ int slsReceiverFunctionList::startListening(){
if(fifo->isFull())
;//cout<<"**********************FIFO FULLLLLLLL************************"<<endl;
else{
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;& (frameIndexMask)) >> frameIndexOffset;
fifo->push(buffer);
}
@ -494,7 +506,12 @@ int slsReceiverFunctionList::startWriting(){
if(fifo->pop(wbuf)){
framesCaught++;
totalFramesCaught++;
currframenum = (int)(*((int*)wbuf));//cout<<"**************curreframenm:"<<currframenum<<endl;
if(!frameIndexOffset)
currframenum = (int)(*((int*)wbuf));
else
currframenum = (((int)(*((int*)wbuf))) & (frameIndexMask)) >> frameIndexOffset;
//currframenum = (int)(*((int*)wbuf));
//cout<<"**************curreframenm:"<<currframenum<<endl;
//write data
if(enableFileWrite){