mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
Receiver changed passing only data array to fifos - fixed adata size given by bufferSize
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@481 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
b44cc16cff
commit
16c9561fcd
@ -78,7 +78,9 @@ slsReceiverFunctionList::slsReceiverFunctionList(bool shortfname):
|
|||||||
|
|
||||||
fifofree = new CircularFifo<char,FIFO_SIZE>();
|
fifofree = new CircularFifo<char,FIFO_SIZE>();
|
||||||
|
|
||||||
fifo = new CircularFifo<dataStruct,FIFO_SIZE>();
|
// fifo = new CircularFifo<dataStruct,FIFO_SIZE>();
|
||||||
|
fifo = new CircularFifo<char,FIFO_SIZE>();
|
||||||
|
|
||||||
|
|
||||||
mem0=(char*)malloc(4096*FIFO_SIZE);
|
mem0=(char*)malloc(4096*FIFO_SIZE);
|
||||||
if (mem0==NULL) {
|
if (mem0==NULL) {
|
||||||
@ -282,7 +284,7 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
#endif
|
#endif
|
||||||
// Variable and structure definitions
|
// Variable and structure definitions
|
||||||
int rc;
|
int rc;
|
||||||
dataStruct *dataReadFrame;
|
// dataStruct *dataReadFrame;
|
||||||
|
|
||||||
//reset variables for each acquisition
|
//reset variables for each acquisition
|
||||||
startFrameIndex=-1;
|
startFrameIndex=-1;
|
||||||
@ -346,11 +348,13 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
;//cout<<"**********************FIFO FULLLLLLLL************************"<<endl;
|
;//cout<<"**********************FIFO FULLLLLLLL************************"<<endl;
|
||||||
else{
|
else{
|
||||||
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;
|
//cout<<"read index:"<<dec<<(int)(*(int*)buffer)<<endl;
|
||||||
dataReadFrame = new dataStruct;
|
/** dataReadFrame = new dataStruct;
|
||||||
dataReadFrame->buffer=buffer;
|
dataReadFrame->buffer=buffer;
|
||||||
dataReadFrame->rc=rc;
|
dataReadFrame->rc=rc;
|
||||||
//cout<<"read buffer:"<<dataReadFrame<<endl;
|
//cout<<"read buffer:"<<dataReadFrame<<endl;
|
||||||
fifo->push(dataReadFrame);
|
fifo->push(dataReadFrame);
|
||||||
|
*/
|
||||||
|
fifo->push(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -391,6 +395,9 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "In startWriting()" <<endl;
|
cout << "In startWriting()" <<endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *wbuf;
|
||||||
|
|
||||||
// Variable and structure definitions
|
// Variable and structure definitions
|
||||||
int ret,sleepnumber=0;//currframenum,ret;
|
int ret,sleepnumber=0;//currframenum,ret;
|
||||||
// dataStruct *dataWriteFrame;
|
// dataStruct *dataWriteFrame;
|
||||||
@ -479,12 +486,13 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
//actual writing from fifo
|
//actual writing from fifo
|
||||||
if(!fifo->isEmpty()){
|
if(!fifo->isEmpty()){
|
||||||
// dataWriteFrame = new dataStruct;
|
// dataWriteFrame = new dataStruct;
|
||||||
if(fifo->pop(dataWriteFrame)){
|
//if(fifo->pop(dataWriteFrame)){
|
||||||
|
if(fifo->pop(wbuf)){
|
||||||
//cout<<"write buffer:"<<dataWriteFrame<<endl<<endl;
|
//cout<<"write buffer:"<<dataWriteFrame<<endl<<endl;
|
||||||
framesCaught++;
|
framesCaught++;
|
||||||
totalFramesCaught++;
|
totalFramesCaught++;
|
||||||
currframenum = (int)(*((int*)dataWriteFrame->buffer));
|
//currframenum = (int)(*((int*)dataWriteFrame->buffer));
|
||||||
|
currframenum = (int)(*((int*)wbuf));
|
||||||
if(guiRequiresData)
|
if(guiRequiresData)
|
||||||
guiData=latestData;
|
guiData=latestData;
|
||||||
else
|
else
|
||||||
@ -492,25 +500,25 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
|
|
||||||
if(enableFileWrite){
|
if(enableFileWrite){
|
||||||
if (writeReceiverData)
|
if (writeReceiverData)
|
||||||
writeReceiverData(dataWriteFrame->buffer,dataWriteFrame->rc, sfilefd, pwriteReceiverDataArg);
|
writeReceiverData(wbuf,bufferSize, sfilefd, pwriteReceiverDataArg);
|
||||||
if (cbAction<2) {
|
if (cbAction<2) {
|
||||||
rawDataReadyCallBack(currframenum, dataWriteFrame->buffer,sfilefd, guiData,pRawDataReady);
|
rawDataReadyCallBack(currframenum, wbuf,sfilefd, guiData,pRawDataReady);
|
||||||
} else {
|
} else {
|
||||||
fwrite(dataWriteFrame->buffer, 1, dataWriteFrame->rc, sfilefd);
|
fwrite(wbuf, 1, bufferSize, sfilefd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(guiRequiresData){
|
if(guiRequiresData){
|
||||||
memcpy(latestData,dataWriteFrame->buffer,bufferSize);
|
memcpy(latestData,wbuf,bufferSize);
|
||||||
guiRequiresData=0;
|
guiRequiresData=0;
|
||||||
}
|
}
|
||||||
//cout<<"write index:"<<(int)(*(int*)latestData)<<endl;
|
//cout<<"write index:"<<(int)(*(int*)latestData)<<endl;
|
||||||
framesInFile++;
|
framesInFile++;
|
||||||
///ANNA?!?!??!
|
///ANNA?!?!??!
|
||||||
// delete [] dataWriteFrame->buffer;
|
// delete [] dataWriteFrame->buffer;
|
||||||
fifofree->push(dataWriteFrame->buffer);
|
fifofree->push(wbuf);
|
||||||
}
|
}
|
||||||
delete dataWriteFrame;
|
// delete dataWriteFrame;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
sleepnumber++;
|
sleepnumber++;
|
||||||
|
@ -278,7 +278,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** circular fifo to read and write data*/
|
/** circular fifo to read and write data*/
|
||||||
CircularFifo<dataStruct,FIFO_SIZE>* fifo;
|
//CircularFifo<dataStruct,FIFO_SIZE>* fifo;
|
||||||
|
CircularFifo<char,FIFO_SIZE>* fifo;
|
||||||
|
|
||||||
/** circular fifo to read and write data*/
|
/** circular fifo to read and write data*/
|
||||||
CircularFifo<char,FIFO_SIZE>* fifofree;
|
CircularFifo<char,FIFO_SIZE>* fifofree;
|
||||||
|
|
||||||
@ -353,7 +355,7 @@ public:
|
|||||||
static int listening_thread_running;
|
static int listening_thread_running;
|
||||||
|
|
||||||
|
|
||||||
dataStruct *dataWriteFrame;
|
// dataStruct *dataWriteFrame;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user