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

@ -33,9 +33,6 @@ TEST_CASE("Single detector no receiver", "[.integration][.single]") {
d.setHostname(test::hostname); d.setHostname(test::hostname);
CHECK(d.getHostname() == test::hostname); CHECK(d.getHostname() == test::hostname);
d.setOnline(true);
CHECK(d.getOnlineFlag() == true);
CHECK(d.setDetectorType() == test::type); CHECK(d.setDetectorType() == test::type);
d.freeSharedMemory(); d.freeSharedMemory();
@ -56,7 +53,6 @@ TEST_CASE("Set control port then create a new object with this control port",
{ {
slsDetector d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setOnline(true);
CHECK(d.getControlPort() == old_cport); CHECK(d.getControlPort() == old_cport);
d.setControlPort(new_cport); d.setControlPort(new_cport);
CHECK(d.getStopPort() == old_sport); CHECK(d.getStopPort() == old_sport);
@ -71,8 +67,6 @@ TEST_CASE("Set control port then create a new object with this control port",
CHECK(d.getControlPort() == new_cport); CHECK(d.getControlPort() == new_cport);
CHECK(d.getStopPort() == new_sport); CHECK(d.getStopPort() == new_sport);
d.setOnline(true);
// Reset standard ports // Reset standard ports
d.setControlPort(old_cport); d.setControlPort(old_cport);
d.setStopPort(old_sport); d.setStopPort(old_sport);
@ -81,7 +75,6 @@ TEST_CASE("Set control port then create a new object with this control port",
slsDetector d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setOnline(true);
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1); CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
d.freeSharedMemory(); d.freeSharedMemory();
} }
@ -104,11 +97,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
d.setHostname(c.hostname); d.setHostname(c.hostname);
CHECK(d.getHostname() == c.hostname); CHECK(d.getHostname() == c.hostname);
d.setOnline(true); CHECK(d.getUseReceiverFlag() == false);
CHECK(d.getOnlineFlag() == true); CHECK_NOTHROW(d.checkDetectorVersionCompatibility());
CHECK(d.getReceiverOnlineFlag() == false);
CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK);
// Setting and reading exposure time // Setting and reading exposure time
auto t = 1000000000; auto t = 1000000000;
@ -145,7 +135,6 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") { TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
slsDetector d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setOnline(true);
// Check that detector server is unlocked then lock // Check that detector server is unlocked then lock
CHECK(d.lockServer() == 0); CHECK(d.lockServer() == 0);
@ -168,7 +157,6 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
TEST_CASE("Set settings", "[.integration][.single]"){ TEST_CASE("Set settings", "[.integration][.single]"){
slsDetector d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setOnline(true);
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD); CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
} }
@ -199,7 +187,6 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
slsDetector d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setOnline(true);
// Number of frames // Number of frames
auto frames = 5; auto frames = 5;
@ -253,7 +240,6 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
// auto type = slsDetector::getTypeFromDetector(c.hostname); // auto type = slsDetector::getTypeFromDetector(c.hostname);
// slsDetector d(type); // slsDetector d(type);
// d.setHostname(c.hostname); // d.setHostname(c.hostname);
// d.setOnline(true);
// auto period = 1000000000; // auto period = 1000000000;
// auto exptime = 100000000; // auto exptime = 100000000;
@ -282,10 +268,9 @@ TEST_CASE(
// ensure eiger detector type, hostname and online // ensure eiger detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum); REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
// starting state with rate correction off // starting state with rate correction off
CHECK(m.setRateCorrection(0) == 0); m.setRateCorrection(0);
// dr 16: clk divider, no change for ratecorr // dr 16: clk divider, no change for ratecorr
CHECK(m.setDynamicRange(16) == 16); CHECK(m.setDynamicRange(16) == 16);
@ -333,7 +318,6 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
// ensure ctb detector type, hostname and online // ensure ctb detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum); REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
uint64_t word = 0; uint64_t word = 0;
int addr = 0; int addr = 0;
@ -419,7 +403,6 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
// ensure ctb detector type, hostname and online // ensure ctb detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum); REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
// dbit offset // dbit offset
m.setReceiverDbitOffset(0); m.setReceiverDbitOffset(0);
@ -490,7 +473,6 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
// ensure ctb detector type, hostname and online // ensure ctb detector type, hostname and online
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU))); REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
REQUIRE(m.setOnline(true) == slsDetectorDefs::ONLINE_FLAG);
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1); CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
@ -518,4 +500,30 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
CHECK(m.acquire() == slsDetectorDefs::OK); CHECK(m.acquire() == slsDetectorDefs::OK);
CHECK(m.getReceiverCurrentFrameIndex() == val); CHECK(m.getReceiverCurrentFrameIndex() == val);
CHECK(m.getStartingFrameNumber() == (val + 1)); CHECK(m.getStartingFrameNumber() == (val + 1));
}
TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
multiSlsDetector m(0);
// ensure detector type, hostname
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
REQUIRE(m.getHostname() == c.hostname);
m.setDynamicRange(16);
m.enableTenGigabitEthernet(0);
m.setReadNLines(256);
CHECK(m.getReadNLines() == 256);
m.setReadNLines(1);
CHECK(m.getReadNLines() == 1);
m.setDynamicRange(8);
m.setReadNLines(256);
CHECK(m.getReadNLines() == 256);
CHECK_THROWS_AS(m.setReadNLines(1), sls::RuntimeError);
CHECK(m.getReadNLines() == 256);
CHECK_THROWS_AS(m.setReadNLines(0), sls::RuntimeError);
m.setReadNLines(256);
} }

