Compare commits

..

36 Commits
4.1.0 ... 4.2.0

Author SHA1 Message Date
040cc9c14f Merge branch 'main-rc' into b4.2.0 2020-11-30 17:14:08 +01:00
0a1c4992e2 Merge branch 'main-rc' into b4.1.1 2020-11-30 17:12:26 +01:00
46e0c0abed Merge branch 'main' into test 2020-11-20 14:29:21 +01:00
a5f0f6eb34 Merge branch 'main' into test 2020-11-20 14:28:29 +01:00
876207c8cd version 2020-04-14 16:49:51 +02:00
ec21624aeb updated git versions 2020-04-14 09:30:04 +02:00
1de5b85ce2 Merge branch '4.2.0-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.2.0-rc 2020-04-08 11:50:12 +02:00
b4e4033736 eiger: update tengiga instop server as well to fix transmitting for 10g 2020-04-08 11:49:28 +02:00
820bc01505 eiger: update tengiga instop server as well (no binaries yet) 2020-04-08 11:45:26 +02:00
4e54d1c318 eiger: default clkspeed full speed for dr 16 2020-04-07 09:35:43 +02:00
dec4183e0f updated release.txt 2020-04-07 09:25:30 +02:00
feed09f2f4 updated binaries 2020-04-07 09:18:50 +02:00
c6aa8d6072 eiger: default flag is parallel, updated release.txt, yet to update binaries 2020-04-07 09:12:25 +02:00
4ec38a071c eiger: removed print in server for addresstoall 2020-04-03 11:06:04 +02:00
0c4b721e13 eiger server: transmitting (data) status 2020-04-03 11:02:15 +02:00
fae884e658 change to release.txt 2020-04-03 10:03:10 +02:00
f20f084991 eiger receiver: changing dr changes rx_fifodepth to their defaults 2020-04-03 09:58:58 +02:00
20ce79872f updates release.txt 2020-04-03 09:41:04 +02:00
328375924f eiger client: clkdivider set to 0 for dr of 4, 8, 16 and to 2 for dr 32 2020-04-03 09:38:11 +02:00
a1d91e590e rx: fifodepth error will set fifodepth to 0 2020-04-02 18:24:18 +02:00
679db120b0 eiger server updated in serverbin 2020-04-02 17:49:46 +02:00
7a6797b23e zmq sockets client checked before creating them 2020-03-11 11:09:41 +01:00
93f8e8ecb3 updated release.txt, rxr optimization (no file buffering, write to every page at memory allocation, fix to fifo depth 2020-03-10 10:59:30 +01:00
d112956f79 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 2020-03-10 09:25:41 +01:00
9649982932 sw trigger with acquire and parameter file understands submodules 2020-01-15 11:22:40 +01:00
eca2836703 Merge branch '4.1.1' of github.com:slsdetectorgroup/slsDetectorPackage into 4.1.1 2020-01-14 16:25:57 +01:00
d14c9600bb conda version 2020-01-14 16:24:10 +01:00
42971c94b7 updated versioning 2020-01-14 16:16:45 +01:00
b0fd4f4c44 updated release doc 2020-01-14 16:11:24 +01:00
06473cfcb2 bug fix: software trigger using control connect 2020-01-14 13:59:08 +01:00
6f2aad3836 updated temporary versioning 2020-01-06 19:01:44 +01:00
38aad40fef read/write of config/parameter file rewritten so that parameter file can take in slsdetector level commands 2020-01-06 18:16:41 +01:00
51c5520472 unregistering call back, detangling receiver streaming from callback 2020-01-06 11:51:19 +01:00
75838f77b3 unregistering call back, detangling receiver streaming from callback 2020-01-06 11:50:08 +01:00
54bedeaa0a software trigger via stop server instead of control server for sls_detector_acquire 2020-01-06 11:31:05 +01:00
b33b2edbd0 bug fix: locks in acquire 2020-01-06 11:29:11 +01:00
50 changed files with 926 additions and 996 deletions

View File

@ -41,4 +41,4 @@ deploy:
provider: script
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on:
branch: 4.1.0
branch: 4.2.0

View File

@ -1,14 +1,14 @@
SLS Detector Package 4.1.0 released on 04.10.2019 (Minor Release)
=================================================================
SLS Detector Package 4.2.0 released on 09.04.2020 (Minor Release)
===================================================================
This document describes the differences between 4.1.0 and 4.0.2 releases.
This document describes the differences between 4.2.0 and 4.1.1 releases.
CONTENTS
--------
1. Topics Concerning
2. Resolved Issues
3. Known Issues
2. New Features
3. Resolved Issues
4. Firmware Requirements
5. Download, Documentation & Support
@ -17,59 +17,107 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
1. Topics Concerning
====================
- software for eiger quad hardware integrated
- command line framesl, cyclesl was printing in float (jungfrau, gotthard)
- eiger interrupt subframe flag
- eiger server reg command (+0x100 for left and +0x200 for right)
- additional eiger parameters included i master file
- (Eiger) Additional status: Transmitting
- (Eiger) Default vcal dac value
- (Eiger) Default readout mode
- (Eiger) Dynamic range change effect on clock divider
- (Eiger) Deactivate a module
- (Eiger) Setting all trimbits argument check
- (Receiver) performance (memory allocation and alignment, file buffering)
- (Receiver) Eiger: Different rx_fifodepth defaults
- (Receiver) rx_fifodepth has a higher range
- (Receiver) subperiod in master file
- (Package) Removed warnings including memory overlap copy
- (Users) Added setflippeddatax to users class
- (Zmq) Client data streaming fix (Client data call back)
Compared to 4.1.1,
- no firmware update required for this release
- eiger on-board detector server update required for this release
2. Resolved Issues
==================
2. New Features
===============
Receiver
--------
1. Memory in receiver is now byte aligned and write to every page
at memory allocation to ensure complete memory allocated right
from start. Removed file buffering when writing to file. Replaced
pausing on keepRunning variable with semaphore to reduce cpu
load.
2. (Eiger) Default rx_fifodepth for 32 bit mode is 100, but 1000
for other modes. Changing dynamic range will now change bit mode to
their defaults.
Client
------
1. Command line quad integrates Eiger quad hardware
2. Command line commands framesl, cyclesl, fatesl, problesl and nframes was
printing the result in decimals. It is now fixed to print as whole numbers.
1. Added setflippeddatax to users class.
Detector Server (Eiger)
-----------------------
1. Transmitting Status: After acquiring, if the detector is still
streaming out data, then the status is Trasnmitting
(command line: 'data'). Only after this process, will it become idle.
Previously, sls_detector_acquire waited for end of data streaming
before returning. It will continue to do so.
1. Command line quad integrates Eiger quad hardware
2. Control flag to set last subframe to be interrupted depending on subexptime.
By default, it is disabled and will wait till the last sub frame has finished
exposing.
3. Left and Right FEB registers accessed independently using addr (+0x100 and +0x200)
respectively.
3. Resolved Issues
==================
Detector Server (Eiger)
-----------------------
1. Vcal dac set to 0 at on-board detector server start up to
reduce noise.
2. Default Readout mode set to Parallel instead of Non parallel.
3. Dynamic range 4, 8 or 16 changes the clock divider to full speed,
whereas dynamic range of 32 still changes the clock divider to
quarter speed. So, default is dynamic range of 16 and full speed
at detector server start up.
4. Setting activate to 0 sent to both control and stop server.
So, deactivate a module can be done even if FEB communication fails.
Restarting the server will activate the module again.
5. Verification included for input of setting all trimbits values.
Valid input is 0 - 63.
Receiver
--------
1. Command line quad integrates Eiger quad hardware
1. Earlier, setting rx_fifodepth to a high value would set to
a lower value, printing this low value to console,
but not giving an error. Memory allocated can now take in 64 bits.
2. Master file has additional parameters for Eiger (Quad Enable, Gap Pixels Enable).
Writer version update to 4.0.
3. Zmq Json Header has additional informaion
2. Modifying subexptime now also updates subperiod in master file.
Also, the print for subperiod name to console is corrected.
Package
-------
1. Many warnings have been fixed, including those with overlapping
memory copies for source and destination.
3. Known Issues
===============
Client
------
1. Each time client data streaming was enabled to receive, it
creates zmq sockets without checking if they were already created.
This is fixed now.
4. Firmware Requirements
========================
Gotthard
========
Minimum compatible version : 11.01.2013

View File

@ -31,6 +31,7 @@ It is linked in manual/manual-api from slsReceiverSoftware/include ]
#include <unistd.h> //usleep
#include <errno.h>
#include <syscall.h> //tid
#include <semaphore.h>
using namespace std;
@ -38,15 +39,15 @@ using namespace std;
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
/** Variable is true to continue running, set to false upon interrupt */
bool keeprunning;
/** Semaphore that waits, interrupted upon end */
sem_t semaphore;
/**
* Control+C Interrupt Handler
* Sets the variable keeprunning to false, to let all the processes know to exit properly
* pushes semaphore to stop waiting, to let all the processes know to exit properly
*/
void sigInterruptHandler(int p){
keeprunning = false;
sem_post(&semaphore);
}
/**
@ -170,7 +171,7 @@ int main(int argc, char *argv[]) {
int numReceivers = 1;
int startTCPPort = 1954;
int withCallback = 0;
keeprunning = true;
sem_init(&semaphore,1,0);
/** - get number of receivers and start tcp port from command line arguments */
if ( (argc != 4) || (!sscanf(argv[1],"%d", &startTCPPort)) || (!sscanf(argv[2],"%d", &numReceivers)) || (!sscanf(argv[3],"%d", &withCallback)) )
@ -257,9 +258,9 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
/** - as long as keeprunning is true (changes with Ctrl+C) */
while(keeprunning)
pause();
/** - as long as semaphore waits (changes with Ctrl+C) */
sem_wait(&semaphore);
sem_destroy(&semaphore);
/** - interrupt caught, delete slsReceiverUsers object and exit */
delete receiver;
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long)syscall(SYS_gettid));

