eiger server: vcal=0, rx_fifodepth to greater than 32 bit, trimval argument range check, activate to both control and stop server, end of eiger server (if detectorip normal) set activate to 1 (for future eiger firmware), added setflippeddatax to users, removing warnings and check of detector size before accessing detector[0], updating subexptime also updated subperiod in master file, remove keeprunning in rxr that keeps it busy to semaphore

This commit is contained in:
2020-03-10 09:25:41 +01:00
parent 9649982932
commit d112956f79
24 changed files with 190 additions and 105 deletions

View File

@ -46,14 +46,14 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) {
fifoFree = new CircularFifo<char>(fifoDepth);
fifoStream = new CircularFifo<char>(fifoDepth);
//allocate memory
size_t mem_len = fifoItemSize * fifoDepth * sizeof(char);
size_t mem_len = (size_t)fifoItemSize * (size_t)fifoDepth * sizeof(char);
memory = (char*) malloc (mem_len);
if (memory == NULL){
FILE_LOG(logERROR) << "Could not allocate memory for fifos";
return FAIL;
}
memset(memory, 0, mem_len);
FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << mem_len << " bytes";
FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << (double)mem_len/(double)(1024 * 1024) << " MB";
{ //push free addresses into fifoFree fifo
char* buffer = memory;

View File

@ -397,7 +397,9 @@ void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
numDet[i] = size[i]*2;
else
numDet[i] = size[i];
sprintf(message,"%s%d",message,numDet[i]);
char cnum[20]="";
sprintf(cnum, "%d", numDet[i]);
strcat(message, cnum);
if (i < MAX_DIMENSIONS-1 )
strcat(message,",");
}
@ -650,7 +652,7 @@ void UDPBaseImplementation::setSubPeriod(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
subPeriod = i;
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subPeriod/(1E9) << "s";
FILE_LOG(logINFO) << "Sub Period: " << (double)subPeriod/(1E9) << "s";
}
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){

View File

@ -119,7 +119,9 @@ void UDPStandardImplementation::setMultiDetectorSize(const int* size) {
numDet[i] = size[i]*2;
else
numDet[i] = size[i];
sprintf(message,"%s%d",message,numDet[i]);
char cnum[20]="";
sprintf(cnum, "%d", numDet[i]);
strcat(message, cnum);
if (i < MAX_DIMENSIONS-1 )
strcat(message,",");
}
@ -834,7 +836,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
}
FILE_LOG(logINFO) << "Memory Allocated Per Fifo: " << ( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth) << " bytes" ;
FILE_LOG(logINFO) << "Memory Allocated Per Fifo: " << (double)( ((generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize)) * fifoDepth)/ (double)(1024 * 1024) << " MB" ;
FILE_LOG(logINFO) << numThreads << " Fifo structure(s) reconstructed";
return OK;
}

View File

@ -16,12 +16,12 @@
#include <sys/wait.h> //wait
#include <unistd.h> //usleep
#include <syscall.h>
#include <semaphore.h>
bool keeprunning;
sem_t semaphore;
void sigInterruptHandler(int p){
keeprunning = false;
sem_post(&semaphore);
}
/*
@ -65,7 +65,7 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
int main(int argc, char *argv[]) {
keeprunning = true;
sem_init(&semaphore,1,0);
cprintf(BLUE,"Created [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
// Catch signal SIGINT to close files and call destructors properly
@ -148,8 +148,8 @@ int main(int argc, char *argv[]) {
FILE_LOG(logINFO) << "Ready ... ";
cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n");
while(keeprunning)
pause();
sem_wait(&semaphore);
sem_destroy(&semaphore);
delete receiver;
cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid));

View File

@ -542,7 +542,7 @@ int slsReceiverTCPIPInterface::set_port() {
try {
mySocket = new MySocketTCP(p_number);
strcpy(mySock->lastClientIP,oldLastClientIP);
} catch(SamePortSocketException e) {
} catch(SamePortSocketException& e) {
ret = FAIL;
sprintf(mess, "Could not bind port %d. It is already set\n", p_number);
FILE_LOG(logERROR) << mess;
@ -1039,6 +1039,7 @@ int slsReceiverTCPIPInterface::set_timer() {
// else if (receiverBase->getStatus() != IDLE)
// receiverNotIdle();
else {
uint64_t subdeadtime = 0;
switch (index[0]) {
case ACQUISITION_TIME:
ret = receiverBase->setAcquisitionTime(index[1]);
@ -1052,7 +1053,9 @@ int slsReceiverTCPIPInterface::set_timer() {
receiverBase->setNumberOfFrames(index[1]);
break;
case SUBFRAME_ACQUISITION_TIME:
subdeadtime = receiverBase->getSubPeriod() - receiverBase->getSubExpTime();
receiverBase->setSubExpTime(index[1]);
receiverBase->setSubPeriod(receiverBase->getSubExpTime() + subdeadtime);
break;
case SUBFRAME_DEADTIME:
receiverBase->setSubPeriod(index[1] + receiverBase->getSubExpTime());