View File

@ -11,7 +11,6 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
multiSlsDetector d(0, true, true); multiSlsDetector d(0, true, true);
d.setHostname(test::hostname.c_str()); d.setHostname(test::hostname.c_str());
REQUIRE(d.setOnline() == true); // get!
CHECK(d.getHostname() == test::hostname); CHECK(d.getHostname() == test::hostname);
for (size_t i = 0; i != hostnames.size(); ++i) { for (size_t i = 0; i != hostnames.size(); ++i) {

View File

@ -50,6 +50,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Up arrow key picks up the previous command.&lt;/p&gt;&lt;p&gt;Down arrow key clears the current command.&lt;/p&gt;&lt;p&gt;Return or Enter key executes the current command&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">

View File

@ -3,6 +3,7 @@
#include "ui_form_tab_messages.h" #include "ui_form_tab_messages.h"
class QProcess; class QProcess;
class QKeyEvent;
class qTabMessages:public QWidget, private Ui::TabMessagesObject { class qTabMessages:public QWidget, private Ui::TabMessagesObject {
Q_OBJECT Q_OBJECT
@ -12,6 +13,9 @@ public:
~qTabMessages(); ~qTabMessages();
void Refresh(); void Refresh();
protected:
void keyPressEvent(QKeyEvent* event);
private slots: private slots:
void ExecuteCommand(); void ExecuteCommand();
void SaveLog(); void SaveLog();
@ -21,9 +25,12 @@ private:
void SetupWidgetWindow(); void SetupWidgetWindow();
void Initialization(); void Initialization();
void PrintNextLine(); void PrintNextLine();
void GetLastCommand();
void ClearCommand();
void AppendOutput(); void AppendOutput();
void AppendError(); void AppendError();
QProcess* process; QProcess* process;
QStringList lastCommand;
}; };

View File

@ -6,6 +6,7 @@
#include <QTextStream> #include <QTextStream>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
#include <QKeyEvent>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -26,6 +27,7 @@ void qTabMessages::SetupWidgetWindow() {
process = new QProcess; process = new QProcess;
process->setWorkingDirectory(QDir::cleanPath(QDir::currentPath())); process->setWorkingDirectory(QDir::cleanPath(QDir::currentPath()));
PrintNextLine(); PrintNextLine();
lastCommand.clear();
Initialization(); Initialization();
} }
@ -36,8 +38,37 @@ void qTabMessages::Initialization() {
connect(dispCommand, SIGNAL(returnPressed()), this, SLOT(ExecuteCommand())); connect(dispCommand, SIGNAL(returnPressed()), this, SLOT(ExecuteCommand()));
} }
void qTabMessages::keyPressEvent(QKeyEvent* event) {
//cout<<"inside KeyPressEvent()\n";
if (event->key() == Qt::Key_Up) {
GetLastCommand();
}
else if (event->key() == Qt::Key_Down) {
ClearCommand();
}
/* else if((event->key() == Qt::Key_Return) ||(event->key() == Qt::Key_Enter)) {
ExecuteCommand();
}*/ else {
event->ignore();
}
}
void qTabMessages::PrintNextLine() {
dispLog->append(QString("<font color = \"DarkGrey\">") + QDir::current().dirName() + QString("$ ") + QString("</font>"));
}
void qTabMessages::GetLastCommand() {
dispCommand->setText(lastCommand.join(" "));
}
void qTabMessages::ClearCommand() {
dispCommand->setText("");
}
void qTabMessages::ExecuteCommand() { void qTabMessages::ExecuteCommand() {
QStringList param = dispCommand->text().split(" "); QStringList param = dispCommand->text().split(" ");
lastCommand.clear();
lastCommand += param;
dispCommand->clear(); dispCommand->clear();
// appending command to log without newline // appending command to log without newline
dispLog->moveCursor (QTextCursor::End); dispLog->moveCursor (QTextCursor::End);
@ -56,10 +87,6 @@ void qTabMessages::ExecuteCommand() {
} }
} }
void qTabMessages::PrintNextLine() {
dispLog->append(QString("<font color = \"DarkGrey\">") + QDir::current().dirName() + QString("$ ") + QString("</font>"));
}
void qTabMessages::AppendOutput() { void qTabMessages::AppendOutput() {
QByteArray result = process->readAll(); QByteArray result = process->readAll();
result.replace("\n", "<br>"); result.replace("\n", "<br>");

View File

@ -39,6 +39,7 @@ int Beb_top =0;
uint64_t Beb_deactivatedStartFrameNumber = 0; uint64_t Beb_deactivatedStartFrameNumber = 0;
int Beb_quadEnable = 0; int Beb_quadEnable = 0;
int Beb_positions[2] = {0, 0}; int Beb_positions[2] = {0, 0};
int Beb_readNLines = MAX_ROWS_PER_READOUT;
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num) { void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num) {
@ -988,23 +989,25 @@ int Beb_StopAcquisition()
} }
int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait) { int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait) {
if (!Beb_activated) if (!Beb_activated)
return 1; return 1;
if (dst_number>64) return 0; if (dst_number>64) return 0;
unsigned int header_size = 4; //4*64 bits unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
unsigned int npackets = ten_gig ? Beb_bit_mode*4 : Beb_bit_mode*16; unsigned int nl = Beb_readNLines;
int in_two_requests = (!ten_gig&&Beb_bit_mode==32); unsigned int npackets = (nl * maxnp) / maxnl;
if ((nl * maxnp) % maxnl) {
// volatile u_int32_t* ptrl; FILE_LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image Readout\n"));
// volatile u_int32_t* ptrr; npackets = maxnp;
u_int32_t send_header_command; }
u_int32_t send_frame_command; int in_two_requests = (npackets > MAX_PACKETS_PER_REQUEST) ? 1 : 0;
if (in_two_requests) {
if (in_two_requests) npackets/=2; npackets /= 2;
}
unsigned int header_size = 4; //4*64 bits
unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n")); FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n"));
FILE_LOG(logDEBUG1, ("beb_number:%X, ten_gig:%X,dst_number:%X, npackets:%X, " FILE_LOG(logDEBUG1, ("beb_number:%X, ten_gig:%X,dst_number:%X, npackets:%X, "
@ -1012,35 +1015,6 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
beb_number, ten_gig, dst_number, npackets, Beb_bit_mode, header_size, beb_number, ten_gig, dst_number, npackets, Beb_bit_mode, header_size,
nimages, test_just_send_out_packets_no_wait)); nimages, test_just_send_out_packets_no_wait));
// CMD_GEN core registers
//
// base for left feb fpga + 0x000
// base for right feb fpga + 0x100 Bytes
//
// OFFSETs given in Bytes
// base+00 0xC0DE0001 (static r/o)
// base+04 0x636D6467 (static r/o, ASCII for "CMDG")
//
// base+08 1st 32bits of 1st command
// base+0c 2nd 32bits of 1st command
//
// base+10 1st 32bits of 2nd command
// base+14 2nd 32bits of 2nd command
//
// base+18 command counter (sends n commands)
// <32 Bit mode : 2 commands for 1 frame neccessary (header + frame) (10 frames = 20 commands)
// 32 Bit mode : 3 commands for 1 frame neccessary (header + 1st halfframe + 2nd halfframe) (10 frames = 30 commands)
// if > 0 core starts operation
//
// base+1c command mode (for 32 bit mode)
// 0 for 2 command mode (send 1st command and 2nd command) (header + frame)
// 1 on bit 31 for 3 command mode (send 1st command, 2nd command, and 2nd command) (header + 1st halfframe + 2nd halfframe)
//
//
// Warning: Hard coded base address 0xc5000000 (TBD)
//
u_int32_t right_port_value = 0x2000; u_int32_t right_port_value = 0x2000;
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
volatile u_int32_t value; volatile u_int32_t value;
@ -1056,8 +1030,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
} }
// Generating commands // Generating commands
send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0; u_int32_t send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1); u_int32_t send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1);
{ {
int i; int i;
for (i=0; i < 10; i++) for (i=0; i < 10; i++)
@ -1377,6 +1351,10 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) {
return OK; return OK;
} }
void Beb_SetReadNLines(int value) {
Beb_readNLines = value;
}
uint16_t Beb_swap_uint16( uint16_t val) { uint16_t Beb_swap_uint16( uint16_t val) {
return (val << 8) | (val >> 8 ); return (val << 8) | (val >> 8 );

View File

@ -80,6 +80,8 @@ int Beb_SetDetectorPosition(int pos[]);
int Beb_SetStartingFrameNumber(uint64_t value); int Beb_SetStartingFrameNumber(uint64_t value);
int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable); int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable);
void Beb_SetReadNLines(int value);
uint16_t Beb_swap_uint16( uint16_t val); uint16_t Beb_swap_uint16( uint16_t val);
int Beb_open(u_int32_t** csp0base, u_int32_t offset); int Beb_open(u_int32_t** csp0base, u_int32_t offset);
u_int32_t Beb_Read32 (u_int32_t* baseaddr, u_int32_t offset); u_int32_t Beb_Read32 (u_int32_t* baseaddr, u_int32_t offset);

