diff --git a/slsDetectorSoftware/slsReceiver/receiver_defs.h b/slsDetectorSoftware/slsReceiver/receiver_defs.h index e4c9b1d71..2d7d9ffc6 100755 --- a/slsDetectorSoftware/slsReceiver/receiver_defs.h +++ b/slsDetectorSoftware/slsReceiver/receiver_defs.h @@ -9,7 +9,9 @@ //all max frames defined in sls_detector_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench -#define GOTTHARD_FIFO_SIZE 25000 +#define FIFO_SIZE 25000 + +#define GOTTHARD_ALIGNED_FRAME_SIZE 4096 #define GOTTHARD_PACKETS_PER_FRAME 2 #define GOTTHARD_BUFFER_SIZE 1286*GOTTHARD_PACKETS_PER_FRAME @@ -22,8 +24,8 @@ +#define MOENCH_ALIGNED_FRAME_SIZE 65536 -#define MOENCH_FIFO_SIZE 25000 #define MOENCH_PACKETS_PER_FRAME 40 #define MOENCH_BUFFER_SIZE 1286*MOENCH_PACKETS_PER_FRAME diff --git a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp index 1292797da..ceac27a22 100644 --- a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp +++ b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp @@ -24,6 +24,8 @@ #include //set precision +#include + #include #include using namespace std; @@ -82,18 +84,21 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det): strcpy(eth,""); latestData = new char[bufferSize]; - fifofree = new CircularFifo();/**MOENCH SAME FIFO SIZE FOR NOW,ELSE MEMBER DECLARATION ERROR*/ - fifo = new CircularFifo(); + fifofree = new CircularFifo(); + fifo = new CircularFifo(); + int aligned_frame_size = GOTTHARD_ALIGNED_FRAME_SIZE; + if (det == MOENCH) + aligned_frame_size = MOENCH_ALIGNED_FRAME_SIZE; - mem0=(char*)malloc(4096*GOTTHARD_FIFO_SIZE); + mem0=(char*)malloc(aligned_frame_size*FIFO_SIZE); if (mem0==NULL) { cout<<"++++++++++++++++++++++ COULD NOT ALLOCATE MEMORY!!!!!!!+++++++++++++++++++++" << endl; } buffer=mem0; - while (buffer<(mem0+4096*(GOTTHARD_FIFO_SIZE-1))) { + while (buffer<(mem0+aligned_frame_size*(FIFO_SIZE-1))) { fifofree->push(buffer); - buffer+=4096; + buffer+=aligned_frame_size; } @@ -241,11 +246,11 @@ int slsReceiverFunctionList::startReceiver(){ cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl; if (pthread_setschedparam(writing_thread, policy, &write_param) == EPERM) cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl; - if (pthread_setschedparam(pthread_self(), policy, &tcp_param) == EPERM) + if (pthread_setschedparam(pthread_self(), 5, &tcp_param) == EPERM) cout << "ERROR: Could not prioritize threads. You need to be super user for that." << endl; - pthread_getschedparam(listening_thread,&policy,&tcp_param); + pthread_getschedparam(pthread_self(),&policy,&tcp_param); cout << "current priority of main tcp thread is " << tcp_param.sched_priority << endl; } diff --git a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.h b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.h index 4a9abd566..0377004c2 100644 --- a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.h +++ b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.h @@ -283,10 +283,10 @@ private: /** circular fifo to read and write data*/ //CircularFifo* fifo; - CircularFifo* fifo; + CircularFifo* fifo; /** circular fifo to read and write data*/ - CircularFifo* fifofree; + CircularFifo* fifofree; /** short frames */ int shortFrame; diff --git a/slsDetectorSoftware/slsReceiver/slsReceiver_funcs.cpp b/slsDetectorSoftware/slsReceiver/slsReceiver_funcs.cpp index 9f9294ae7..cc89634e7 100644 --- a/slsDetectorSoftware/slsReceiver/slsReceiver_funcs.cpp +++ b/slsDetectorSoftware/slsReceiver/slsReceiver_funcs.cpp @@ -969,6 +969,7 @@ int slsReceiverFuncs::moench_read_frame(){ //return ok/fail ///ADDED BY ANNA?!?!?!? //?????????FOR GOTTHARD AS WELL????? + delete [] origVal; delete [] retval;