Binary file not shown.

View File

@ -176,6 +176,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
\begin{verbatim}
sls_detector_put 0-parameters setup.det
\end{verbatim}
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
Other important settings that are configured in the {\tt{setup.det}} file are:
@ -621,6 +622,7 @@ Here are the implemented options so far:
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.

View File

@ -1,12 +1,12 @@
package:
name: sls_detector_software
version: 4.1.0
version: 4.2.0
source:
- path: ..
build:
number: 1
number: 0
rpaths:
- lib/
@ -50,14 +50,14 @@ requirements:
outputs:
- name: sls_detector_lib
version: 4.1.0
version: 4.2.0
script: copy_lib.sh
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- name: sls_detector_gui
version: 4.1.0
version: 4.2.0
script: copy_gui.sh
requirements:
build:
@ -81,5 +81,5 @@ outputs:
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
run:
- sls_detector_lib=4.1.0
- sls_detector_lib=4.2.0
- qwt 6.1.4=hf484d3e_1001

View File

@ -1 +0,0 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.1.0.24.5

View File

@ -0,0 +1 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.2.0.24.2

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorGui
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 532
Branch: 4.1.0
Repsitory UUID: 1de5b85ce2f40a83dae99272160d6574bb7e788e
Revision: 538
Branch: 4.2.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./src/qTabSettings.cpp
Last Changed Rev: 4175
Last Changed Date: 2020-04-14 09:09:45.535926413 +0200 ./src/qTabSettings.cpp

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
#define GITREPUUID "1de5b85ce2f40a83dae99272160d6574bb7e788e"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4141
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0"
#define GITREV 0x4175
#define GITDATE 0x20200414
#define GITBRANCH "4.2.0"

View File