View File

@ -2092,6 +2092,26 @@ int Feb_Control_SetQuad(int val) {
return 1; return 1;
} }
int Feb_Control_SetReadNLines(int value) {
FILE_LOG(logINFO, ("Setting Read N Lines to %d\n", value));
if(!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(), DAQ_REG_PARTIAL_READOUT, value, 0, 0)) {
FILE_LOG(logERROR, ("Could not write %d to read n lines reg\n", value));
return 0;
}
return 1;
}
int Feb_Control_GetReadNLines() {
uint32_t regVal = 0;
if(!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(), DAQ_REG_PARTIAL_READOUT, &regVal)) {
FILE_LOG(logERROR, ("Could not read back read n lines reg\n"));
return -1;
}
FILE_LOG(logDEBUG1, ("Retval read n lines: %d\n", regVal));
return regVal;
}
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) { int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t actualOffset = offset; uint32_t actualOffset = offset;

View File

@ -154,7 +154,8 @@ int Feb_Control_SoftwareTrigger();
int Feb_Control_SetInterruptSubframe(int val); int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe(); int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetQuad(int val); int Feb_Control_SetQuad(int val);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data); int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval); int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval);

View File

@ -13,6 +13,7 @@
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0) #define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_SUBFRAME_EXPOSURES 6 #define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 //also pg and fifo status register #define DAQ_REG_SUBFRAME_PERIOD 7 //also pg and fifo status register
#define DAQ_REG_PARTIAL_READOUT 8
#define DAQ_REG_HRDWRE 12 #define DAQ_REG_HRDWRE 12
@ -20,7 +21,7 @@
#define DAQ_REG_HRDWRE_OW_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_OFST) #define DAQ_REG_HRDWRE_OW_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_OFST)
#define DAQ_REG_HRDWRE_TOP_OFST (1) #define DAQ_REG_HRDWRE_TOP_OFST (1)
#define DAQ_REG_HRDWRE_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_TOP_OFST) #define DAQ_REG_HRDWRE_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_TOP_OFST)
#define DAQ_REG_HRDWRE_INTRRPT_SF_OFST (3) #define DAQ_REG_HRDWRE_INTRRPT_SF_OFST (2)
#define DAQ_REG_HRDWRE_INTRRPT_SF_MSK (0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST) #define DAQ_REG_HRDWRE_INTRRPT_SF_MSK (0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST)
#define DAQ_REG_RO_OFFSET 20 #define DAQ_REG_RO_OFFSET 20

