mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
incorporating ten giga into the receiver
This commit is contained in:
parent
8369153d60
commit
bbb0a05fca
@ -74,11 +74,15 @@
|
||||
|
||||
#define EIGER_FIFO_SIZE 250 //cannot be less than max jobs per thread = 1000
|
||||
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
||||
#define EIGER_PACKETS_PER_FRAME_COSTANT (16*EIGER_MAX_PORTS)//*bit mode 4*16=64, 8*16=128, 16*16=256, 32*16=512
|
||||
#define EIGER_ONE_PACKET_SIZE 1040
|
||||
#define EIGER_ONE_DATA_SIZE 1024
|
||||
#define EIGER_BUFFER_SIZE_CONSTANT (EIGER_ONE_PACKET_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT)//1040*16*2//*bit mode
|
||||
#define EIGER_DATA_BYTES_CONSTANT (EIGER_ONE_DATA_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT) //1024*16*2//*bit mode
|
||||
#define EIGER_ONE_GIGA_CONSTANT 16
|
||||
#define EIGER_TEN_GIGA_CONSTANT 4
|
||||
//#define EIGER_PACKETS_PER_FRAME_COSTANT (16*EIGER_MAX_PORTS)//*bit mode 4*16=64, 8*16=128, 16*16=256, 32*16=512
|
||||
#define EIGER_ONE_GIGA_ONE_PACKET_SIZE 1040
|
||||
#define EIGER_ONE_GIGA_ONE_DATA_SIZE 1024
|
||||
#define EIGER_TEN_GIGA_ONE_PACKET_SIZE 4112
|
||||
#define EIGER_TEN_GIGA_ONE_DATA_SIZE 4096
|
||||
//#define EIGER_BUFFER_SIZE_CONSTANT (EIGER_ONE_PACKET_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT)//1040*16*2//*bit mode
|
||||
//#define EIGER_DATA_BYTES_CONSTANT (EIGER_ONE_DATA_SIZE*EIGER_PACKETS_PER_FRAME_COSTANT) //1024*16*2//*bit mode
|
||||
|
||||
#define EIGER_FRAME_INDEX_MASK 0xFFFF
|
||||
#define EIGER_FRAME_INDEX_OFFSET 0
|
||||
@ -87,7 +91,7 @@
|
||||
#define EIGER_IMAGE_HEADER_SIZE 48
|
||||
|
||||
#define EIGER_PIXELS_IN_ONE_ROW (256*4)
|
||||
|
||||
#define EIGER_PIXELS_IN_ONE_COL (256)
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,8 @@ slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int argc, char *argv[], int
|
||||
packetsPerFrame(GOTTHARD_PACKETS_PER_FRAME),
|
||||
dynamicrange(16),
|
||||
socket(NULL),
|
||||
killTCPServerThread(0){
|
||||
killTCPServerThread(0),
|
||||
tenGigaEnable(0){
|
||||
|
||||
int port_no = DEFAULT_PORTNO+2;
|
||||
ifstream infile;
|
||||
@ -316,6 +317,9 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_ENABLE_RECEIVER_COMPRESSION] = &slsReceiverTCPIPInterface::enable_compression;
|
||||
flist[F_ENABLE_RECEIVER_OVERWRITE] = &slsReceiverTCPIPInterface::enable_overwrite;
|
||||
|
||||
flist[F_ENABLE_RECEIVER_TEN_GIGA] = &slsReceiverTCPIPInterface::enable_tengiga;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
for (int i=0;i<numberOfFunctions;i++)
|
||||
cout << "function " << i << "located at " << flist[i] << endl;
|
||||
@ -1348,23 +1352,25 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
int arg = -1,i;
|
||||
uint32_t index=0;
|
||||
|
||||
int bufferSize = EIGER_BUFFER_SIZE_CONSTANT * dynamicrange;
|
||||
char* raw = new char[bufferSize];
|
||||
char* origVal = new char[bufferSize];
|
||||
char* retval = new char[(EIGER_DATA_BYTES_CONSTANT*dynamicrange)];
|
||||
int frameSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE * packetsPerFrame;
|
||||
int dataSize = EIGER_ONE_GIGA_ONE_DATA_SIZE * packetsPerFrame;
|
||||
if(tenGigaEnable){
|
||||
frameSize = EIGER_TEN_GIGA_ONE_PACKET_SIZE * packetsPerFrame;
|
||||
dataSize = EIGER_TEN_GIGA_ONE_DATA_SIZE * packetsPerFrame;
|
||||
}
|
||||
char* raw = new char[frameSize];
|
||||
char* origVal = new char[frameSize];
|
||||
char* retval = new char[dataSize];
|
||||
|
||||
strcpy(mess,"Could not read frame\n");
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* typedef struct{
|
||||
unsigned char num1[4];
|
||||
unsigned char num2[4];
|
||||
} eiger_packet_header;
|
||||
|
||||
} eiger_packet_header;*/
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
//#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
|
||||
|
||||
|
||||
@ -1391,42 +1397,40 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
|
||||
/**proper frame*/
|
||||
else{
|
||||
|
||||
memcpy(origVal,raw,bufferSize);
|
||||
memcpy(origVal,raw,frameSize);
|
||||
raw=NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
int c1=8;
|
||||
int c2=(bufferSize/2) + 8; //only 2 ports
|
||||
int c1=8;//first port
|
||||
int c2=(frameSize/2) + 8; //second port
|
||||
int retindex=0;
|
||||
int irow,ibytesperpacket,irepeat;
|
||||
int repeat=1;
|
||||
int linesperpacket = 16/dynamicrange;// 16:1 line, 8:2 lines, 4:4 lines, 32: 0.5
|
||||
int linesperpacket = (16/dynamicrange)* 1;// 16:1 line, 8:2 lines, 4:4 lines, 32: 0.5
|
||||
int numbytesperlineperport=(EIGER_PIXELS_IN_ONE_ROW/EIGER_MAX_PORTS)*dynamicrange/8;//16:1024,8:512,4:256,32:2048
|
||||
if(dynamicrange == 32){
|
||||
int datapacketlength = EIGER_ONE_GIGA_ONE_DATA_SIZE;
|
||||
|
||||
|
||||
if(tenGigaEnable){
|
||||
linesperpacket = (16/dynamicrange)* 4;// 16:4 line, 8:8 lines, 4:16 lines, 32: 2
|
||||
datapacketlength = EIGER_TEN_GIGA_ONE_DATA_SIZE;
|
||||
}
|
||||
//if 1GbE, one line is split into two packets for 32 bit mode, so its special
|
||||
else if(dynamicrange == 32){
|
||||
repeat=2;
|
||||
numbytesperlineperport = 1024;
|
||||
linesperpacket = 1; //we repeat this twice anyway
|
||||
linesperpacket = 1; //we repeat this twice anyway for 32 bit
|
||||
}
|
||||
|
||||
//cout <<"linesperpacket:" <<dec<<linesperpacket <<" numbytesperlineperport:"<<numbytesperlineperport<<endl;
|
||||
|
||||
//for each
|
||||
for(irow=0;irow<256/linesperpacket;++irow){
|
||||
//cout <<"irow:"<<irow<<endl;
|
||||
for(irow=0;irow<EIGER_PIXELS_IN_ONE_COL/linesperpacket;++irow){
|
||||
ibytesperpacket=0;
|
||||
while(ibytesperpacket<1024){
|
||||
//cout <<"ibytesperpacket:"<<ibytesperpacket<<endl;
|
||||
while(ibytesperpacket<datapacketlength){
|
||||
for(irepeat=0;irepeat<repeat;irepeat++){//only for 32 bit mode, take 2 packets from same port
|
||||
//cout <<"irepeat:"<<irepeat<<" c1:"<<c1<<" retindex:"<<retindex<<endl;
|
||||
memcpy(retval+retindex ,origVal+c1 ,numbytesperlineperport);
|
||||
retindex += numbytesperlineperport;
|
||||
c1 += numbytesperlineperport;
|
||||
}
|
||||
for(irepeat=0;irepeat<repeat;irepeat++){//only for 32 bit mode, take 2 packets from same port
|
||||
//cout <<"irepeat:"<<irepeat<<" c2:"<<c2<<" retindex:"<<retindex<<endl;
|
||||
memcpy(retval+retindex ,origVal+c2 ,numbytesperlineperport);
|
||||
retindex += numbytesperlineperport;
|
||||
c2 += numbytesperlineperport;
|
||||
@ -1438,36 +1442,24 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for(i=0;i<(packetsPerFrame/EIGER_MAX_PORTS);++i){
|
||||
//cout<<i<<" p1:"<<dec<<(htonl(*(uint32_t*)((eiger_packet_header *)((uint32_t*)(origVal + (c1-8))))->num2)&0xff)<<"\t\t";
|
||||
memcpy(retval+retindex ,origVal+c1 ,EIGER_ONE_DATA_SIZE);
|
||||
c1 += 16+EIGER_ONE_DATA_SIZE;
|
||||
retindex += EIGER_ONE_DATA_SIZE;
|
||||
|
||||
//cout<<i<<" p2:"<<dec<<(htonl(*(uint32_t*)((eiger_packet_header *)((uint32_t*)(origVal + (c2-8))))->num2)&0xff)<<endl;
|
||||
memcpy(retval+retindex ,origVal+c2 ,EIGER_ONE_DATA_SIZE);
|
||||
c2 += 16+EIGER_ONE_DATA_SIZE;
|
||||
retindex += EIGER_ONE_DATA_SIZE;
|
||||
int64_t temp;
|
||||
for(i=0;i<(1024*(16*dynamicrange)*2)/8;i++){
|
||||
temp = ((uint64_t)(*(((uint64_t*)retval)+i)));
|
||||
temp = ((temp << 8) & 0xFF00FF00FF00FF00ULL ) | ((temp >> 8) & 0x00FF00FF00FF00FFULL );
|
||||
temp = ((temp << 16) & 0xFFFF0000FFFF0000ULL ) | ((temp >> 16) & 0x0000FFFF0000FFFFULL );
|
||||
temp = (temp << 32) | ((temp >> 32) & 0xFFFFFFFFULL);
|
||||
(*(((uint64_t*)retval)+i)) = temp;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
for(i=0;i<(1024*(16*dynamicrange)*2)/4;i++)
|
||||
(*((uint32_t*)retval+i)) = htonl((uint32_t)(*((uint32_t*)retval+i)));
|
||||
|
||||
/*
|
||||
( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \
|
||||
(((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | \
|
||||
(((val) << 8) & 0x000000FF00000000) | (((val) << 24) & 0x0000FF0000000000) | \
|
||||
(((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000) )
|
||||
*/
|
||||
/*
|
||||
for(int j=25;j<27;++j)
|
||||
for(int i=1000;i<1010;i=i+2)
|
||||
//cout<<"retval:"<<dec<<i<<hex<<":\t0x"<<htonl((uint32_t)(*((uint32_t*)(retval+ (EIGER_ONE_DATA_SIZE)+i))))<<endl;
|
||||
cout<<"retval:"<<dec<<i<<hex<<":\t0x"<<((uint16_t)(*((uint16_t*)(retval+ j* 2048+(1024)+i))))<<endl;
|
||||
*/
|
||||
for(i=0;i<(1024*(16*dynamicrange)*2)/4;i++)
|
||||
(*(((uint32_t*)retval)+i)) = htonl((uint32_t)(*(((uint32_t*)retval)+i)));
|
||||
*/
|
||||
arg = index-1;
|
||||
}
|
||||
}
|
||||
@ -1481,7 +1473,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
|
||||
|
||||
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if(ret==OK && socket->differentClients){
|
||||
cout << "Force update" << endl;
|
||||
@ -1497,7 +1489,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
else{
|
||||
socket->SendDataOnly(fName,MAX_STR_LENGTH);
|
||||
socket->SendDataOnly(&arg,sizeof(arg));
|
||||
socket->SendDataOnly(retval,(EIGER_DATA_BYTES_CONSTANT*dynamicrange));
|
||||
socket->SendDataOnly(retval,dataSize);
|
||||
}
|
||||
|
||||
delete [] retval;
|
||||
@ -1508,6 +1500,11 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_read_frequency(){
|
||||
ret=OK;
|
||||
int retval=-1;
|
||||
@ -1864,8 +1861,12 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
||||
if(ret!=FAIL){
|
||||
retval=slsReceiverFunctions->setDynamicRange(dr);
|
||||
dynamicrange = dr;
|
||||
if(myDetectorType == EIGER)
|
||||
packetsPerFrame = dr*EIGER_PACKETS_PER_FRAME_COSTANT;
|
||||
if(myDetectorType == EIGER){
|
||||
if(!tenGigaEnable)
|
||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicrange * EIGER_MAX_PORTS;
|
||||
else
|
||||
packetsPerFrame = EIGER_TEN_GIGA_CONSTANT * dynamicrange * EIGER_MAX_PORTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -1969,8 +1970,13 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
;//retval=slsReceiverFunctions->enable10GbE(val);
|
||||
else{
|
||||
retval=slsReceiverFunctions->enableTenGiga(val);
|
||||
if((val!=-1) && (val != retval))
|
||||
ret = FAIL;
|
||||
else
|
||||
tenGigaEnable = retval;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
|
@ -257,6 +257,9 @@ private:
|
||||
/** thread for TCP server */
|
||||
pthread_t TCPServer_thread;
|
||||
|
||||
/** size of one frame*/
|
||||
int tenGigaEnable;
|
||||
|
||||
protected:
|
||||
/** Socket */
|
||||
MySocketTCP* socket;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
//#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
/********************************************//**
|
||||
* @file slsReceiverUDPFunctions.cpp
|
||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||
@ -35,7 +35,8 @@ slsReceiverUDPFunctions::slsReceiverUDPFunctions():
|
||||
eth(NULL),
|
||||
latestData(NULL),
|
||||
guiFileName(NULL),
|
||||
guiFrameNumber(0){
|
||||
guiFrameNumber(0),
|
||||
tengigaEnable(0){
|
||||
for(int i=0;i<MAX_NUM_LISTENING_THREADS;i++){
|
||||
udpSocket[i] = NULL;
|
||||
server_port[i] = DEFAULT_UDP_PORTNO+i;
|
||||
@ -167,6 +168,7 @@ void slsReceiverUDPFunctions::initializeMembers(){
|
||||
killAllListeningThreads = 0;
|
||||
killAllWritingThreads = 0;
|
||||
cbAction = DO_EVERYTHING;
|
||||
tengigaEnable = 0;
|
||||
|
||||
for(int i=0;i<numListeningThreads;i++){
|
||||
udpSocket[i] = NULL;
|
||||
@ -262,10 +264,10 @@ int slsReceiverUDPFunctions::setDetectorType(detectorType det){
|
||||
#ifndef EIGERSLS
|
||||
cout << "SLS Eiger Receiver" << endl;
|
||||
fifosize = EIGER_FIFO_SIZE;
|
||||
packetsPerFrame = EIGER_PACKETS_PER_FRAME_COSTANT * dynamicRange;
|
||||
onePacketSize = EIGER_ONE_PACKET_SIZE;
|
||||
frameSize = EIGER_BUFFER_SIZE_CONSTANT * dynamicRange;
|
||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//for only one port
|
||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||
onePacketSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE;
|
||||
frameSize = onePacketSize * packetsPerFrame;
|
||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//everything one port gets (img header plus packets)
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
frameIndexMask = EIGER_FRAME_INDEX_MASK;
|
||||
frameIndexOffset = EIGER_FRAME_INDEX_OFFSET;
|
||||
@ -530,43 +532,52 @@ int32_t slsReceiverUDPFunctions::setDynamicRange(int32_t dr){
|
||||
receiver->setDynamicRange(dr);
|
||||
else{
|
||||
dynamicRange = dr;
|
||||
packetsPerFrame = EIGER_PACKETS_PER_FRAME_COSTANT * dynamicRange;
|
||||
frameSize = EIGER_BUFFER_SIZE_CONSTANT * dynamicRange;
|
||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//for only one port
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
|
||||
if(olddr != dr){
|
||||
if(myDetectorType == EIGER){
|
||||
|
||||
//del
|
||||
if(thread_started){
|
||||
createListeningThreads(true);
|
||||
createWriterThreads(true);
|
||||
}
|
||||
for(int i=0;i<numListeningThreads;i++){
|
||||
|
||||
if(!tengigaEnable)
|
||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||
else
|
||||
packetsPerFrame = EIGER_TEN_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||
frameSize = onePacketSize * packetsPerFrame;
|
||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//everything one port gets (img header plus packets)
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
|
||||
|
||||
|
||||
if(olddr != dr){
|
||||
|
||||
//del
|
||||
if(thread_started){
|
||||
createListeningThreads(true);
|
||||
createWriterThreads(true);
|
||||
}
|
||||
for(int i=0;i<numListeningThreads;i++){
|
||||
if(mem0[i]) {free(mem0[i]); mem0[i] = NULL;}
|
||||
if(fifo[i]) {delete fifo[i]; fifo[i] = NULL;}
|
||||
if(fifoFree[i]) {delete fifoFree[i]; fifoFree[i] = NULL;}
|
||||
buffer[i] = NULL;
|
||||
}
|
||||
if(latestData) {delete [] latestData; latestData = NULL;}
|
||||
latestData = new char[frameSize];
|
||||
if(latestData) {delete [] latestData; latestData = NULL;}
|
||||
latestData = new char[frameSize];
|
||||
|
||||
numJobsPerThread = -1;
|
||||
setupFifoStructure();
|
||||
numJobsPerThread = -1;
|
||||
setupFifoStructure();
|
||||
|
||||
if(createListeningThreads() == FAIL){
|
||||
cout << "ERROR: Could not create listening thread" << endl;
|
||||
exit (-1);
|
||||
if(createListeningThreads() == FAIL){
|
||||
cout << "ERROR: Could not create listening thread" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
if(createWriterThreads() == FAIL){
|
||||
cout << "ERROR: Could not create writer threads" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
setThreadPriorities();
|
||||
}
|
||||
|
||||
if(createWriterThreads() == FAIL){
|
||||
cout << "ERROR: Could not create writer threads" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
setThreadPriorities();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1527,7 +1538,7 @@ int slsReceiverUDPFunctions::startListening(){
|
||||
#endif
|
||||
|
||||
if(tempchar) {delete [] tempchar;tempchar = NULL;}
|
||||
if(myDetectorType == EIGER)
|
||||
if(myDetectorType != EIGER)
|
||||
tempchar = new char[onePacketSize * ((packetsPerFrame/numListeningThreads) - 1)]; //gotthard: 1packet size, moench:39 packet size
|
||||
|
||||
|
||||
@ -1574,14 +1585,6 @@ int slsReceiverUDPFunctions::startListening(){
|
||||
cout << ithread << " *** rc:" << dec << rc << ". expected:" << dec << expected << endl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
if(ithread){
|
||||
for(int j=25;j<27;++j)
|
||||
for(int i=1000;i<1010;i=i+2)
|
||||
//cout<<"startbuf:"<<dec<<i<<hex<<":\t0x"<<htonl((uint32_t)(*((uint32_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS+ EIGER_HEADER_LENGTH+ 8+i))))<<endl;
|
||||
cout<<"startbuf:"<<dec<<i<<hex<<":\t0x"<<((uint16_t)(*((uint16_t*)(buffer[ithread] + 2+ 48+ j*1040+8+i))))<<endl;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -1665,6 +1668,7 @@ int slsReceiverUDPFunctions::startListening(){
|
||||
}
|
||||
|
||||
|
||||
// cout<<"*********** "<<ithread<<" tempnum:"<< htonl(*(unsigned int*)((eiger_image_header *)((char*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum)<<endl;
|
||||
|
||||
|
||||
|
||||
@ -1792,7 +1796,8 @@ int loop;
|
||||
pthread_mutex_unlock(&progress_mutex);
|
||||
}
|
||||
//#ifdef VERYDEBUG
|
||||
cout << endl <<ithread << " tempframenum:" << hex << tempframenum << " curframenum:" << currframenum << endl;
|
||||
if(myDetectorType == EIGER)
|
||||
cout << endl <<ithread << " tempframenum:" << hex << tempframenum << " curframenum:" << currframenum << endl;
|
||||
//#endif
|
||||
|
||||
|
||||
@ -1929,9 +1934,9 @@ void slsReceiverUDPFunctions::startFrameIndices(int ithread){
|
||||
void slsReceiverUDPFunctions::stopListening(int ithread, int rc, int &pc, int &t){
|
||||
int i;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
//#ifdef VERYVERBOSE
|
||||
cerr << ithread << " recvfrom() failed:"<<endl;
|
||||
#endif
|
||||
//#endif
|
||||
if(status != TRANSMITTING){
|
||||
cout << ithread << " *** shoule never be here********* status not transmitting***********************"<<endl;/**/
|
||||
fifoFree[ithread]->push(buffer[ithread]);
|
||||
@ -1960,37 +1965,37 @@ int i;
|
||||
cout << ithread << " going to push in dummy buffer:" << (void*)buffer[ithread] << " with num packets:"<< (*((uint16_t*)(buffer[ithread]))) << endl;
|
||||
#endif
|
||||
while(!fifo[ithread]->push(buffer[ithread]));
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
cout << ithread << " pushed in dummy buffer:" << (void*)buffer[ithread] << endl;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
//reset mask and exit loop
|
||||
pthread_mutex_lock(&status_mutex);
|
||||
listeningthreads_mask^=(1<<ithread);
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
cout << ithread << " Resetting mask of current listening thread. New Mask: " << listeningthreads_mask << endl;
|
||||
#endif
|
||||
//#endif
|
||||
pthread_mutex_unlock(&(status_mutex));
|
||||
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
cout << ithread << ": Frames listened to " << dec << ((totalListeningFrameCount[ithread]*numListeningThreads)/packetsPerFrame) << endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
//waiting for all listening threads to be done, to print final count of frames listened to
|
||||
if(ithread == 0){
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
if(numListeningThreads > 1)
|
||||
cout << "Waiting for listening to be done.. current mask:" << hex << listeningthreads_mask << endl;
|
||||
#endif
|
||||
//#endif
|
||||
while(listeningthreads_mask)
|
||||
usleep(5000);
|
||||
#ifdef VERYDEBUG
|
||||
//#ifdef VERYDEBUG
|
||||
t = 0;
|
||||
for(i=0;i<numListeningThreads;++i)
|
||||
t += totalListeningFrameCount[i];
|
||||
cout << "Total frames listened to " << dec <<(t/packetsPerFrame) << endl;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
}
|
||||
@ -2272,6 +2277,81 @@ void slsReceiverUDPFunctions::handleDataCompression(int ithread, char* wbuffer[]
|
||||
|
||||
|
||||
|
||||
int slsReceiverUDPFunctions::enableTenGiga(int enable){
|
||||
|
||||
cout << "Enabling 10Gbe to" << enable << endl;
|
||||
|
||||
int oldtengiga = tengigaEnable;
|
||||
if(enable >= 0){
|
||||
if(receiver != NULL)
|
||||
;/*receiver->setTenGigaBitEthernet(enable);*/
|
||||
else{
|
||||
tengigaEnable = enable;
|
||||
|
||||
if(myDetectorType == EIGER){
|
||||
|
||||
if(!tengigaEnable){
|
||||
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||
onePacketSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE;
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
}else{
|
||||
packetsPerFrame = EIGER_TEN_GIGA_CONSTANT * dynamicRange * EIGER_MAX_PORTS;
|
||||
onePacketSize = EIGER_TEN_GIGA_ONE_PACKET_SIZE;
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame*4;
|
||||
}
|
||||
frameSize = onePacketSize * packetsPerFrame;
|
||||
bufferSize = (frameSize/EIGER_MAX_PORTS) + EIGER_HEADER_LENGTH;//everything one port gets (img header plus packets)
|
||||
//maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
|
||||
|
||||
cout<<"packetsPerFrame:"<<dec<<packetsPerFrame<<endl;
|
||||
cout<<"onePacketSize:"<<onePacketSize<<endl;
|
||||
cout<<"framsize:"<<frameSize<<endl;
|
||||
cout<<"bufferSize:"<<bufferSize<<endl;
|
||||
cout<<"maxPacketsPerFile:"<<maxPacketsPerFile<<endl;
|
||||
|
||||
|
||||
if(oldtengiga != enable){
|
||||
|
||||
//del
|
||||
if(thread_started){
|
||||
createListeningThreads(true);
|
||||
createWriterThreads(true);
|
||||
}
|
||||
for(int i=0;i<numListeningThreads;i++){
|
||||
if(mem0[i]) {free(mem0[i]); mem0[i] = NULL;}
|
||||
if(fifo[i]) {delete fifo[i]; fifo[i] = NULL;}
|
||||
if(fifoFree[i]) {delete fifoFree[i]; fifoFree[i] = NULL;}
|
||||
buffer[i] = NULL;
|
||||
}
|
||||
if(latestData) {delete [] latestData; latestData = NULL;}
|
||||
latestData = new char[frameSize];
|
||||
|
||||
numJobsPerThread = -1;
|
||||
setupFifoStructure();
|
||||
|
||||
if(createListeningThreads() == FAIL){
|
||||
cout << "ERROR: Could not create listening thread" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
if(createWriterThreads() == FAIL){
|
||||
cout << "ERROR: Could not create writer threads" << endl;
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
setThreadPriorities();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(receiver != NULL)
|
||||
;/*return receiver->getTenGigaBitEthernet();*/
|
||||
else
|
||||
return tengigaEnable;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2285,5 +2365,4 @@ void slsReceiverUDPFunctions::handleDataCompression(int ithread, char* wbuffer[]
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
//#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
#ifndef SLS_RECEIVER_UDP_FUNCTIONS_H
|
||||
#define SLS_RECEIVER_UDP_FUNCTIONS_H
|
||||
/********************************************//**
|
||||
@ -228,8 +228,12 @@ public:
|
||||
*/
|
||||
int enableDataCompression(bool enable);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* enable 10Gbe
|
||||
@param enable 1 for 10Gbe or 0 for 1 Gbe, -1 to read out
|
||||
\returns enable for 10Gbe
|
||||
*/
|
||||
int enableTenGiga(int enable = -1);
|
||||
|
||||
|
||||
|
||||
@ -631,6 +635,9 @@ private:
|
||||
/** variable used to self terminate threads waiting for semaphores */
|
||||
int killAllWritingThreads;
|
||||
|
||||
/** 10Gbe enable*/
|
||||
int tengigaEnable;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -755,4 +762,4 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user