Partialreadout (#47)

* eiger server, rxr: partial readout, also gui messages: up last command, down clear command

* added binaries and resolved conflict

* bugfix eiger server: interrupt subframe is bit 2 and not bit number 3

* brackets in defs
This commit is contained in:
Dhanya Thattil
2019-08-07 09:08:58 +02:00
committed by GitHub
parent e20b5e6952
commit 98ddf154b2
28 changed files with 389 additions and 99 deletions

View File

@ -3,49 +3,49 @@
#include "sls_detector_defs.h"
#include <stdint.h>
#define MAX_DIMENSIONS 2
#define MAX_DIMENSIONS (2)
//socket
#define GOODBYE -200
#define GOODBYE (-200)
#define RECEIVE_SOCKET_BUFFER_SIZE (100*1024*1024)
#define MAX_SOCKET_INPUT_PACKET_QUEUE 250000
#define MAX_SOCKET_INPUT_PACKET_QUEUE (250000)
//files
#define DO_NOTHING 0
#define DO_EVERYTHING 1
#define DO_NOTHING (0)
#define DO_EVERYTHING (1)
#define STATISTIC_FRAMENUMBER_INFINITE 20000
#define STATISTIC_FRAMENUMBER_INFINITE (20000)
//binary
#define FILE_BUFFER_SIZE (16*1024*1024) //16mb
//fifo
#define FIFO_HEADER_NUMBYTES 8
#define FIFO_DATASIZE_NUMBYTES 4
#define FIFO_PADDING_NUMBYTES 4 // for 8 byte alignment due to sls_receiver_header structure
#define FIFO_HEADER_NUMBYTES (8)
#define FIFO_DATASIZE_NUMBYTES (4)
#define FIFO_PADDING_NUMBYTES (4) // for 8 byte alignment due to sls_receiver_header structure
//hdf5
#define MAX_CHUNKED_IMAGES 1
#define MAX_CHUNKED_IMAGES (1)
//versions
#define HDF5_WRITER_VERSION 3.0 //1 decimal places
#define BINARY_WRITER_VERSION 3.0 //1 decimal places
#define HDF5_WRITER_VERSION (3.0) //1 decimal places
#define BINARY_WRITER_VERSION (3.0) //1 decimal places
//parameters to calculate fifo depth
#define SAMPLE_TIME_IN_NS 100000000//100ms
#define SAMPLE_TIME_IN_NS (100000000)//100ms
#define MAX_EIGER_ROWS_PER_READOUT (256)
//to differentiate between gotthard and short gotthard
#define GOTTHARD_PACKET_SIZE 1286
#define GOTTHARD_PACKET_SIZE (1286)
#define DUMMY_PACKET_VALUE 0xFFFFFFFF
#define DUMMY_PACKET_VALUE (0xFFFFFFFF)
#define LISTENER_PRIORITY 90
#define PROCESSOR_PRIORITY 70
#define STREAMER_PRIORITY 10
#define TCP_PRIORITY 10
#define LISTENER_PRIORITY (90)
#define PROCESSOR_PRIORITY (70)
#define STREAMER_PRIORITY (10)
#define TCP_PRIORITY (10)

View File

@ -80,6 +80,12 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
*/
bool getQuad() const;
/**
* Get number of lines readout (eiger)
* @returns number of lines readout
*/
int getReadNLines() const;
/**
* Get readout flags (Eiger, chiptestboard, moench)
* @return readout flags
@ -403,6 +409,12 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
*/
int setQuad(const bool b);
/**
* Set number of lines readout (eiger)
* @param value number of lines readout
*/
void setReadNLines(const int value);
/**
* Set readout flags (eiger, chiptestboard, moench)
* @param f readout flag
@ -887,6 +899,8 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
bool gapPixelsEnable;
/** quad type enable */
bool quadEnable;
/** num lines readout */
int numLinesReadout;
/** readout flags*/
readOutFlags readoutFlags;

View File

@ -297,6 +297,9 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
/** quad type */
int set_quad_type(sls::ServerInterface2 &socket);
/** read n lines */
int set_read_n_lines(sls::ServerInterface2 &socket);
/** detector type */
detectorType myDetectorType;

View File

@ -70,6 +70,7 @@ void slsReceiverImplementation::InitializeMembers() {
flippedDataX = 0;
gapPixelsEnable = false;
quadEnable = false;
numLinesReadout = MAX_EIGER_ROWS_PER_READOUT;
readoutFlags = GET_READOUT_FLAGS;
//*** receiver parameters ***
@ -168,6 +169,11 @@ bool slsReceiverImplementation::getQuad() const {
return quadEnable;
}
int slsReceiverImplementation::getReadNLines() const {
FILE_LOG(logDEBUG) << __AT__ << " starting";
return numLinesReadout;
}
slsDetectorDefs::readOutFlags
slsReceiverImplementation::getReadOutFlags() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
@ -543,6 +549,11 @@ int slsReceiverImplementation::setQuad(const bool b) {
return OK;
}
void slsReceiverImplementation::setReadNLines(const int value) {
numLinesReadout = value;
FILE_LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
}
int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
if (readoutFlags != f) {
readoutFlags = f;
@ -1405,10 +1416,17 @@ void slsReceiverImplementation::stopReceiver() {
uint64_t tot = 0;
for (int i = 0; i < numThreads; i++) {
tot += dataProcessor[i]->GetNumFramesCaught();
int64_t missingpackets =
numberOfFrames * generalData->packetsPerFrame -
listener[i]->GetPacketsCaught();
// partial readout
if (numLinesReadout != MAX_EIGER_ROWS_PER_READOUT) {
int maxnp = generalData->packetsPerFrame;
int np = ((numLinesReadout * maxnp) / MAX_EIGER_ROWS_PER_READOUT);
missingpackets = numberOfFrames * np - listener[i]->GetPacketsCaught();
}
TLogLevel lev =
(((int64_t)missingpackets) > 0) ? logINFORED : logINFOGREEN;
FILE_LOG(lev) <<

View File

@ -201,7 +201,7 @@ int slsReceiverTCPIPInterface::function_table(){
flist[F_GET_RECEIVER_DBIT_LIST] = &slsReceiverTCPIPInterface::get_dbit_list;
flist[F_RECEIVER_DBIT_OFFSET] = &slsReceiverTCPIPInterface::set_dbit_offset;
flist[F_SET_RECEIVER_QUAD] = &slsReceiverTCPIPInterface::set_quad_type;
flist[F_SET_RECEIVER_READ_N_LINES] = &slsReceiverTCPIPInterface::set_read_n_lines;
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
@ -1323,4 +1323,17 @@ int slsReceiverTCPIPInterface::set_quad_type(Interface &socket) {
validate(quadEnable, retval, "set quad", DEC);
FILE_LOG(logDEBUG1) << "quad retval:" << retval;
return socket.Send(OK);
}
int slsReceiverTCPIPInterface::set_read_n_lines(Interface &socket) {
auto arg = socket.Receive<int>();
if (arg >= 0) {
VerifyIdle(socket);
FILE_LOG(logDEBUG1) << "Setting Read N Lines:" << arg;
impl()->setReadNLines(arg);
}
int retval = impl()->getReadNLines();
validate(arg, retval, "set read n lines", DEC);
FILE_LOG(logDEBUG1) << "read n lines retval:" << retval;
return socket.Send(OK);
}