View File

@ -446,6 +446,7 @@ void setupDetector() {
setIODelay(DEFAULT_IO_DELAY); setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE); setTiming(DEFAULT_TIMING_MODE);
setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER); setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
setReadNLines(MAX_ROWS_PER_READOUT);
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15); //SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
setRateCorrection(DEFAULT_RATE_CORRECTION); setRateCorrection(DEFAULT_RATE_CORRECTION);
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY}; int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
@ -1358,6 +1359,26 @@ int getInterruptSubframe() {
#endif #endif
} }
int setReadNLines(int value) {
if(value < 0)
return FAIL;
#ifndef VIRTUAL
if(!Feb_Control_SetReadNLines(value)) {
return FAIL;
}
Beb_SetReadNLines(value);
return OK;
#endif
}
int getReadNLines() {
#ifdef VIRTUAL
return 0;
#else
return Feb_Control_GetReadNLines();
#endif
}
int enableTenGigabitEthernet(int val) { int enableTenGigabitEthernet(int val) {
if (val!=-1) { if (val!=-1) {
FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0));

View File

@ -75,6 +75,9 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
#define DEFAULT_TEST_MODE (0) #define DEFAULT_TEST_MODE (0)
#define DEFAULT_HIGH_VOLTAGE (0) #define DEFAULT_HIGH_VOLTAGE (0)
#define MAX_ROWS_PER_READOUT (256)
#define MAX_PACKETS_PER_REQUEST (256)
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF) #define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
#define DAC_MIN_MV (0) #define DAC_MIN_MV (0)

View File

@ -252,8 +252,10 @@ int setDetectorPosition(int pos[]);
#ifdef EIGERD #ifdef EIGERD
int setQuad(int value); int setQuad(int value);
int getQuad(); int getQuad();
int setInterruptSubframe(int value); int setInterruptSubframe(int value);
int getInterruptSubframe(); int getInterruptSubframe();
int setReadNLines(int value);
int getReadNLines();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) #if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD)
int enableTenGigabitEthernet(int val); int enableTenGigabitEthernet(int val);