@ -85,15 +85,21 @@ public:
static double getNSTime(timeUnit unit, double value){
double valueNS=value;
switch(unit){
case HOURS: valueNS*=60;
case MINUTES: valueNS*=60;
case SECONDS: valueNS*=1000;
case MILLISECONDS: valueNS*=1000;
case MICROSECONDS: valueNS*=1000;
case HOURS:
return valueNS * 60 * 60 * 1000 * 1000 * 1000;
case MINUTES:
return valueNS * 60 * 1000 * 1000 * 1000;
case SECONDS:
return valueNS * 1000 * 1000 * 1000;
case MILLISECONDS:
return valueNS * 1000 * 1000;
case MICROSECONDS:
return valueNS * 1000;
case NANOSECONDS:
default:;
return valueNS;
default:
return 0;
}
return valueNS;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -373,6 +373,9 @@ void qDrawPlot::SetupWidgetWindow(){
// callbacks
// Setting the callback function to get data from detector class
if (myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) {
myDet->enableDataStreamingFromReceiver(1);
}
myDet->registerDataCallback(&(GetDataCallBack),this); // also enables data streaming in client and receiver (if receiver exists)
//Setting the callback function to alert when acquisition finished from detector class
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);

View File

@ -25,6 +25,8 @@
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
#define MULTI_HAVE_DIFFERENT_VALUES 0x4000000000000000ULL
#define MULTI_CONFIG_FILE_ERROR 0x2000000000000000ULL
#define MULTI_PARM_FILE_ERROR 0x1000000000000000ULL
// sls errors
#define CRITICAL_ERROR_MASK 0xFFFFFFF
@ -302,7 +304,7 @@ public:
retval.append("Could not set/get auto comparator disable\n");
if(slsErrorMask&CONFIG_FILE)
retval.append("Could not load/write config file\n");
retval.append("Could not load/write config/parameter file\n");
//------------------------------------------------------ length of message

View File

@ -180,131 +180,103 @@ void Beb_GetModuleConfiguration(int* master, int* top, int* normal){
}
}
void Beb_EndofDataSend(int tengiga){
int Beb_IsTransmitting(int* retval, int tengiga, int waitForDelay) {
//mapping new memory
u_int32_t* csp0base=0;
int l_framepktLsbcounter, l_framepktMsbcounter, l_txndelaycounter, l_framedelaycounter;
int r_framepktLsbcounter, r_framepktMsbcounter, r_txndelaycounter, r_framedelaycounter;
int l_framepktLsbcounter_new, l_framepktMsbcounter_new, l_txndelaycounter_new, l_framedelaycounter_new;
int r_framepktLsbcounter_new, r_framepktMsbcounter_new, r_txndelaycounter_new, r_framedelaycounter_new;
int addr_l_framepktLsbcounter, addr_l_framepktMsbcounter, addr_l_txndelaycounter, addr_l_framedelaycounter;
int addr_r_framepktLsbcounter, addr_r_framepktMsbcounter, addr_r_txndelaycounter, addr_r_framedelaycounter;
switch(tengiga){
case 0:
addr_l_framepktLsbcounter = ONE_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = ONE_GIGA_LEFT_INDEX_MSB_COUNTER;
addr_l_txndelaycounter = ONE_GIGA_LEFT_TXN_DELAY_COUNTER;
addr_l_framedelaycounter = ONE_GIGA_LEFT_FRAME_DELAY_COUNTER;
addr_r_framepktLsbcounter = ONE_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = ONE_GIGA_RIGHT_INDEX_MSB_COUNTER;
addr_r_txndelaycounter = ONE_GIGA_RIGHT_TXN_DELAY_COUNTER;
addr_r_framedelaycounter = ONE_GIGA_RIGHT_FRAME_DELAY_COUNTER;
break;
case 1:
addr_l_framepktLsbcounter = TEN_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = TEN_GIGA_LEFT_INDEX_MSB_COUNTER;
u_int32_t* csp0base = 0;
int addr_l_txndelaycounter = 0, addr_l_framedelaycounter = 0;
int addr_r_txndelaycounter = 0, addr_r_framedelaycounter = 0;
int addr_l_framepktLsbcounter = 0, addr_l_framepktMsbcounter = 0;
int addr_r_framepktLsbcounter = 0, addr_r_framepktMsbcounter = 0;
if (tengiga) {
addr_l_txndelaycounter = TEN_GIGA_LEFT_TXN_DELAY_COUNTER;
addr_l_framedelaycounter = TEN_GIGA_LEFT_FRAME_DELAY_COUNTER;
addr_r_framepktLsbcounter = TEN_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = TEN_GIGA_RIGHT_INDEX_MSB_COUNTER;
addr_r_txndelaycounter = TEN_GIGA_RIGHT_TXN_DELAY_COUNTER;
addr_r_framedelaycounter = TEN_GIGA_RIGHT_FRAME_DELAY_COUNTER;
break;
addr_l_framepktLsbcounter = TEN_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = TEN_GIGA_LEFT_INDEX_MSB_COUNTER;
addr_r_framepktLsbcounter = TEN_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = TEN_GIGA_RIGHT_INDEX_MSB_COUNTER;
} else {
addr_l_txndelaycounter = ONE_GIGA_LEFT_TXN_DELAY_COUNTER;
addr_l_framedelaycounter = ONE_GIGA_LEFT_FRAME_DELAY_COUNTER;
addr_r_txndelaycounter = ONE_GIGA_RIGHT_TXN_DELAY_COUNTER;
addr_r_framedelaycounter = ONE_GIGA_RIGHT_FRAME_DELAY_COUNTER;
addr_l_framepktLsbcounter = ONE_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = ONE_GIGA_LEFT_INDEX_MSB_COUNTER;
addr_r_framepktLsbcounter = ONE_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = ONE_GIGA_RIGHT_INDEX_MSB_COUNTER;
}
//open file pointer
int fd = Beb_open(&csp0base,XPAR_COUNTER_BASEADDR);
if(fd < 0){
cprintf(BG_RED,"Delay read counter fail\n");
return;
}else{
cprintf(BG_RED,"Could not read Beb Delay read counter\n");
return FAIL;
} else {
//read data first time
l_framepktLsbcounter = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
l_framepktMsbcounter = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
l_txndelaycounter = Beb_Read32(csp0base, addr_l_txndelaycounter);
l_framedelaycounter = Beb_Read32(csp0base, addr_l_framedelaycounter);
r_framepktLsbcounter = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
r_framepktMsbcounter = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
r_txndelaycounter = Beb_Read32(csp0base, addr_r_txndelaycounter);
r_framedelaycounter = Beb_Read32(csp0base, addr_r_framedelaycounter);
//#ifdef VERBOSE
printf("\nLeft\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n"
"\nRight\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n\n",
l_framepktLsbcounter,l_framepktMsbcounter,l_txndelaycounter,l_framedelaycounter,
r_framepktLsbcounter,r_framepktMsbcounter,r_txndelaycounter,r_framedelaycounter);
//#endif
//keep comparing with previous values
int maxtimer;
while(1){
maxtimer = MAX(MAX(l_txndelaycounter,l_framedelaycounter),MAX(r_txndelaycounter,r_framedelaycounter));
maxtimer /= 100;
printf("Will wait for %d us\n",maxtimer);
usleep(maxtimer);
//read new values
l_framepktLsbcounter_new = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
l_framepktMsbcounter_new = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
l_txndelaycounter_new = Beb_Read32(csp0base, addr_l_txndelaycounter);
l_framedelaycounter_new = Beb_Read32(csp0base, addr_l_framedelaycounter);
r_framepktLsbcounter_new = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
r_framepktMsbcounter_new = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
r_txndelaycounter_new = Beb_Read32(csp0base, addr_r_txndelaycounter);
r_framedelaycounter_new = Beb_Read32(csp0base, addr_r_framedelaycounter);
//#ifdef VERBOSE
printf("\nLeft\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n"
"\nRight\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n\n",
l_framepktLsbcounter_new,l_framepktMsbcounter_new,l_txndelaycounter_new,l_framedelaycounter_new,
r_framepktLsbcounter_new,r_framepktMsbcounter_new,r_txndelaycounter_new,r_framedelaycounter_new);
//#endif
if ((l_framepktLsbcounter == l_framepktLsbcounter_new) &&
(l_framepktMsbcounter == l_framepktMsbcounter_new) &&
(r_framepktLsbcounter == r_framepktLsbcounter_new) &&
(r_framepktMsbcounter == r_framepktMsbcounter_new))
break;
//update old values
l_framepktLsbcounter = l_framepktLsbcounter_new;
l_framepktMsbcounter = l_framepktMsbcounter_new;
l_txndelaycounter = l_txndelaycounter_new;
l_framedelaycounter = l_framedelaycounter_new;
r_framepktLsbcounter = r_framepktLsbcounter_new;
r_framepktMsbcounter = r_framepktMsbcounter_new;
r_txndelaycounter = r_txndelaycounter_new;
r_framedelaycounter = r_framedelaycounter_new;
int l_txndelaycounter = Beb_Read32(csp0base, addr_l_txndelaycounter);
int l_framedelaycounter = Beb_Read32(csp0base, addr_l_framedelaycounter);
int r_txndelaycounter = Beb_Read32(csp0base, addr_r_txndelaycounter);
int r_framedelaycounter = Beb_Read32(csp0base, addr_r_framedelaycounter);
int l_framepktLsbcounter = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
int l_framepktMsbcounter = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
int r_framepktLsbcounter = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
int r_framepktMsbcounter = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
#ifdef VERBOSE
printf("\nFirst Read:\n"
"\tLeft [Txndelaycounter:%d, Framedelaycounter:%d]\n"
"\tRight [Txndelaycounter:%d, Framedelaycounter:%d]\n",
"\tLeft [FramepacketLsbcounter:%d, FramepacketMsbcounter:%d]\n"
"\tRight [FramepacketLsbcounter:%d, FramepacketMsbcounter:%d]\n",
l_txndelaycounter,l_framedelaycounter, r_txndelaycounter,r_framedelaycounter,
l_framepktLsbcounter, l_framepktMsbcounter, r_framepktLsbcounter, r_framepktMsbcounter);
#endif
// wait for max counter delay
if (waitForDelay) {
int maxtimer = (MAX(MAX(l_txndelaycounter,l_framedelaycounter),MAX(r_txndelaycounter,r_framedelaycounter))) / 100; // counter values in 10 ns
printf("Will wait for %d us\n", maxtimer);
usleep (maxtimer);
}
// wait for 1 ms
else {
printf("Will wait for 1 ms\n");
usleep (1 * 1000);
}
printf("Detector has send all data\n");
// read values again
int l_txndelaycounter2 = Beb_Read32(csp0base, addr_l_txndelaycounter);
int l_framedelaycounter2 = Beb_Read32(csp0base, addr_l_framedelaycounter);
int r_txndelaycounter2 = Beb_Read32(csp0base, addr_r_txndelaycounter);
int r_framedelaycounter2 = Beb_Read32(csp0base, addr_r_framedelaycounter);
int l_framepktLsbcounter2 = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
int l_framepktMsbcounter2 = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
int r_framepktLsbcounter2 = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
int r_framepktMsbcounter2 = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
#ifdef VERBOSE
printf("\nSecond Read:\n"
"\tLeft [Txndelaycounter:%d, Framedelaycounter:%d]\n"
"\tRight [Txndelaycounter:%d, Framedelaycounter:%d]\n",
"\tLeft [FramepacketLsbcounter:%d, FramepacketMsbcounter:%d]\n"
"\tRight [FramepacketLsbcounter:%d, FramepacketMsbcounter:%d]\n",
l_txndelaycounter2,l_framedelaycounter2, r_txndelaycounter2,r_framedelaycounter2,
l_framepktLsbcounter2, l_framepktMsbcounter2, r_framepktLsbcounter2, r_framepktMsbcounter2);
#endif
// any change in values, it is still transmitting
if (l_txndelaycounter != l_txndelaycounter2 || l_framedelaycounter != l_framedelaycounter2 ||
r_txndelaycounter != r_txndelaycounter2 || r_framedelaycounter != r_framedelaycounter2 ||
l_framepktLsbcounter != l_framepktLsbcounter2 || l_framepktMsbcounter != l_framepktMsbcounter2 ||
r_framepktLsbcounter != r_framepktLsbcounter2 || r_framepktMsbcounter != r_framepktMsbcounter2) {
*retval = 1;
} else {
*retval = 0;
}
//close file pointer
Beb_close(fd,csp0base);
}
return OK;
}
/* do not work at the moment */
int Beb_SetMasterViaSoftware(){

View File

@ -46,7 +46,7 @@ struct BebInfo{
void Beb_GetModuleConfiguration(int* master, int* top, int* normal);
void Beb_EndofDataSend(int tengiga);
int Beb_IsTransmitting(int* retval, int tengiga, int waitForDelay);
int Beb_SetMasterViaSoftware();
int Beb_SetSlaveViaSoftware();

View File

@ -1017,7 +1017,8 @@ unsigned int* Feb_Control_GetTrimbits(){
unsigned int Feb_Control_AddressToAll(){printf("in Feb_Control_AddressToAll()\n");
unsigned int Feb_Control_AddressToAll(){
//printf("in Feb_Control_AddressToAll()\n");

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: e4645a8273c8265bc584579d5f7f8eb6dc4379f7
Revision: 360
Branch: 4.1.0-rc
Last Changed Author: GitHub_GitHub
Last Changed Rev: 4138
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./xparameters.h
Repsitory UUID: fae884e65851d15bd0ca541956b3263cf79bc1b2
Revision: 362
Branch: 4.2.0-rc
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4166
Last Changed Date: 2020-04-03 10:42:36.000000001 +0200 ./Beb.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "e4645a8273c8265bc584579d5f7f8eb6dc4379f7"
#define GITAUTH "GitHub_GitHub"
#define GITREV 0x4138
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0-rc"
#define GITREPUUID "fae884e65851d15bd0ca541956b3263cf79bc1b2"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4166
#define GITDATE 0x20200403
#define GITBRANCH "4.2.0-rc"

View File

@ -284,6 +284,9 @@ u_int32_t getDetectorIP(){
FILE* sysFile = popen("ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2", "r");
fgets(output, sizeof(output), sysFile);
pclose(sysFile);
if (strlen(output) <= 1) {
return 0;
}
//converting IPaddress to hex.
char* pcword = strtok (output,".");
@ -329,7 +332,16 @@ void initControlServer(){
setupDetector();
#endif
// activate (if it gets ip) (later FW will deactivate at startup)
if (getDetectorIP() != 0) {
Beb_Activate(1);
Feb_Control_activate(1);
} else {
Beb_Activate(0);
Feb_Control_activate(0);
}
#endif
printf("\n");
}
@ -344,6 +356,16 @@ void initStopServer(){
Feb_Control_FebControl();
Feb_Control_Init(master,top,normal,getDetectorNumber());
printf("FEB Initialization done\n");
// activate (if it gets ip) (later FW will deactivate at startup)
// also needed for stop server for status
if (getDetectorIP() != 0) {
Beb_Activate(1);
Feb_Control_activate(1);
} else {
Beb_Activate(0);
Feb_Control_activate(0);
}
#endif
printf("\n");
}
@ -1715,19 +1737,23 @@ enum runStatus getRunStatus(){
#else
int i = Feb_Control_AcquisitionInProgress();
switch (i) {
case STATUS_ERROR:
if (i == STATUS_ERROR) {
printf("Status: ERROR reading status register\n");
return ERROR;
case STATUS_IDLE:
} else if (i == STATUS_IDLE) {
int isTransmitting = 0;
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 0) == FAIL) {
return ERROR;
}
if (isTransmitting) {
printf("Status: TRANSMITTING\n");
return TRANSMITTING;
}
printf("Status: IDLE\n");
return IDLE;
default:
printf("Status: RUNNING...\n");
return RUNNING;
}
return IDLE;
printf("Status: RUNNING...\n");
return RUNNING;
#endif
}
@ -1761,8 +1787,18 @@ void readFrame(int *ret, char *mess){
}
//wait for detector to send
Beb_EndofDataSend(send_to_ten_gig);
int isTransmitting = 1;
while (isTransmitting) {
if (Beb_IsTransmitting(&isTransmitting, send_to_ten_gig, 1) == FAIL) {
strcpy(mess,"Could not read delay counters\n");
*ret = (int)FAIL;
return;
}
if (isTransmitting) {
printf("Transmitting...\n");
}
}
printf("Detector has sent all data\n");
printf("*****Done Waiting...\n");
*ret = (int)FINISHED;

View File

@ -31,7 +31,7 @@ enum DACINDEX {SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RX
2556, /* Vtgstv */ \
1000, /* Vcmp_ll */ \
1000, /* Vcmp_lr */ \
4000, /* cal */ \
0, /* cal */ \
1000, /* Vcmp_rl */ \
1100, /* rxb_rb */ \
1100, /* rxb_lb */ \
@ -77,10 +77,10 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
#define DEFAULT_SUBFRAME_DEADTIME (0)
#define DEFAULT_DYNAMIC_RANGE (16)
#define DEFAULT_READOUT_MODE (NONPARALLEL)
#define DEFAULT_READOUT_MODE (PARALLEL)
#define DEFAULT_READOUT_STOREINRAM_MODE (CONTINOUS_RO)
#define DEFAULT_READOUT_OVERFLOW32_MODE (NOOVERFLOW)
#define DEFAULT_CLK_SPEED (HALF_SPEED)
#define DEFAULT_CLK_SPEED (FULL_SPEED)
#define DEFAULT_IO_DELAY (650)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_PHOTON_ENERGY (-1)
@ -90,6 +90,7 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
#define DEFAULT_TEST_MODE (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define MAX_TRIMBITS_VALUE (63)
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS (0x1FFFFFFF) /** 29 bit register for max subframe exposure value */

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 2094
Branch: 4.1.0
Repsitory UUID: 1de5b85ce2f40a83dae99272160d6574bb7e788e
Revision: 2112
Branch: 4.2.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 10:33:35.000000001 +0200 ./threadFiles/ThreadPool.o
Last Changed Rev: 4175
Last Changed Date: 2020-04-14 09:18:10.968379834 +0200 ./sharedMemory/SharedMemory.o

View File

@ -26,6 +26,7 @@ ID: $Id$
#include <rapidjson/document.h> //json header in zmq stream
#include <sys/ipc.h>
#include <sys/shm.h>
#include <iterator>
@ -523,7 +524,10 @@ std::string multiSlsDetector::getErrorMessage(int& critical) {
retval.append("Could not load Config File\n");
critical = 0;
}
if (multiMask & MULTI_PARM_FILE_ERROR) {
retval.append("Could not load parameter File\n");
critical = 0;
}
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
//if the detector has error
if (multiMask & (1 << idet)) {
@ -1441,176 +1445,382 @@ int multiSlsDetector::readConfigurationFile(std::string const fname) {
freeSharedMemory();
setupMultiDetector();
multiSlsDetectorClient* cmd;
std::string ans;
std::string str;
std::ifstream infile;
int iargval;
int interrupt = 0;
char* args[1000];
char myargs[1000][1000];
std::string sargname, sargval;
int iline = 0;
std::cout << "config file name " << fname << std::endl;
infile.open(fname.c_str(), std::ios_base::in);
if (infile.is_open()) {
while (infile.good() and interrupt == 0) {
sargname = "none";
sargval = "0";
getline(infile, str);
++iline;
// remove comments that come after
if (str.find('#') != std::string::npos)
str.erase(str.find('#'));
#ifdef VERBOSE
std::cout << "string:" << str << std::endl;
#endif
if (str.length() < 2) {
#ifdef VERBOSE
std::cout << "Empty line or Comment " << std::endl;
#endif
continue;
} else {
std::istringstream ssstr(str);
iargval = 0;
while (ssstr.good()) {
ssstr >> sargname;
#ifdef VERBOSE
std::cout << iargval << " " << sargname << std::endl;
#endif
strcpy(myargs[iargval], sargname.c_str());
args[iargval] = myargs[iargval];
#ifdef VERBOSE
std::cout << "--" << iargval << " " << args[iargval] << std::endl;
#endif
++iargval;
}
#ifdef VERBOSE
cout << endl;
for (int ia = 0; ia < iargval; ia++)
cout << args[ia] << " ??????? ";
cout << endl;
#endif
cmd = new multiSlsDetectorClient(iargval, args, PUT_ACTION, this);
delete cmd;
}
++iline;
}
infile.close();
} else {
std::cout << "Error opening configuration file " << fname << " for reading" << std::endl;
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
return FAIL;
std::ifstream inFile;
inFile.open(fname.c_str(), std::ifstream::in);
if (!inFile.is_open()) {
cprintf(RED, "Cannot open config file %s\n", fname.c_str());
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
return FAIL;
}
#ifdef VERBOSE
std::cout << "Read configuration file of " << iline << " lines" << std::endl;
#endif
while(inFile.good()) {
std::string sLine;
getline(inFile,sLine);
// delete lines after comments
if (sLine.find('#') != std::string::npos) {
sLine.erase(sLine.find('#'));
}
// scan arguments
std::istringstream iss(sLine);
std::vector<std::string> vec = std::vector<std::string>(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>());
// blank lines
if (vec.size() == 0 || vec[0].empty()) {
continue;
}
int iarg = vec.size();
// copy to char array
char arr[iarg][MAX_STR_LENGTH];
memset(arr, 0, sizeof(arr));
char* args[iarg];
for (int i = 0; i < iarg; ++i) {
args[i] = arr[i];
strcpy(args[i], vec[i].c_str());
}
// execute command
multiSlsDetectorClient(iarg, args, PUT_ACTION, this);
}
inFile.close();
setNumberOfModules(-1);
getMaxNumberOfModules();
// check error
if (getErrorMask()) {
int c;
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
}
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
std::vector <std::string> commands;
commands.push_back("master");
commands.push_back("sync");
commands.push_back("outdir");
commands.push_back("ffdir");
commands.push_back("headerbefore");
commands.push_back("headerafter");
commands.push_back("headerbeforepar");
commands.push_back("headerafterpar");
commands.push_back("badchannels");
commands.push_back("angconv");
commands.push_back("globaloff");
commands.push_back("binsize");
commands.push_back("threaded");
std::ofstream outfile;
outfile.open(fname.c_str(), std::ios_base::out);
if (!outfile.is_open()) {
cprintf(RED, "Cannot open config file %s for writing\n", fname.c_str());
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
return FAIL;
}
int ret = OK;
slsDetectorCommand* cmd = new slsDetectorCommand(this);
char arr[MAX_STR_LENGTH];
char* args[1];
args[0] = arr;
// detsizechan
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], "detsizechan");
outfile << args[0] << ' ' << cmd->executeLine(1, args, GET_ACTION) << std::endl;
// hostname
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], "hostname");
outfile << args[0] << ' ' << cmd->executeLine(1, args, GET_ACTION) << std::endl;
// single detector configuration
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
outfile << endl;
int ret1 = detectors[idet]->writeConfigurationFile(outfile, idet);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret1 == FAIL)
ret = FAIL;
}
// other configurations
outfile << endl;
for (unsigned int i = 0; i < commands.size(); ++i) {
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], commands[i].c_str());
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
}
delete cmd;
outfile.close();
if (ret == FAIL || getErrorMask()) {
int c;
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
}
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
int multiSlsDetector::retrieveDetectorSetup(std::string const fname1, int level){
std::string fname = fname1;
// setup
if (level==2) {
fname += std::string(".det");
}
std::string names[] = {
"detsizechan",
"hostname",
"master",
"sync",
"outdir",
"ffdir",
"headerbefore",
"headerafter",
"headerbeforepar",
"headerafterpar",
"badchannels",
"angconv",
"globaloff",
"binsize",
"threaded"
};
int nvar = 15;
char* args[100];
for (int ia = 0; ia < 100; ++ia) {
args[ia] = new char[1000];
std::ifstream inFile;
inFile.open(fname.c_str(), std::ifstream::in);
if (!inFile.is_open()) {
cprintf(RED, "Cannot open parameter file %s\n", fname.c_str());
setErrorMask(getErrorMask() | MULTI_PARM_FILE_ERROR);
return FAIL;
}
int ret = OK, ret1 = OK;
std::ofstream outfile;
int iline = 0;
outfile.open(fname.c_str(), std::ios_base::out);
if (outfile.is_open()) {
slsDetectorCommand* cmd = new slsDetectorCommand(this);
// complete size of detector
cout << iline << " " << names[iline] << endl;
strcpy(args[0], names[iline].c_str());
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
++iline;
// hostname of the detectors
cout << iline << " " << names[iline] << endl;
strcpy(args[0], names[iline].c_str());
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
++iline;
// single detector configuration
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
outfile << endl;
ret1 = detectors[idet]->writeConfigurationFile(outfile, idet);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret1 == FAIL)
ret = FAIL;
while(inFile.good()) {
std::string sLine;
getline(inFile,sLine);
// delete lines after comments
if (sLine.find('#') != std::string::npos) {
sLine.erase(sLine.find('#'));
}
// scan arguments
std::istringstream iss(sLine);
std::vector<std::string> vec = std::vector<std::string>(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>());
// blank lines
if (vec.size() == 0 || vec[0].empty()) {
continue;
}
outfile << endl;
//other configurations
while (iline < nvar) {
cout << iline << " " << names[iline] << endl;
strcpy(args[0], names[iline].c_str());
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
++iline;
// skip commands according to level (setup=2)
if (level!=2) {
if (vec[0] == "flatfield" ||
vec[0] == "badchannels" ||
vec[0] == "trimbits") {
continue;
}
}
delete cmd;
outfile.close();
#ifdef VERBOSE
std::cout << "wrote " << iline << " lines to configuration file " << std::endl;
#endif
} else {
std::cout << "Error opening configuration file " << fname << " for writing" << std::endl;
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
ret = FAIL;
int iarg = vec.size();
// copy to char array
char arr[iarg][MAX_STR_LENGTH];
memset(arr, 0, sizeof(arr));
char* args[iarg];
for (int i = 0; i < iarg; ++i) {
args[i] = arr[i];
strcpy(args[i], vec[i].c_str());
}
// execute command
multiSlsDetectorClient(iarg, args, PUT_ACTION, this);
}
for (int ia = 0; ia < 100; ++ia) {
delete[] args[ia];
}
inFile.close();
return ret;
// check error
if (getErrorMask()) {
int c;
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
}
int multiSlsDetector::dumpDetectorSetup(std::string const fname1, int level){
std::vector <std::string> commands;
// common config
commands.push_back("fname");
commands.push_back("index");
commands.push_back("enablefwrite");
commands.push_back("overwrite");
commands.push_back("dr");
commands.push_back("settings");
commands.push_back("exptime");
commands.push_back("period");
commands.push_back("frames");
commands.push_back("cycles");
commands.push_back("measurements");
commands.push_back("timing");
switch (getDetectorsType()) {
case EIGER:
commands.push_back("flags");
commands.push_back("clkdivider");
commands.push_back("threshold");
commands.push_back("ratecorr");
break;
case GOTTHARD:
case PROPIX:
commands.push_back("flags");
commands.push_back("delay");
commands.push_back("gates");
commands.push_back("ratecorr");
break;
case JUNGFRAU:
commands.push_back("flags");
commands.push_back("delay");
commands.push_back("gates");
commands.push_back("ratecorr");
commands.push_back("clkdivider");
break;
case MYTHEN:
commands.push_back("flags");
commands.push_back("threshold");
commands.push_back("delay");
commands.push_back("gates");
commands.push_back("probes");
commands.push_back("fineoff");
commands.push_back("ratecorr");
break;
case JUNGFRAUCTB:
commands.push_back("dac:0");
commands.push_back("dac:1");
commands.push_back("dac:2");
commands.push_back("dac:3");
commands.push_back("dac:4");
commands.push_back("dac:5");
commands.push_back("dac:6");
commands.push_back("dac:7");
commands.push_back("dac:8");
commands.push_back("dac:9");
commands.push_back("dac:10");
commands.push_back("dac:11");
commands.push_back("dac:12");
commands.push_back("dac:13");
commands.push_back("dac:14");
commands.push_back("dac:15");
commands.push_back("adcvpp");
commands.push_back("adcclk");
commands.push_back("clkdivider");
commands.push_back("adcphase");
commands.push_back("adcpipeline");
commands.push_back("adcinvert"); //
commands.push_back("adcdisable");
commands.push_back("patioctrl");
commands.push_back("patclkctrl");
commands.push_back("patlimits");
commands.push_back("patloop0");
commands.push_back("patnloop0");
commands.push_back("patwait0");
commands.push_back("patwaittime0");
commands.push_back("patloop1");
commands.push_back("patnloop1");
commands.push_back("patwait1");
commands.push_back("patwaittime1");
commands.push_back("patloop2");
commands.push_back("patnloop2");
commands.push_back("patwait2");
commands.push_back("patwaittime2");
break;
default:
break;
}
// more common config
commands.push_back("startscript");
commands.push_back("startscriptpar");
commands.push_back("stopscript");
commands.push_back("stopscriptpar");
commands.push_back("scriptbefore");
commands.push_back("scriptbeforepar");
commands.push_back("scriptafter");
commands.push_back("scriptafterpar");
commands.push_back("scan0script");
commands.push_back("scan0par");
commands.push_back("scan0prec");
commands.push_back("scan0steps");
commands.push_back("scan1script");
commands.push_back("scan1par");
commands.push_back("scan1prec");
commands.push_back("scan1steps");
std::string fname = fname1;
// setup
if (level == 2) {
// config
fname += std::string(".config");
writeConfigurationFile(fname);
// parameters
fname = fname1 + std::string(".det");
}
std::ofstream outfile;
outfile.open(fname.c_str(), std::ios_base::out);
if (!outfile.is_open()) {
cprintf(RED, "Cannot open parameter file %s for writing\n", fname.c_str());
setErrorMask(getErrorMask() | MULTI_PARM_FILE_ERROR);
return FAIL;
}
slsDetectorCommand* cmd = new slsDetectorCommand(this);
char arr[2][MAX_STR_LENGTH];
char* args[2];
args[0] = arr[0];
args[1] = arr[1];
memset(args[1], 0, MAX_STR_LENGTH);
for (unsigned int i = 0; i < commands.size(); ++i) {
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], commands[i].c_str());
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
}
if (getDetectorsType() == MYTHEN) {
// flatfield
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], "flatfield ");
if (level == 2) {
fname = fname1 + std::string(".ff");
memset(args[1], 0, MAX_STR_LENGTH);
strcpy(args[1], fname.c_str());
}
outfile << "flatfield " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
// badchannels
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], "badchannels ");
if (level == 2) {
fname = fname1 + std::string(".bad");
memset(args[1], 0, MAX_STR_LENGTH);
strcpy(args[1], fname.c_str());
}
outfile << "badchannels " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
// trimbits
if (level == 2) {
size_t c = fname1.rfind('/');
if (c < std::string::npos) {
fname = fname1.substr(0, c + 1) + std::string("trim_") + fname.substr(c + 1);
} else {
fname = std::string("trim_") + fname1;
}
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], "trimbits ");
memset(args[1], 0, MAX_STR_LENGTH);
strcpy(args[1], fname.c_str());
outfile << "trimbits " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
}
}
delete cmd;
outfile.close();
if (getErrorMask()) {
int c;
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
}
std::string multiSlsDetector::getSettingsFile() {
return callDetectorMember(&slsDetector::getSettingsFile);
@ -2460,7 +2670,7 @@ int* multiSlsDetector::getDataFromDetector() {
int nodatadet = -1;
int nodatadetectortype = false;
detectorType types = getDetectorsType();
if (types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX) {
if (types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX) {
nodatadetectortype = true;
}
@ -2762,16 +2972,18 @@ int multiSlsDetector::setDynamicRange(int p) {
}
//for usability for the user
if (getDetectorsType() == EIGER) {
if (getDetectorsType() == EIGER && p != -1) {
if (p == 32) {
std::cout << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32" << std::endl;
setSpeed(CLOCK_DIVIDER, 2);
} else if (p == 16) {
std::cout << "Setting Clock to Half Speed for Dynamic Range of 16" << std::endl;
setSpeed(CLOCK_DIVIDER, 1);
} else {
std::cout << "Setting Clock to Full Speed for Dynamic Range of " << p << std::endl;
setSpeed(CLOCK_DIVIDER, 0);
}
updateOffsets();
if (thisMultiDetector->receiverOnlineFlag == ONLINE_FLAG) {
std::cout << "Setting receiver fifo depth to default" << std::endl;
}
if (p != -1)
updateOffsets();
}
return ret;
}
@ -2898,17 +3110,18 @@ slsDetectorDefs::externalCommunicationMode multiSlsDetector::setExternalCommunic
externalCommunicationMode pol) {
externalCommunicationMode ret, ret1;
//(Dhanya) FIXME: why first detector or is it the master one?
if (detectors.size())
if (detectors.size()) {
ret = detectors[0]->setExternalCommunicationMode(pol);
if (detectors[0]->getErrorMask())
setErrorMask(getErrorMask() | (1 << 0));
if (detectors[0]->getErrorMask())
setErrorMask(getErrorMask() | (1 << 0));
for (unsigned int idet = 1; idet < detectors.size(); ++idet) {
ret1 = detectors[idet]->setExternalCommunicationMode(pol);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret != ret1)
ret = GET_EXTERNAL_COMMUNICATION_MODE;
for (unsigned int idet = 1; idet < detectors.size(); ++idet) {
ret1 = detectors[idet]->setExternalCommunicationMode(pol);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret != ret1)
ret = GET_EXTERNAL_COMMUNICATION_MODE;
}
}
setMaster();
setSynchronization();
@ -2919,17 +3132,18 @@ slsDetectorDefs::externalSignalFlag multiSlsDetector::setExternalSignalFlags(
externalSignalFlag pol, int signalindex) {
externalSignalFlag ret, ret1;
//(Dhanya) FIXME: why first detector or is it the master one?
if (detectors.size())
if (detectors.size()) {
ret = detectors[0]->setExternalSignalFlags(pol, signalindex);
if (detectors[0]->getErrorMask())
setErrorMask(getErrorMask() | (1 << 0));
if (detectors[0]->getErrorMask())
setErrorMask(getErrorMask() | (1 << 0));
for (unsigned int idet = 1; idet < detectors.size(); ++idet) {
ret1 = detectors[idet]->setExternalSignalFlags(pol, signalindex);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret != ret1)
ret = GET_EXTERNAL_SIGNAL_FLAG;
for (unsigned int idet = 1; idet < detectors.size(); ++idet) {
ret1 = detectors[idet]->setExternalSignalFlags(pol, signalindex);
if (detectors[idet]->getErrorMask())
setErrorMask(getErrorMask() | (1 << idet));
if (ret != ret1)
ret = GET_EXTERNAL_SIGNAL_FLAG;
}
}
setMaster();
setSynchronization();
@ -4947,6 +5161,9 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
cout << "Destroyed Receiving Data Socket(s)" << endl;
return OK;
}
if (client_downstream) {
return OK;
}
cprintf(MAGENTA, "Going to create data sockets\n");
@ -5382,8 +5599,10 @@ int multiSlsDetector::enableDataStreamingToClient(int enable) {
std::cout << "Could not create data threads in client." << std::endl;
//only for the first det as theres no general one
setErrorMask(getErrorMask() | (1 << 0));
detectors[0]->setErrorMask((detectors[0]->getErrorMask()) |
if (detectors.size()) {
detectors[0]->setErrorMask((detectors[0]->getErrorMask()) |
(DATA_STREAMING));
}
}
}
}

View File

@ -795,6 +795,26 @@ public:
*/
int writeConfigurationFile(std::string const fname);
/**
* Saves the detector setup to file
* @param fname file to write to
* @param level if 2 reads also trimbits, flat field, angular
* correction etc. and writes them to files with automatically
* added extension
* @returns OK or FAIL
*/
int dumpDetectorSetup(std::string const fname1, int level=0);
/**
* Loads the detector setup from file
* @param fname file to read from
* @param level if 2 reads also reads trimbits, angular
* conversion coefficients etc. from files with default
* extensions as generated by dumpDetectorSetup
* @returns OK or FAIL
*/
int retrieveDetectorSetup(std::string const fname1, int level=0);
/**
* Returns the trimfile or settings file name (Useless??)
* @returns the trimfile or settings file name

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
#define GITREPUUID "1de5b85ce2f40a83dae99272160d6574bb7e788e"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4141
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0"
#define GITREV 0x4175
#define GITDATE 0x20200414
#define GITBRANCH "4.2.0"

View File

@ -2407,254 +2407,126 @@ int slsDetector::updateDetector() {
int slsDetector::readConfigurationFile(string const fname) {
string ans;
string str;
ifstream infile;
//char *args[1000];
string sargname, sargval;
#ifdef VERBOSE
int iline=0;
std::cout<< "config file name "<< fname << std::endl;
#endif
infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) {
#ifdef VERBOSE
iline=readConfigurationFile(infile);
#else
readConfigurationFile(infile);
#endif
infile.close();
} else {
std::cout<< "Error opening configuration file " << fname <<
" for reading" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
#ifdef VERBOSE
std::cout<< "Read configuration file of " << iline << " lines" << std::endl;
#endif
return OK;
std::cout << "Cannot read config file from slsDetector level" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
int slsDetector::readConfigurationFile(ifstream &infile) {
slsDetectorCommand *cmd=new slsDetectorCommand(this);
string ans;
string str;
int iargval;
int interrupt=0;
char *args[100];
char myargs[1000][1000];
string sargname, sargval;
int iline=0;
while (infile.good() and interrupt==0) {
sargname="none";
sargval="0";
getline(infile,str);
++iline;
#ifdef VERBOSE
std::cout<< str << std::endl;
#endif
if (str.find('#')!=string::npos) {
#ifdef VERBOSE
std::cout<< "Line is a comment " << std::endl;
std::cout<< str << std::endl;
#endif
continue;
} else if (str.length()<2) {
#ifdef VERBOSE
std::cout<< "Empty line " << std::endl;
#endif
continue;
} else {
istringstream ssstr(str);
iargval=0;
while (ssstr.good()) {
ssstr >> sargname;
//if (ssstr.good()) {
#ifdef VERBOSE
std::cout<< iargval << " " << sargname << std::endl;
#endif
strcpy(myargs[iargval],sargname.c_str());
args[iargval]=myargs[iargval];
++iargval;
//}
}
ans=cmd->executeLine(iargval,args,PUT_ACTION);
#ifdef VERBOSE
std::cout<< ans << std::endl;
#endif
}
++iline;
}
delete cmd;
return OK;
}
int slsDetector::writeConfigurationFile(string const fname) {
ofstream outfile;
#ifdef VERBOSE
int ret;
#endif
outfile.open(fname.c_str(),ios_base::out);
if (outfile.is_open()) {
#ifdef VERBOSE
ret=writeConfigurationFile(outfile);
#else
writeConfigurationFile(outfile);
#endif
outfile.close();
}
else {
std::cout<< "Error opening configuration file " << fname <<
" for writing" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
#ifdef VERBOSE
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
#endif
return OK;
std::cout << "Cannot write config file from slsDetector level" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
int slsDetector::writeConfigurationFile(ofstream &outfile, int id) {
;
slsDetectorCommand *cmd=new slsDetectorCommand(this);
detectorType type = thisDetector->myDetectorType;
string names[100];
int nvar=0;
std::vector <std::string> commands;
// common config
names[nvar++] = "hostname";
names[nvar++] = "port";
names[nvar++] = "stopport";
names[nvar++] = "settingsdir";
names[nvar++] = "caldir";
names[nvar++] = "ffdir";
names[nvar++] = "outdir";
names[nvar++] = "angdir";
names[nvar++] = "moveflag";
names[nvar++] = "lock";
commands.push_back("port");
commands.push_back("stopport");
commands.push_back("settingsdir");
commands.push_back("caldir");
commands.push_back("ffdir");
commands.push_back("outdir");
commands.push_back("angdir");
commands.push_back("moveflag");
commands.push_back("lock");
// receiver config
if (type != MYTHEN) {
names[nvar++] = "detectormac";
names[nvar++] = "detectorip";
names[nvar++] = "zmqport";
names[nvar++] = "rx_zmqport";
names[nvar++] = "zmqip";
names[nvar++] = "rx_zmqip";
names[nvar++] = "rx_tcpport";
names[nvar++] = "rx_udpport";
names[nvar++] = "rx_udpport2";
names[nvar++] = "rx_udpip";
names[nvar++] = "rx_hostname";
names[nvar++] = "r_readfreq";
if (thisDetector->myDetectorType != MYTHEN) {
commands.push_back("detectormac");
commands.push_back("detectorip");
commands.push_back("zmqport");
commands.push_back("rx_zmqport");
commands.push_back("zmqip");
commands.push_back("rx_zmqip");
commands.push_back("rx_tcpport");
commands.push_back("rx_udpport");
commands.push_back("rx_udpport2");
commands.push_back("rx_udpip");
commands.push_back("rx_hostname");
commands.push_back("r_readfreq");
}
// detector specific config
switch (type) {
switch (thisDetector->myDetectorType) {
case MYTHEN:
names[nvar++] = "nmod";
names[nvar++] = "waitstates";
names[nvar++] = "setlength";
names[nvar++] = "clkdivider";
names[nvar++] = "extsig";
commands.push_back("waitstates");
commands.push_back("setlength");
commands.push_back("clkdivider");
commands.push_back("extsig");
break;
case GOTTHARD:
case PROPIX:
names[nvar++] = "extsig";
names[nvar++] = "vhighvoltage";
break;
break;
case MOENCH:
names[nvar++] = "extsig";
names[nvar++] = "vhighvoltage";
commands.push_back("vhighvoltage");
break;
case EIGER:
names[nvar++] = "vhighvoltage";
names[nvar++] = "trimen";
names[nvar++] = "iodelay";
names[nvar++] = "tengiga";
commands.push_back("vhighvoltage");
commands.push_back("trimen");
commands.push_back("iodelay");
commands.push_back("tengiga");
break;
case JUNGFRAU:
names[nvar++] = "powerchip";
names[nvar++] = "vhighvoltage";
break;
case JUNGFRAUCTB:
names[nvar++] = "powerchip";
names[nvar++] = "vhighvoltage";
commands.push_back("powerchip");
commands.push_back("vhighvoltage");
break;
default:
std::cout << "detector type " <<
getDetectorType(thisDetector->myDetectorType) << " not implemented in "
"writing config file" << std::endl;
nvar = 0;
break;
return FAIL;
}
int nsig=4;
int iv=0;
char *args[100];
char myargs[100][1000];
for (int ia=0; ia<100; ++ia) {
args[ia]=myargs[ia];
}
for (iv=0; iv<nvar; ++iv) {
cout << iv << " " << names[iv] << endl;
if (names[iv]=="extsig") {
for (int is=0; is<nsig; ++is) {
sprintf(args[0],"%s:%d",names[iv].c_str(),is);
if (id>=0)
slsDetectorCommand *cmd = new slsDetectorCommand(this);
char* args[2];
args[0] = new char[MAX_STR_LENGTH];
for (unsigned int i = 0; i < commands.size(); ++i) {
if (commands[i] == "extsig") {
for (int is = 0; is < 4; ++is) {
if (id >= 0) {
outfile << id << ":";
outfile << args[0] << " " << cmd->executeLine(1,args,GET_ACTION)
<< std::endl;
}
memset(args[0], 0, MAX_STR_LENGTH);
sprintf(args[0],"extsig:%d", is);
outfile << args[0] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
}
} else {
strcpy(args[0],names[iv].c_str());
if (id>=0)
if (id >= 0) {
outfile << id << ":";
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION)
<< std::endl;
}
memset(args[0], 0, MAX_STR_LENGTH);
strcpy(args[0], commands[i].c_str());
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
}
}
delete cmd;
delete args[0];
delete cmd;
if (getErrorMask()) {
int c = 0;
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
}
int slsDetector::retrieveDetectorSetup(std::string const fname, int level) {
std::cout << "Cannot read parameter file from slsDetector level" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
int slsDetector::dumpDetectorSetup(std::string const fname, int level) {
std::cout << "Cannot write parameter file from slsDetector level" << std::endl;
setErrorMask((getErrorMask())|(CONFIG_FILE));
return FAIL;
}
string slsDetector::getSettingsFile() {
@ -3695,16 +3567,16 @@ int slsDetector::sendSoftwareTrigger() {
#endif
thisDetector->stoppedFlag=0;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
if (stopSocket) {
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
disconnectStop();
}
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
return ret;
@ -3817,7 +3689,7 @@ int* slsDetector::getDataFromDetector(int *retval) {
int nodatadetectortype = false;
detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){
if(types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX){
nodatadetectortype = true;
}
@ -4034,7 +3906,9 @@ int slsDetector::configureMAC() {
bzero(cword, 50);
string s;
while (getline(ss, s, '.')) {
sprintf(cword,"%s%02x",cword,atoi(s.c_str()));
char cnum[50]="";
sprintf(cnum, "%02x", atoi(s.c_str()));
strcat(cword, cnum);
}
bzero(arg[0], 50);
strcpy(arg[0],cword);
@ -4050,7 +3924,7 @@ int slsDetector::configureMAC() {
bzero(cword, 50);
string s;
while (getline(ss, s, ':')) {
sprintf(cword,"%s%s",cword,s.c_str());
strcat(cword, s.c_str());
}
bzero(arg[1], 50);
strcpy(arg[1],cword);
@ -4069,7 +3943,7 @@ int slsDetector::configureMAC() {
bzero(cword, 50);
string s;
while (getline(ss, s, ':')) {
sprintf(cword,"%s%s",cword,s.c_str());
strcat(cword, s.c_str());
}
bzero(arg[3], 50);
strcpy(arg[3],cword);
@ -4085,7 +3959,9 @@ int slsDetector::configureMAC() {
bzero(cword, 50);
string s;
while (getline(ss, s, '.')) {
sprintf(cword,"%s%02x",cword,atoi(s.c_str()));
char cnum[50]="";
sprintf(cnum, "%02x", atoi(s.c_str()));
strcat(cword, cnum);
}
bzero(arg[4], 50);
strcpy(arg[4],cword);
@ -6250,6 +6126,19 @@ int slsDetector::activate(int const enable) {
if (ret==FORCE_UPDATE)
updateDetector();
}
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->SendDataOnly(&arg,sizeof(arg));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector (Stop server) returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(DETECTOR_ACTIVATE));
} else {
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
}
disconnectStop();
}
}
#ifdef VERBOSE
if(retval==1)
@ -9453,6 +9342,18 @@ int slsDetector::enableTenGigabitEthernet(int i) {
if (ret==FORCE_UPDATE)
updateDetector();
}
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->SendDataOnly(&i,sizeof(i));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector (Stop server) returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(DETECTOR_TEN_GIGA));
}
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectStop();
}
}

View File

@ -852,20 +852,11 @@ public:
int updateDetector();
/**
* Load configuration from a configuration File
* calls readConfigurationFile and gives it the stream
* @param fname configuration file name
* @return OK or FAIL
* should not be called at this level
* @return FAIL
*/
int readConfigurationFile(std::string const fname);
/**
* Load configuration from a stream
* @param infile stream
* @return OK or FAIL
*/
int readConfigurationFile(std::ifstream &infile);
/**
* Write current configuration to a file
* calls writeConfigurationFile giving it a stream to write to
@ -882,6 +873,26 @@ public:
*/
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
/**
* Loads the detector setup from file
* @param fname file to read from
* @param level if 2 reads also reads trimbits, angular
* conversion coefficients etc. from files with default
* extensions as generated by dumpDetectorSetup
* @returns OK or FAIL
*/
int retrieveDetectorSetup(std::string const fname, int level=0);
/**
* Saves the detector setup to file
* @param fname file to write to
* @param level if 2 reads also trimbits, flat field, angular
* correction etc. and writes them to files with automatically
* added extension
* @returns OK or FAIL
*/
int dumpDetectorSetup(std::string const fname, int level=0);
/**
* Returns the trimfile or settings file name (Useless??)
* @returns the trimfile or settings file name

View File

@ -471,6 +471,14 @@ int slsDetectorActions::executeAction(int level) {
case headerBefore:
fName=getCurrentFileName();
nowIndex=getFileIndexFromFileName(getCurrentFileName());
// all other parameters should be taken using text client calls in the header scripts!
sprintf(cmd,"%s nrun=%d fn=%s par=%s", \
getActionScript(level).c_str(), \
nowIndex, \
fName.c_str(), \
getActionParameter(level).c_str());
break;
case headerAfter:
// all other parameters should be taken using text client calls in the header scripts!

View File

@ -540,10 +540,8 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
*/
virtual int readConfigurationFile(std::string const fname)=0;
virtual int dumpDetectorSetup(std::string const fname, int level)=0;
int dumpDetectorSetup(std::string const fname){return dumpDetectorSetup(fname,0);};
virtual int retrieveDetectorSetup(std::string const fname, int level)=0;
int retrieveDetectorSetup(std::string const fname){return retrieveDetectorSetup(fname,0);};
virtual int dumpDetectorSetup(std::string const fname, int level = 0)=0;
virtual int retrieveDetectorSetup(std::string const fname, int level = 0)=0;
/**
@short
\returns the default output file index

View File

@ -3066,7 +3066,9 @@ string slsDetectorCommand::cmdTrimEn(int narg, char *args[], int action){
npos = myDet->getTrimEn(opos);
if (npos != -1) {
for (int ip=0; ip<npos;++ip) {
sprintf(answer,"%s %d",answer,opos[ip]);
char cnum[50]="";
sprintf(cnum, " %d", opos[ip]);
strcat(answer, cnum);
}
}
}
@ -3708,7 +3710,9 @@ string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
double opos[npos];
myDet->getPositions(opos);
for (int ip=0; ip<npos;++ip) {
sprintf(answer,"%s %f",answer,opos[ip]);
char cnum[50]="";
sprintf(cnum, " %f", opos[ip]);
strcat(answer, cnum);
}
return string(answer);
@ -3887,9 +3891,11 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
ns=myDet->getScanSteps(is, values);
int p=myDet->getScanPrecision(is);
char format[1000];
sprintf(format, "%%s %%0.%df",p);
sprintf(format, " %%0.%df",p);
for (int i=0; i<ns; ++i) {
sprintf(answer,format,answer,values[i]);
char cnum[50]="";
sprintf(cnum, format, values[i]);
strcat(answer, cnum);
}
delete [] values;
}
@ -3954,10 +3960,11 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
ns=myDet->getScanSteps(is, values);
int p=myDet->getScanPrecision(is);
char format[1000];
sprintf(format, "%%s %%0.%df",p);
sprintf(answer,"%d ",ns);
sprintf(format, " %%0.%df",p);
for (int i=0; i<ns; ++i) {
sprintf(answer,format,answer,values[i]);
char cnum[50]="";
sprintf(cnum, format, values[i]);
strcat(answer, cnum);
}
delete [] values;
return string(answer);
@ -5850,7 +5857,7 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
if ((ret!=-1) && (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER
|| index==ACTUAL_TIME || index==MEASUREMENT_TIME ||
MEASURED_PERIOD || MEASURED_SUBPERIOD)) {
index==MEASURED_PERIOD || index==MEASURED_SUBPERIOD)) {
rval=(double)ret*1E-9;
sprintf(answer,"%0.9f",rval);
} else {

View File

@ -314,6 +314,10 @@ int slsDetectorUsers::enableGapPixels(int enable) {
return myDetector->enableGapPixels(enable);
}
int slsDetectorUsers::setFlippedDataX(int value) {
return myDetector->setFlippedData(slsDetectorDefs::X, value);
}
std::string slsDetectorUsers::setReceiverFramesDiscardPolicy(std::string f) {
return myDetector->getReceiverFrameDiscardPolicy(
myDetector->setReceiverFramesDiscardPolicy(

View File

@ -553,6 +553,12 @@ class slsDetectorUsers
*/
int enableGapPixels(int enable=-1);
/** sets the enable which determines if data will be flipped across x axis
* @param value 0 or 1 to reset/set or -1 to get value
* @return enable flipped data across x axis
*/
int setFlippedDataX(int value=-1);
/**
* Sets the frames discard policy in receiver
* frame discard policy options:

View File

@ -10,6 +10,7 @@
#include <sys/shm.h>
#include <time.h> //clock()
#include <string>
#include <iterator>
using namespace std;
slsDetectorUtils::slsDetectorUtils() {
@ -64,9 +65,12 @@ int slsDetectorUtils::acquire(int delflag){
if(!receiver){
setDetectorIndex(-1);
}
pthread_mutex_lock(&mg);
int nc=setTimer(CYCLES_NUMBER,-1);
int nf=setTimer(FRAME_NUMBER,-1);
pthread_mutex_unlock(&mg);
if (nc==0) nc=1;
if (nf==0) nf=1;
int multiframe = nc*nf;
@ -635,316 +639,5 @@ void slsDetectorUtils::setCurrentProgress(int i){
}
int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
slsDetectorCommand *cmd;
// char ext[100];
int skip=0;
string fname;
string str;
ifstream infile;
int iargval;
int interrupt=0;
char *args[10];
char myargs[10][1000];
//args[0]=myargs[0];
//args[1]=myargs[1];
string sargname, sargval;
int iline=0;
if (level==2) {
// fname=fname1+string(".config");
// readConfigurationFile(fname);
#ifdef VERBOSE
cout << "config file read" << endl;
#endif
fname=fname1+string(".det");
} else
fname=fname1;
infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) {
cmd=new slsDetectorCommand(this);
while (infile.good() and interrupt==0) {
sargname="none";
sargval="0";
getline(infile,str);
iline++;
#ifdef VERBOSE
std::cout<< str << std::endl;
#endif
if (str.find('#')!=string::npos) {
#ifdef VERBOSE
std::cout<< "Line is a comment " << std::endl;
std::cout<< str << std::endl;
#endif
continue;
} else {
istringstream ssstr(str);
iargval=0;
while (ssstr.good()) {
ssstr >> sargname;
// if (ssstr.good()) {
strcpy(myargs[iargval],sargname.c_str());
args[iargval]=myargs[iargval];
#ifdef VERBOSE
std::cout<< args[iargval] << std::endl;
#endif
iargval++;
// }
skip=0;
}
if (level!=2) {
if (string(args[0])==string("flatfield"))
skip=1;
else if (string(args[0])==string("badchannels"))
skip=1;
else if (string(args[0])==string("trimbits"))
skip=1;
}
if (skip==0)
cmd->executeLine(iargval,args,PUT_ACTION);
}
iline++;
}
delete cmd;
infile.close();
} else {
std::cout<< "Error opening " << fname << " for reading" << std::endl;
return FAIL;
}
#ifdef VERBOSE
std::cout<< "Read " << iline << " lines" << std::endl;
#endif
if (getErrorMask())
return FAIL;
return OK;
}
int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
slsDetectorCommand *cmd;
detectorType type = getDetectorsType();
string names[100];
int nvar=0;
// common config
names[nvar++]="fname";
names[nvar++]="index";
names[nvar++]="enablefwrite";
names[nvar++]="overwrite";
names[nvar++]="dr";
names[nvar++]="settings";
names[nvar++]="exptime";
names[nvar++]="period";
names[nvar++]="frames";
names[nvar++]="cycles";
names[nvar++]="measurements";
names[nvar++]="timing";
names[nvar++]="flatfield";
names[nvar++]="badchannels";
switch (type) {
case EIGER:
names[nvar++]="flags";
names[nvar++]="clkdivider";
names[nvar++]="threshold";
names[nvar++]="ratecorr";
names[nvar++]="trimbits";
break;
case GOTTHARD:
case PROPIX:
names[nvar++]="flags";
names[nvar++]="delay";
names[nvar++]="gates";
names[nvar++]="ratecorr";
break;
case JUNGFRAU:
names[nvar++]="flags";
names[nvar++]="delay";
names[nvar++]="gates";
names[nvar++]="ratecorr";
names[nvar++]="clkdivider";
break;
case MYTHEN:
names[nvar++]="flags";
names[nvar++]="threshold";
names[nvar++]="delay";
names[nvar++]="gates";
names[nvar++]="probes";
names[nvar++]="fineoff";
names[nvar++]="ratecorr";
names[nvar++]="trimbits";
break;
case JUNGFRAUCTB:
names[nvar++]="dac:0";
names[nvar++]="dac:1";
names[nvar++]="dac:2";
names[nvar++]="dac:3";
names[nvar++]="dac:4";
names[nvar++]="dac:5";
names[nvar++]="dac:6";
names[nvar++]="dac:7";
names[nvar++]="dac:8";
names[nvar++]="dac:9";
names[nvar++]="dac:10";
names[nvar++]="dac:11";
names[nvar++]="dac:12";
names[nvar++]="dac:13";
names[nvar++]="dac:14";
names[nvar++]="dac:15";
names[nvar++]="adcvpp";
names[nvar++]="adcclk";
names[nvar++]="clkdivider";
names[nvar++]="adcphase";
names[nvar++]="adcpipeline";
names[nvar++]="adcinvert"; //
names[nvar++]="adcdisable";
names[nvar++]="patioctrl";
names[nvar++]="patclkctrl";
names[nvar++]="patlimits";
names[nvar++]="patloop0";
names[nvar++]="patnloop0";
names[nvar++]="patwait0";
names[nvar++]="patwaittime0";
names[nvar++]="patloop1";
names[nvar++]="patnloop1";
names[nvar++]="patwait1";
names[nvar++]="patwaittime1";
names[nvar++]="patloop2";
names[nvar++]="patnloop2";
names[nvar++]="patwait2";
names[nvar++]="patwaittime2";
break;
default:
break;
}
names[nvar++]="startscript";
names[nvar++]="startscriptpar";
names[nvar++]="stopscript";
names[nvar++]="stopscriptpar";
names[nvar++]="scriptbefore";
names[nvar++]="scriptbeforepar";
names[nvar++]="scriptafter";
names[nvar++]="scriptafterpar";
names[nvar++]="scan0script";
names[nvar++]="scan0par";
names[nvar++]="scan0prec";
names[nvar++]="scan0steps";
names[nvar++]="scan1script";
names[nvar++]="scan1par";
names[nvar++]="scan1prec";
names[nvar++]="scan1steps";
int iv=0;
string fname1;
ofstream outfile;
char *args[4];
for (int ia=0; ia<4; ia++) {
args[ia]=new char[1000];
}
int nargs;
if (level==2)
nargs=2;
else
nargs=1;
if (level==2) {
fname1=fname+string(".config");
writeConfigurationFile(fname1);
fname1=fname+string(".det");
} else
fname1=fname;
outfile.open(fname1.c_str(),ios_base::out);
if (outfile.is_open()) {
cmd=new slsDetectorCommand(this);
for (iv=0; iv<nvar-3; iv++) {
strcpy(args[0],names[iv].c_str());
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
}
strcpy(args[0],names[iv].c_str());
if (level==2) {
fname1=fname+string(".ff");
strcpy(args[1],fname1.c_str());
}
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
iv++;
strcpy(args[0],names[iv].c_str());
if (level==2) {
fname1=fname+string(".bad");
strcpy(args[1],fname1.c_str());
}
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
iv++;
if (level==2) {
strcpy(args[0],names[iv].c_str());
size_t c=fname.rfind('/');
if (c<string::npos) {
fname1=fname.substr(0,c+1)+string("trim_")+fname.substr(c+1);
} else {
fname1=string("trim_")+fname;
}
strcpy(args[1],fname1.c_str());
#ifdef VERBOSE
std::cout<< "writing to file " << fname1 << std::endl;
#endif
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
iv++;
}
delete cmd;
outfile.close();
}
else {
std::cout<< "Error opening parameters file " << fname1 << " for writing" << std::endl;
return FAIL;
}
#ifdef VERBOSE
std::cout<< "wrote " <<iv << " lines to "<< fname1 << std::endl;
#endif
return OK;
}

View File

@ -709,25 +709,6 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
void registerProgressCallback(int( *func)(double,void*), void *pArg){progress_call=func; pProgressCallArg=pArg;};
/**
Saves the detector setup to file
\param fname file to write to
\param level if 2 reads also trimbits, flat field, angular correction etc. and writes them to files with automatically added extension
\returns OK or FAIL
*/
int dumpDetectorSetup(std::string const fname, int level=0);
/**
Loads the detector setup from file
\param fname file to read from
\param level if 2 reads also reads trimbits, angular conversion coefficients etc. from files with default extensions as generated by dumpDetectorSetup
\returns OK or FAIL
*/
int retrieveDetectorSetup(std::string const fname, int level=0);
static int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;}
static int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;}

