mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-08 19:10:42 +02:00
merging for gotthard, not done
This commit is contained in:
parent
1aff36efb8
commit
44870480be
@ -169,7 +169,9 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
#define EIGER_MAX_PORTS 2
|
#define EIGER_MAX_PORTS 2
|
||||||
#define EIGER_HEADER_LENGTH 48
|
#define EIGER_HEADER_PACKET_LENGTH 48
|
||||||
|
|
||||||
|
#define EIGER_HEADER_SIZE 8
|
||||||
|
|
||||||
#define EIGER_FIFO_SIZE 100
|
#define EIGER_FIFO_SIZE 100
|
||||||
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
||||||
|
@ -1219,7 +1219,7 @@ void UDPStandardImplementation::closeFile(int ithread){
|
|||||||
|
|
||||||
int UDPStandardImplementation::createDataCallbackThreads(bool destroy){
|
int UDPStandardImplementation::createDataCallbackThreads(bool destroy){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
if(!destroy) cprintf(MAGENTA,"Data Callback thread created\n"); else cprintf(MAGENTA,"Data Callback thread destroyed\n");
|
||||||
//reset masks
|
//reset masks
|
||||||
killAllDataCallbackThreads = false;
|
killAllDataCallbackThreads = false;
|
||||||
pthread_mutex_lock(&statusMutex);
|
pthread_mutex_lock(&statusMutex);
|
||||||
@ -1270,7 +1270,7 @@ int UDPStandardImplementation::createDataCallbackThreads(bool destroy){
|
|||||||
|
|
||||||
int UDPStandardImplementation::createListeningThreads(bool destroy){
|
int UDPStandardImplementation::createListeningThreads(bool destroy){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
if(!destroy) cprintf(BLUE,"Listening thread created\n"); else cprintf(BLUE,"Listening thread destroyed\n");
|
||||||
//reset masks
|
//reset masks
|
||||||
killAllListeningThreads = false;
|
killAllListeningThreads = false;
|
||||||
pthread_mutex_lock(&statusMutex);
|
pthread_mutex_lock(&statusMutex);
|
||||||
@ -1321,7 +1321,7 @@ int UDPStandardImplementation::createListeningThreads(bool destroy){
|
|||||||
|
|
||||||
int UDPStandardImplementation::createWriterThreads(bool destroy){
|
int UDPStandardImplementation::createWriterThreads(bool destroy){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
if(!destroy) cprintf(GREEN,"Writer thread created\n"); else cprintf(GREEN,"Writer thread destroyed\n");
|
||||||
//reset masks
|
//reset masks
|
||||||
killAllWritingThreads = false;
|
killAllWritingThreads = false;
|
||||||
pthread_mutex_lock(&statusMutex);
|
pthread_mutex_lock(&statusMutex);
|
||||||
@ -1439,7 +1439,7 @@ int UDPStandardImplementation::createUDPSockets(){
|
|||||||
shutDownUDPSockets();
|
shutDownUDPSockets();
|
||||||
int headerpacketsize = 0;
|
int headerpacketsize = 0;
|
||||||
if(myDetectorType == EIGER)
|
if(myDetectorType == EIGER)
|
||||||
headerpacketsize = EIGER_HEADER_LENGTH;
|
headerpacketsize = EIGER_HEADER_PACKET_LENGTH;
|
||||||
|
|
||||||
//if no eth, listen to all
|
//if no eth, listen to all
|
||||||
if(!strlen(eth)){
|
if(!strlen(eth)){
|
||||||
@ -1668,6 +1668,15 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
sprintf(hostName,"%s%d",hostName,portno);
|
sprintf(hostName,"%s%d",hostName,portno);
|
||||||
FILE_LOG(logINFO) << "Thread" << ithread << ": ZMQ Server at " << hostName;
|
FILE_LOG(logINFO) << "Thread" << ithread << ": ZMQ Server at " << hostName;
|
||||||
|
|
||||||
|
|
||||||
|
int headersize=0;
|
||||||
|
switch(myDetectorType){
|
||||||
|
case EIGER:
|
||||||
|
headersize = EIGER_HEADER_SIZE; break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* outer loop - loops once for each acquisition */
|
/* outer loop - loops once for each acquisition */
|
||||||
//infinite loop, exited only to change dynamic range, 10G parameters etc (then recreated again)
|
//infinite loop, exited only to change dynamic range, 10G parameters etc (then recreated again)
|
||||||
while(true){
|
while(true){
|
||||||
@ -1705,7 +1714,7 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
int frameIndex = -1;
|
int frameIndex = -1;
|
||||||
int subframeIndex = -1;
|
int subframeIndex = -1;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int oldpnum = 0;
|
int oldpnum = -1;
|
||||||
#endif
|
#endif
|
||||||
int datapacketscaught = 0;
|
int datapacketscaught = 0;
|
||||||
|
|
||||||
@ -1797,11 +1806,11 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
|
|
||||||
|
|
||||||
//last packet of same frame
|
//last packet of same frame
|
||||||
if(fnum == currentfnum && pnum == packetsPerFrame){
|
if(fnum == currentfnum && pnum == (packetsPerFrame-1)){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
oldpnum=0;
|
oldpnum=0;
|
||||||
#endif
|
#endif
|
||||||
memcpy(buffer+((pnum-1)*oneDataSize), latestData[ithread]+offset+8,oneDataSize);
|
memcpy(buffer+(pnum*oneDataSize), latestData[ithread]+offset+headersize,oneDataSize);
|
||||||
offset+= onePacketSize;
|
offset+= onePacketSize;
|
||||||
//send header
|
//send header
|
||||||
//update frame details
|
//update frame details
|
||||||
@ -1861,7 +1870,7 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
memset(buffer,0xFF,oneframesize);
|
memset(buffer,0xFF,oneframesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buffer+((pnum-1)*oneDataSize), latestData[ithread]+offset+8,oneDataSize);
|
memcpy(buffer+(pnum*oneDataSize), latestData[ithread]+offset+headersize,oneDataSize);
|
||||||
offset+= onePacketSize;
|
offset+= onePacketSize;
|
||||||
newFrame = true;
|
newFrame = true;
|
||||||
}
|
}
|
||||||
@ -3030,7 +3039,7 @@ int UDPStandardImplementation::getFrameandPacketNumber(int ithread, char* wbuffe
|
|||||||
FILE_LOG(logERROR) << "Fifo "<< ithread << ": Frame Number is zero from firmware.";
|
FILE_LOG(logERROR) << "Fifo "<< ithread << ": Frame Number is zero from firmware.";
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
packetnumber = (*( (uint16_t*) footer->packetNumber));
|
packetnumber = (*( (uint16_t*) footer->packetNumber))-1;
|
||||||
e_header = (eiger_packet_header_t*) (wbuffer);
|
e_header = (eiger_packet_header_t*) (wbuffer);
|
||||||
subframenumber = *( (uint32_t*) e_header->subFrameNumber);
|
subframenumber = *( (uint32_t*) e_header->subFrameNumber);
|
||||||
#ifdef DEBUG4
|
#ifdef DEBUG4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user