View File

@ -248,6 +248,8 @@ const char* getFunctionName(enum detFuncs func) {
case F_GET_QUAD: return "F_GET_QUAD"; case F_GET_QUAD: return "F_GET_QUAD";
case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME"; case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME";
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME"; case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME";
case F_SET_READ_N_LINES: return "F_SET_READ_N_LINES";
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
default: return "Unknown Function"; default: return "Unknown Function";
} }
} }
@ -336,6 +338,8 @@ void function_table() {
flist[F_GET_QUAD] = &get_quad; flist[F_GET_QUAD] = &get_quad;
flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe; flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe; flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
flist[F_SET_READ_N_LINES] = &set_read_n_lines;
flist[F_GET_READ_N_LINES] = &get_read_n_lines;
// check // check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -4211,4 +4215,80 @@ int get_interrupt_subframe(int file_des) {
} }
#endif #endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
} }
int set_read_n_lines(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
FILE_LOG(logINFO, ("Setting read n lines: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL;
sprintf(mess, "Could not set number of lines readout. Must be between 1 and %d\n", MAX_ROWS_PER_READOUT);
FILE_LOG(logERROR,(mess));
} else {
int dr = setDynamicRange(-1);
int isTenGiga = enableTenGigabitEthernet(-1);
unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (isTenGiga ? 4 : 16) * dr;
if ((arg * maxnp) % maxnl) {
ret = FAIL;
sprintf(mess,
"Could not set %d number of lines readout. For %d bit mode and 10 giga %s, (%d (num "
"lines) x %d (max num packets for this mode)) must be divisible by %d\n",
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp, maxnl);
FILE_LOG(logERROR, (mess));
} else {
if(setReadNLines(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set read n lines.\n");
FILE_LOG(logERROR,(mess));
} else {
int retval = getReadNLines();
if (arg != retval) {
ret = FAIL;
sprintf(mess, "Could not set read n lines. Set %d, but read %d\n", retval, arg);
FILE_LOG(logERROR,(mess));
}
}
}
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
}
int get_read_n_lines(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
FILE_LOG(logDEBUG1, ("Getting read n lines\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getReadNLines();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get read n lines. \n");
FILE_LOG(logERROR,(mess));
} else {
FILE_LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}

View File

@ -108,4 +108,6 @@ int get_starting_frame_number(int);
int set_quad(int); int set_quad(int);
int get_quad(int); int get_quad(int);
int set_interrupt_subframe(int); int set_interrupt_subframe(int);
int get_interrupt_subframe(int); int get_interrupt_subframe(int);
int set_read_n_lines(int);
int get_read_n_lines(int);

View File

@ -374,6 +374,20 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
void setQuad(const bool enable, int detPos = -1); void setQuad(const bool enable, int detPos = -1);
/**
* Set number of rows to read out (Only for Eiger)
* @param value number of lines
* @param detPos -1 for all detectors in list or specific detector position
*/
void setReadNLines(const int value, int detPos = -1);
/**
* Get number of rows to read out (Only for Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns number of lines
*/
int getReadNLines(int detPos = -1);
/** /**
* Get Detector offset from shared memory in dimension d * Get Detector offset from shared memory in dimension d
* @param d dimension d * @param d dimension d

View File

@ -399,6 +399,18 @@ class slsDetector : public virtual slsDetectorDefs {
*/ */
void setQuad(const bool enable); void setQuad(const bool enable);
/**
* Set number of rows to read out (Only for Eiger)
* @param value number of lines
*/
void setReadNLines(const int value);
/**
* Get number of rows to read out (Only for Eiger)
* @returns number of lines
*/
int getReadNLines();
/** /**
* Get Detector offset from shared memory in dimension d * Get Detector offset from shared memory in dimension d
* @param d dimension d * @param d dimension d

View File

@ -553,6 +553,27 @@ void multiSlsDetector::setQuad(const bool enable, int detPos) {
detectors[0]->setQuad(enable); detectors[0]->setQuad(enable);
} }
void multiSlsDetector::setReadNLines(const int value, int detPos) {
// single
if (detPos >= 0) {
detectors[detPos]->setReadNLines(value);
}
// multi
parallelCall(&slsDetector::setReadNLines, value);
}
int multiSlsDetector::getReadNLines(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getReadNLines();
}
// multi
auto r = parallelCall(&slsDetector::getReadNLines);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getDetectorOffset(dimension d, int detPos) { int multiSlsDetector::getDetectorOffset(dimension d, int detPos) {
return detectors[detPos]->getDetectorOffset(d); return detectors[detPos]->getDetectorOffset(d);
} }

View File

@ -657,6 +657,23 @@ void slsDetector::setQuad(const bool enable) {
} }
} }
void slsDetector::setReadNLines(const int value) {
FILE_LOG(logDEBUG1) << "Setting read n lines to " << value;
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
FILE_LOG(logDEBUG1) << "Setting read n lines to " << value << " in Receiver";
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
}
}
int slsDetector::getReadNLines() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting read n lines";
sendToDetector(F_GET_READ_N_LINES, nullptr, retval);
FILE_LOG(logDEBUG1) << "Read n lines: " << retval;
return retval;
}
int slsDetector::getDetectorOffset(dimension d) const { int slsDetector::getDetectorOffset(dimension d) const {
return shm()->offset[d]; return shm()->offset[d];
} }

View File

@ -390,6 +390,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i; ++i;
/*! \page config
- <b>readnlines [i]</b> sets/gets the number of rows to read out per half module. Options: 1 - 256 (Not all values as it depends on dynamic range and 10GbE enabled). Used for EIGER only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "readnlines";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config /*! \page config
- <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge, - <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge, \c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge,
@ -4752,7 +4759,17 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
myDet->setInterruptSubframe(ival > 0 ? true : false); myDet->setInterruptSubframe(ival > 0 ? true : false);
} }
return std::to_string(myDet->getInterruptSubframe()); return std::to_string(myDet->getInterruptSubframe());
} else if (cmd == "extsig") {
} else if (cmd == "readnlines") {
if (action == PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
return std::string("could not scan readnlines parameter ") + std::string(args[1]);
myDet->setReadNLines(ival);
}
return std::to_string(myDet->getReadNLines());
} else if (cmd == "extsig") {
externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG; externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG;
if (action == PUT_ACTION) { if (action == PUT_ACTION) {
@ -4874,6 +4891,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl; os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl; os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines f \t sets the number of rows to read out per half module. Options: 1 - 256 (Not all values as it depends on dynamic range and 10GbE enabled). Used for EIGER only. " << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl; os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
os << "resetfpga f \t resets fpga, f can be any value" << std::endl; os << "resetfpga f \t resets fpga, f can be any value" << std::endl;
os << "copydetectorserver s p \t copies the detector server s via tftp from pc with hostname p and changes respawn server. Not for Eiger. " << std::endl; os << "copydetectorserver s p \t copies the detector server s via tftp from pc with hostname p and changes respawn server. Not for Eiger. " << std::endl;
@ -4887,9 +4905,9 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
if (action == GET_ACTION || action == HELP_ACTION) { if (action == GET_ACTION || action == HELP_ACTION) {
os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl; os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl; os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines \t gets the number of rows to read out per half module. Used for EIGER only. " << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl; os << "led \t returns led status (0 off, 1 on)" << std::endl;
os << "powerchip \t gets if the chip has been powered on or off" << std::endl; os << "powerchip \t gets if the chip has been powered on or off" << std::endl;
os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl; os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl;

View File

@ -3,49 +3,49 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include <stdint.h> #include <stdint.h>
#define MAX_DIMENSIONS 2 #define MAX_DIMENSIONS (2)
//socket //socket
#define GOODBYE -200 #define GOODBYE (-200)
#define RECEIVE_SOCKET_BUFFER_SIZE (100*1024*1024) #define RECEIVE_SOCKET_BUFFER_SIZE (100*1024*1024)
#define MAX_SOCKET_INPUT_PACKET_QUEUE 250000 #define MAX_SOCKET_INPUT_PACKET_QUEUE (250000)
//files //files
#define DO_NOTHING 0 #define DO_NOTHING (0)
#define DO_EVERYTHING 1 #define DO_EVERYTHING (1)
#define STATISTIC_FRAMENUMBER_INFINITE 20000 #define STATISTIC_FRAMENUMBER_INFINITE (20000)
//binary //binary
#define FILE_BUFFER_SIZE (16*1024*1024) //16mb #define FILE_BUFFER_SIZE (16*1024*1024) //16mb
//fifo //fifo
#define FIFO_HEADER_NUMBYTES 8 #define FIFO_HEADER_NUMBYTES (8)
#define FIFO_DATASIZE_NUMBYTES 4 #define FIFO_DATASIZE_NUMBYTES (4)
#define FIFO_PADDING_NUMBYTES 4 // for 8 byte alignment due to sls_receiver_header structure #define FIFO_PADDING_NUMBYTES (4) // for 8 byte alignment due to sls_receiver_header structure
//hdf5 //hdf5
#define MAX_CHUNKED_IMAGES 1 #define MAX_CHUNKED_IMAGES (1)
//versions //versions
#define HDF5_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 #define BINARY_WRITER_VERSION (3.0) //1 decimal places
//parameters to calculate fifo depth //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 //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 LISTENER_PRIORITY (90)
#define PROCESSOR_PRIORITY 70 #define PROCESSOR_PRIORITY (70)
#define STREAMER_PRIORITY 10 #define STREAMER_PRIORITY (10)
#define TCP_PRIORITY 10 #define TCP_PRIORITY (10)

View File

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

View File

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

View File

@ -70,6 +70,7 @@ void slsReceiverImplementation::InitializeMembers() {
flippedDataX = 0; flippedDataX = 0;
gapPixelsEnable = false; gapPixelsEnable = false;
quadEnable = false; quadEnable = false;
numLinesReadout = MAX_EIGER_ROWS_PER_READOUT;
readoutFlags = GET_READOUT_FLAGS; readoutFlags = GET_READOUT_FLAGS;
//*** receiver parameters *** //*** receiver parameters ***
@ -168,6 +169,11 @@ bool slsReceiverImplementation::getQuad() const {
return quadEnable; return quadEnable;
} }
int slsReceiverImplementation::getReadNLines() const {
FILE_LOG(logDEBUG) << __AT__ << " starting";
return numLinesReadout;
}
slsDetectorDefs::readOutFlags slsDetectorDefs::readOutFlags
slsReceiverImplementation::getReadOutFlags() const { slsReceiverImplementation::getReadOutFlags() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
@ -543,6 +549,11 @@ int slsReceiverImplementation::setQuad(const bool b) {
return OK; 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) { int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
if (readoutFlags != f) { if (readoutFlags != f) {
readoutFlags = f; readoutFlags = f;
@ -1405,10 +1416,17 @@ void slsReceiverImplementation::stopReceiver() {
uint64_t tot = 0; uint64_t tot = 0;
for (int i = 0; i < numThreads; i++) { for (int i = 0; i < numThreads; i++) {
tot += dataProcessor[i]->GetNumFramesCaught(); tot += dataProcessor[i]->GetNumFramesCaught();
int64_t missingpackets = int64_t missingpackets =
numberOfFrames * generalData->packetsPerFrame - numberOfFrames * generalData->packetsPerFrame -
listener[i]->GetPacketsCaught(); 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 = TLogLevel lev =
(((int64_t)missingpackets) > 0) ? logINFORED : logINFOGREEN; (((int64_t)missingpackets) > 0) ? logINFORED : logINFOGREEN;
FILE_LOG(lev) << 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_GET_RECEIVER_DBIT_LIST] = &slsReceiverTCPIPInterface::get_dbit_list;
flist[F_RECEIVER_DBIT_OFFSET] = &slsReceiverTCPIPInterface::set_dbit_offset; flist[F_RECEIVER_DBIT_OFFSET] = &slsReceiverTCPIPInterface::set_dbit_offset;
flist[F_SET_RECEIVER_QUAD] = &slsReceiverTCPIPInterface::set_quad_type; 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++) { for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" << FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
@ -1323,4 +1323,17 @@ int slsReceiverTCPIPInterface::set_quad_type(Interface &socket) {
validate(quadEnable, retval, "set quad", DEC); validate(quadEnable, retval, "set quad", DEC);
FILE_LOG(logDEBUG1) << "quad retval:" << retval; FILE_LOG(logDEBUG1) << "quad retval:" << retval;
return socket.Send(OK); 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);
} }

View File

@ -93,6 +93,8 @@ enum detFuncs{
F_GET_QUAD, F_GET_QUAD,
F_SET_INTERRUPT_SUBFRAME, F_SET_INTERRUPT_SUBFRAME,
F_GET_INTERRUPT_SUBFRAME, F_GET_INTERRUPT_SUBFRAME,
F_SET_READ_N_LINES,
F_GET_READ_N_LINES,
NUM_DET_FUNCTIONS, NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */ RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */
@ -151,6 +153,7 @@ enum detFuncs{
F_GET_RECEIVER_DBIT_LIST, /** < get receiver digital bit list */ F_GET_RECEIVER_DBIT_LIST, /** < get receiver digital bit list */
F_RECEIVER_DBIT_OFFSET, /** < set/get reciever digital bit offset */ F_RECEIVER_DBIT_OFFSET, /** < set/get reciever digital bit offset */
F_SET_RECEIVER_QUAD, F_SET_RECEIVER_QUAD,
F_SET_RECEIVER_READ_N_LINES,
NUM_REC_FUNCTIONS NUM_REC_FUNCTIONS
}; };
@ -240,6 +243,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_QUAD: return "F_GET_QUAD"; case F_GET_QUAD: return "F_GET_QUAD";
case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME"; case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME";
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME"; case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME";
case F_SET_READ_N_LINES: return "F_SET_READ_N_LINES";
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
@ -298,6 +303,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_RECEIVER_DBIT_LIST: return "F_GET_RECEIVER_DBIT_LIST"; case F_GET_RECEIVER_DBIT_LIST: return "F_GET_RECEIVER_DBIT_LIST";
case F_RECEIVER_DBIT_OFFSET: return "F_RECEIVER_DBIT_OFFSET"; case F_RECEIVER_DBIT_OFFSET: return "F_RECEIVER_DBIT_OFFSET";
case F_SET_RECEIVER_QUAD: return "F_SET_RECEIVER_QUAD"; case F_SET_RECEIVER_QUAD: return "F_SET_RECEIVER_QUAD";
case F_SET_RECEIVER_READ_N_LINES: return "F_SET_RECEIVER_READ_N_LINES";
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS"; case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
default: return "Unknown Function"; default: return "Unknown Function";

View File

@ -7,4 +7,4 @@
#define APIRECEIVER 0x190722 #define APIRECEIVER 0x190722
#define APIGUI 0x190723 #define APIGUI 0x190723
#define APIJUNGFRAU 0x190730 #define APIJUNGFRAU 0x190730
#define APIEIGER 0x190731 #define APIEIGER 0x190806