View File

@ -239,10 +239,7 @@ s
void registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg) { \
dataReady = userCallback; \
pCallbackArg = pArg; \
if (setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) { \
enableDataStreamingToClient(1); \
enableDataStreamingFromReceiver(1);}}; \
enableDataStreamingToClient(dataReady == NULL ? 0 : 1);}; \
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};

View File

@ -4361,11 +4361,11 @@ int set_all_trimbits(int file_des){
#ifdef VERBOSE
printf("setting all trimbits to %d\n",arg);
#endif
if(arg < -1){
if(arg < -1 || arg > MAX_TRIMBITS_VALUE){
ret = FAIL;
strcpy(mess,"Cant set trimbits to this value\n");
sprintf(mess,"Cant set all trimbits to %d. Range 0 - %d\n", arg, MAX_TRIMBITS_VALUE);
cprintf(RED, "Warning: %s", mess);
}else {
} else {
if(arg >= 0){
ret = setAllTrimbits(arg);
//changes settings to undefined

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsReceiverSoftware
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 870
Branch: 4.1.0
Repsitory UUID: 1de5b85ce2f40a83dae99272160d6574bb7e788e
Revision: 877
Branch: 4.2.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 09:28:28.000000001 +0200 ./updateAPIVersion.sh
Last Changed Rev: 4175
Last Changed Date: 2020-04-14 09:09:45.600925574 +0200 ./updateAPIVersion.sh

View File

@ -188,10 +188,9 @@ class BinaryFileStatic {
* @param fd file pointer
* @param owenable overwrite enable
* @param fname complete file name
* @param filebuffersize file buffer size
* @returns 0 for success and 1 for fail
*/
static int CreateDataFile(FILE*& fd, bool owenable, std::string fname, size_t filebuffersize)
static int CreateDataFile(FILE*& fd, bool owenable, std::string fname)
{
if(!owenable){
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
@ -204,8 +203,8 @@ class BinaryFileStatic {
fd = 0;
return 1;
}
//setting file buffer size to 16mb
setvbuf(fd,NULL,_IOFBF,filebuffersize);
//setting to no file buffering
setvbuf(fd,NULL, _IONBF, 0);
return 0;
}

View File

@ -616,7 +616,7 @@ class EigerData : public GeneralData {
imageSize = dataSize*packetsPerFrame;
maxFramesPerFile = EIGER_MAX_FRAMES_PER_FILE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
defaultFifoDepth = 100;
defaultFifoDepth = 1000;
threadsPerReceiver = 2;
headerPacketSize = 40;
standardheader = true;
@ -630,6 +630,7 @@ class EigerData : public GeneralData {
void SetDynamicRange(int dr, bool tgEnable) {
packetsPerFrame = (tgEnable ? 4 : 16) * dr;
imageSize = dataSize*packetsPerFrame;
defaultFifoDepth = (dr == 32 ? 100 : 1000);
}
/**

View File

@ -312,7 +312,7 @@ public:
"\"quad\":%u"
;//"}\n";
int length = sprintf(buf, jsonHeaderFormat,
sprintf(buf, jsonHeaderFormat,
jsonversion, dynamicrange, fileIndex, ndetx, ndety, npixelsx, npixelsy, imageSize,
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
@ -326,10 +326,11 @@ public:
quadEnable
);
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
length = sprintf(buf, "%s, %s}\n", buf, additionalJsonHeader);
} else {
length = sprintf(buf, "%s}\n", buf);
strcat(buf, ", ");
strcat(buf, additionalJsonHeader);
}
strcat(buf,"}\n");
int length = strlen(buf);
#ifdef VERBOSE
if(!index)

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
#define GITREPUUID "1de5b85ce2f40a83dae99272160d6574bb7e788e"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4141
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0"
#define GITREV 0x4175
#define GITDATE 0x20200414
#define GITBRANCH "4.2.0"

View File

@ -17,11 +17,8 @@
#define STATISTIC_FRAMENUMBER_INFINITE 20000
//binary
#define FILE_BUFFER_SIZE (16*1024*1024) //16mb
//fifo
#define FIFO_HEADER_NUMBYTES 4
#define FIFO_HEADER_NUMBYTES 8
//hdf5

View File

@ -49,7 +49,7 @@ int BinaryFile::CreateFile(uint64_t fnum) {
currentFileName = BinaryFileStatic::CreateFileName(filePath, fileNamePrefix, *fileIndex,
(*numImages > 1), fnum, *detIndex, *numUnitsPerDetector, index);
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName) == FAIL)
return FAIL;
if(!(*silentMode)) {

View File

@ -46,14 +46,18 @@ 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";
int pagesize = getpagesize();
for (size_t i = 0; i < mem_len; i += pagesize) {
strcpy(memory + i, "memory");
}
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,",");
}
@ -386,6 +388,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
(*it)->SetPixelDimension();
fifoDepth = generalData->defaultFifoDepth;
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
if (SetupFifoStructure() == FAIL)
return FAIL;
@ -826,6 +829,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
delete(*it);
fifo.clear();
fifoDepth = 0;
return FAIL;
}
//set the listener & dataprocessor threads to point to the right fifo
@ -834,7 +838,9 @@ 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)( ((size_t)(generalData->imageSize) * numberofJobs +
(size_t)(generalData->fifoBufferHeaderSize)) * (size_t)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());
@ -1903,14 +1906,14 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
else {
ret = receiverBase->setFifoDepth(value);
if (ret == FAIL) {
strcpy(mess,"Could not set fifo depth");
strcpy(mess,"Could not set fifo depth\n");
FILE_LOG(logERROR) << mess;
}
}
}
//get
retval = receiverBase->getFifoDepth();
if(value >= 0 && retval != value) {
if(ret == OK && value >= 0 && retval != value) {
ret = FAIL;
strcpy(mess, "Could not set fifo depth\n");
FILE_LOG(logERROR) << mess;