mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 09:00:41 +02:00
Removeudpcache (#65)
* WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * solved eiger 1-10g issue * some fixes for remove udp cache to work * bug fix virtual * removed special handling of rx_udpip
This commit is contained in:
parent
6e6fcec698
commit
ca054626e6
2
cmk.sh
2
cmk.sh
@ -155,7 +155,7 @@ if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
||||
echo "Enabling Compile Option: TextClient, Receiver and GUI"
|
||||
else
|
||||
if [ $TEXTCLIENT -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=OFF "
|
||||
echo "Enabling Compile Option: TextClient"
|
||||
fi
|
||||
if [ $RECEIVER -eq 1 ]; then
|
||||
|
Binary file not shown.
@ -25,6 +25,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
// Global variable from UDPPacketHeaderGenerator
|
||||
extern uint64_t udpFrameNumber;
|
||||
@ -63,7 +64,7 @@ int analogEnable = 1;
|
||||
int digitalEnable = 0;
|
||||
int naSamples = 1;
|
||||
int ndSamples = 1;
|
||||
|
||||
int detPos[2] = {0, 0};
|
||||
|
||||
int isFirmwareCheckDone() {
|
||||
return firmware_check_done;
|
||||
@ -1503,7 +1504,13 @@ long int calcChecksum(int sourceip, int destip) {
|
||||
|
||||
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport){
|
||||
int configureMAC(){
|
||||
uint32_t sourceip = udpDetails.srcip;
|
||||
uint32_t destip = udpDetails.dstip;
|
||||
uint64_t sourcemac = udpDetails.srcmac;
|
||||
uint64_t destmac = udpDetails.dstmac;
|
||||
int sourceport = udpDetails.srcport;
|
||||
int destport = udpDetails.dstport;
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
@ -1517,8 +1524,8 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, udpport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, udpport) == FAIL) {
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, destport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp 1G destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
@ -1527,7 +1534,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
// 10 G
|
||||
FILE_LOG(logINFOBLUE, ("Configuring 10G MAC\n"));
|
||||
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
|
||||
|
||||
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
||||
@ -1551,7 +1557,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
(unsigned int)((destmac>>8)&0xFF),
|
||||
(unsigned int)((destmac>>0)&0xFF),
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",udpport, udpport));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport));
|
||||
|
||||
long int checksum=calcChecksum(sourceip, destip);
|
||||
bus_w(TX_IP_REG, sourceip);
|
||||
@ -1576,7 +1582,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
FILE_LOG(logDEBUG1, ("Read from RX_MAC_MSB_REG: 0x%08x\n", bus_r(RX_MAC_MSB_REG)));
|
||||
|
||||
val = (((sourceport << UDP_PORT_TX_OFST) & UDP_PORT_TX_MSK) |
|
||||
((udpport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
|
||||
((destport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
|
||||
bus_w(UDP_PORT_REG, val);
|
||||
FILE_LOG(logDEBUG1, ("Read from UDP_PORT_REG: 0x%08x\n", bus_r(UDP_PORT_REG)));
|
||||
|
||||
@ -1591,6 +1597,15 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
return OK;
|
||||
}
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
int enableTenGigabitEthernet(int val) {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
|
@ -1176,6 +1176,9 @@ int Beb_GetQuad() {
|
||||
return Beb_quadEnable;
|
||||
}
|
||||
|
||||
int* Beb_GetDetectorPosition() {
|
||||
return Beb_positions;
|
||||
}
|
||||
|
||||
int Beb_SetDetectorPosition(int pos[]) {
|
||||
if (!Beb_activated)
|
||||
|
@ -76,6 +76,7 @@ int Beb_GetBebFPGATemp();
|
||||
void Beb_SetDetectorNumber(uint32_t detid);
|
||||
int Beb_SetQuad(int value);
|
||||
int Beb_GetQuad();
|
||||
int* Beb_GetDetectorPosition();
|
||||
int Beb_SetDetectorPosition(int pos[]);
|
||||
int Beb_SetStartingFrameNumber(uint64_t value);
|
||||
int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable);
|
||||
|
Binary file not shown.
@ -18,7 +18,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
// Global variable from communication_funcs.c
|
||||
extern int isControlServer;
|
||||
@ -86,6 +86,7 @@ int eiger_virtual_activate=1;
|
||||
pthread_t eiger_virtual_tid;
|
||||
int eiger_virtual_stop = 0;
|
||||
uint64_t eiger_virtual_startingframenumber = 0;
|
||||
int eiger_virtual_detPos[2] = {0, 0};
|
||||
#endif
|
||||
|
||||
|
||||
@ -134,6 +135,10 @@ void basictests() {
|
||||
(long long int)sw_fw_apiversion,
|
||||
REQUIRED_FIRMWARE_VERSION,
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// update default udpdstip and udpdstmac (1g is hardware ip and hardware mac)
|
||||
udpDetails.srcip = ipadd;
|
||||
udpDetails.srcmac = macadd;
|
||||
|
||||
// return if debugflag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
@ -929,7 +934,7 @@ enum detectorSettings getSettings() {
|
||||
/* parameters - threshold */
|
||||
|
||||
int getThresholdEnergy() {
|
||||
FILE_LOG(logINFO, ("Getting Threshold energy\n"));
|
||||
FILE_LOG(logDEBUG1, ("Getting Threshold energy\n"));
|
||||
return eiger_photonenergy;
|
||||
}
|
||||
|
||||
@ -1157,17 +1162,25 @@ enum timingMode getTiming() {
|
||||
|
||||
/* configure mac */
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2) {
|
||||
int configureMAC() {
|
||||
uint32_t sourceip = udpDetails.srcip;
|
||||
uint32_t destip = udpDetails.dstip;
|
||||
uint64_t sourcemac = udpDetails.srcmac;
|
||||
uint64_t destmac = udpDetails.dstmac;
|
||||
int src_port = udpDetails.srcport;
|
||||
int destport = udpDetails.dstport;
|
||||
int destport2 = udpDetails.dstport2;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, udpport, udpport2));
|
||||
if (setUDPDestinationDetails(0, cDestIp, udpport) == FAIL) {
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, destport, destport2));
|
||||
if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (setUDPDestinationDetails(1, cDestIp, udpport2) == FAIL) {
|
||||
if (setUDPDestinationDetails(1, cDestIp, destport2) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port2\n"));
|
||||
return FAIL;
|
||||
}
|
||||
@ -1175,8 +1188,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
#else
|
||||
FILE_LOG(logINFO, ("Configuring MAC\n"));
|
||||
|
||||
int src_port = DEFAULT_UDP_SOURCE_PORT;
|
||||
|
||||
char src_mac[50], src_ip[INET_ADDRSTRLEN],dst_mac[50], dst_ip[INET_ADDRSTRLEN];
|
||||
getMacAddressinString(src_mac, 50, sourcemac);
|
||||
getMacAddressinString(dst_mac, 50, destmac);
|
||||
@ -1195,9 +1206,9 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
int beb_num = detid;
|
||||
int header_number = 0;
|
||||
int dst_port = udpport;
|
||||
int dst_port = destport;
|
||||
if (!top)
|
||||
dst_port = udpport2;
|
||||
dst_port = destport2;
|
||||
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n", dst_port));
|
||||
|
||||
@ -1212,9 +1223,9 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
/*}*/
|
||||
|
||||
header_number = 32;
|
||||
dst_port = udpport2;
|
||||
dst_port = destport2;
|
||||
if (!top)
|
||||
dst_port = udpport;
|
||||
dst_port = destport;
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n",dst_port));
|
||||
|
||||
/*for(i=0;i<32;i++) {*//** modified for Aldo*/
|
||||
@ -1235,15 +1246,23 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
}
|
||||
|
||||
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
#ifdef VIRTUAL
|
||||
memcpy(eiger_virtual_detPos, pos, sizeof(eiger_virtual_detPos));
|
||||
return OK;
|
||||
#else
|
||||
return Beb_SetDetectorPosition(pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
#ifdef VIRTUAL
|
||||
return eiger_virtual_detPos;
|
||||
#else
|
||||
return Beb_GetDetectorPosition();
|
||||
#endif
|
||||
}
|
||||
|
||||
int setQuad(int value) {
|
||||
if (value < 0) {
|
||||
return OK;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
int firmware_compatibility = OK;
|
||||
int firmware_check_done = 0;
|
||||
@ -35,7 +36,7 @@ int virtual_stop = 0;
|
||||
|
||||
uint32_t clkDivider[NUM_CLOCKS] = {125, 20, 80};
|
||||
int highvoltage = 0;
|
||||
|
||||
int detPos[2] = {0, 0};
|
||||
|
||||
int isFirmwareCheckDone() {
|
||||
return firmware_check_done;
|
||||
@ -471,13 +472,21 @@ int setHighVoltage(int val){
|
||||
}
|
||||
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport) {
|
||||
int configureMAC() {
|
||||
|
||||
uint32_t srcip = udpDetails.srcip;
|
||||
uint32_t dstip = udpDetails.dstip;
|
||||
uint64_t srcmac = udpDetails.srcmac;
|
||||
uint64_t dstmac = udpDetails.dstmac;
|
||||
int srcport = udpDetails.srcport;
|
||||
int dstport = udpDetails.dstport;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, udpport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, udpport) == FAIL) {
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
@ -485,30 +494,29 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
#endif
|
||||
FILE_LOG(logINFOBLUE, ("Configuring MAC\n"));
|
||||
|
||||
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
|
||||
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
||||
(srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip));
|
||||
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((sourcemac>>40)&0xFF),
|
||||
(unsigned int)((sourcemac>>32)&0xFF),
|
||||
(unsigned int)((sourcemac>>24)&0xFF),
|
||||
(unsigned int)((sourcemac>>16)&0xFF),
|
||||
(unsigned int)((sourcemac>>8)&0xFF),
|
||||
(unsigned int)((sourcemac>>0)&0xFF),
|
||||
(long long unsigned int)sourcemac));
|
||||
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport));
|
||||
(unsigned int)((srcmac>>40)&0xFF),
|
||||
(unsigned int)((srcmac>>32)&0xFF),
|
||||
(unsigned int)((srcmac>>24)&0xFF),
|
||||
(unsigned int)((srcmac>>16)&0xFF),
|
||||
(unsigned int)((srcmac>>8)&0xFF),
|
||||
(unsigned int)((srcmac>>0)&0xFF),
|
||||
(long long unsigned int)srcmac));
|
||||
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport));
|
||||
|
||||
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t\t(0x%08x)\n",
|
||||
(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip));
|
||||
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff, dstip));
|
||||
FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((destmac>>40)&0xFF),
|
||||
(unsigned int)((destmac>>32)&0xFF),
|
||||
(unsigned int)((destmac>>24)&0xFF),
|
||||
(unsigned int)((destmac>>16)&0xFF),
|
||||
(unsigned int)((destmac>>8)&0xFF),
|
||||
(unsigned int)((destmac>>0)&0xFF),
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
|
||||
(unsigned int)((dstmac>>40)&0xFF),
|
||||
(unsigned int)((dstmac>>32)&0xFF),
|
||||
(unsigned int)((dstmac>>24)&0xFF),
|
||||
(unsigned int)((dstmac>>16)&0xFF),
|
||||
(unsigned int)((dstmac>>8)&0xFF),
|
||||
(unsigned int)((dstmac>>0)&0xFF),
|
||||
(long long unsigned int)dstmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport));
|
||||
|
||||
// start addr
|
||||
uint32_t addr = BASE_PATTERN_RAM;
|
||||
@ -520,21 +528,21 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
// mac addresses
|
||||
// msb (32) + lsb (16)
|
||||
udp->udp_destmac_msb = ((destmac >> 16) & BIT32_MASK);
|
||||
udp->udp_destmac_lsb = ((destmac >> 0) & BIT16_MASK);
|
||||
udp->udp_destmac_msb = ((dstmac >> 16) & BIT32_MASK);
|
||||
udp->udp_destmac_lsb = ((dstmac >> 0) & BIT16_MASK);
|
||||
// msb (16) + lsb (32)
|
||||
udp->udp_srcmac_msb = ((sourcemac >> 32) & BIT16_MASK);
|
||||
udp->udp_srcmac_lsb = ((sourcemac >> 0) & BIT32_MASK);
|
||||
udp->udp_srcmac_msb = ((srcmac >> 32) & BIT16_MASK);
|
||||
udp->udp_srcmac_lsb = ((srcmac >> 0) & BIT32_MASK);
|
||||
|
||||
// ip addresses
|
||||
udp->ip_srcip_msb = ((sourceip >> 16) & BIT16_MASK);
|
||||
udp->ip_srcip_lsb = ((sourceip >> 0) & BIT16_MASK);
|
||||
udp->ip_destip_msb = ((destip >> 16) & BIT16_MASK);
|
||||
udp->ip_destip_lsb = ((destip >> 0) & BIT16_MASK);
|
||||
udp->ip_srcip_msb = ((srcip >> 16) & BIT16_MASK);
|
||||
udp->ip_srcip_lsb = ((srcip >> 0) & BIT16_MASK);
|
||||
udp->ip_destip_msb = ((dstip >> 16) & BIT16_MASK);
|
||||
udp->ip_destip_lsb = ((dstip >> 0) & BIT16_MASK);
|
||||
|
||||
// source port
|
||||
udp->udp_srcport = sourceport;
|
||||
udp->udp_destport = udpport;
|
||||
udp->udp_srcport = srcport;
|
||||
udp->udp_destport = dstport;
|
||||
|
||||
// other defines
|
||||
udp->udp_ethertype = 0x800;
|
||||
@ -590,6 +598,15 @@ void calcChecksum(udp_header* udp) {
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
|
Binary file not shown.
@ -15,7 +15,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
// Variables that will be exported
|
||||
int phaseShift = DEFAULT_PHASE_SHIFT;
|
||||
@ -30,6 +30,7 @@ int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
int highvoltage = 0;
|
||||
#endif
|
||||
int detPos[2] = {0, 0};
|
||||
|
||||
int detectorFirstServer = 1;
|
||||
int dacValues[NDAC] = {0};
|
||||
@ -1327,7 +1328,13 @@ void calcChecksum(mac_conf* mac, int sourceip, int destip) {
|
||||
mac->ip.ip_chksum = checksum;
|
||||
}
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport) {
|
||||
int configureMAC() {
|
||||
uint32_t sourceip = udpDetails.srcip;
|
||||
uint32_t destip = udpDetails.dstip;
|
||||
uint64_t sourcemac = udpDetails.srcmac;
|
||||
uint64_t destmac = udpDetails.dstmac;
|
||||
int sourceport = udpDetails.srcport;
|
||||
int destport = udpDetails.dstport;
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
@ -1337,7 +1344,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
FILE_LOG(logDEBUG1, ("\tRoi: %d, Ip Packet size: %d UDP Packet size: %d\n",
|
||||
adcConfigured, ipPacketSize, udpPacketSize));
|
||||
|
||||
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
|
||||
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d (0x%08x)\n",
|
||||
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
||||
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x (0x%010llx)\n",
|
||||
@ -1359,7 +1365,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
(unsigned int)((destmac>>8)&0xFF),
|
||||
(unsigned int)((destmac>>0)&0xFF),
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",udpport, udpport));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",destport, destport));
|
||||
|
||||
//reset mac
|
||||
bus_w (addr, bus_r(addr) | RST_MSK);
|
||||
@ -1413,7 +1419,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
|
||||
calcChecksum(mac_conf_regs, sourceip, destip);
|
||||
mac_conf_regs->udp.udp_srcport = sourceport;
|
||||
mac_conf_regs->udp.udp_destport = udpport;
|
||||
mac_conf_regs->udp.udp_destport = destport;
|
||||
mac_conf_regs->udp.udp_len = udpPacketSize;
|
||||
mac_conf_regs->udp.udp_chksum = 0x0000;
|
||||
|
||||
@ -1516,10 +1522,20 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int getAdcConfigured(){
|
||||
return adcConfigured;
|
||||
}
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
|
Binary file not shown.
@ -23,6 +23,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
int firmware_compatibility = OK;
|
||||
int firmware_check_done = 0;
|
||||
@ -38,6 +39,9 @@ enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int highvoltage = 0;
|
||||
int dacValues[NDAC] = {0};
|
||||
int adcPhase = 0;
|
||||
int detPos[4] = {0, 0, 0, 0};
|
||||
int numUDPInterfaces = 1;
|
||||
|
||||
|
||||
int isFirmwareCheckDone() {
|
||||
return firmware_check_done;
|
||||
@ -1022,16 +1026,12 @@ void setNumberofUDPInterfaces(int val) {
|
||||
FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 1\n"));
|
||||
bus_w(addr, bus_r(addr) &~ CONFIG_OPRTN_MDE_2_X_10GbE_MSK);
|
||||
}
|
||||
FILE_LOG(logINFO, ("config reg:0x%x\n", bus_r(addr)));
|
||||
FILE_LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
||||
}
|
||||
|
||||
int getNumberofUDPInterfaces() {
|
||||
FILE_LOG(logINFO, ("config reg:0x%x\n", bus_r(CONFIG_REG)));
|
||||
FILE_LOG(logINFO, ("config reg 2x10 :0x%x %d\n",
|
||||
CONFIG_OPRTN_MDE_2_X_10GbE_MSK,
|
||||
bus_r(CONFIG_REG)|CONFIG_OPRTN_MDE_2_X_10GbE_MSK));
|
||||
FILE_LOG(logDEBUG, ("config reg:0x%x\n", bus_r(CONFIG_REG)));
|
||||
// return 2 if enabled, else 1
|
||||
|
||||
return ((bus_r(CONFIG_REG) & CONFIG_OPRTN_MDE_2_X_10GbE_MSK) ? 2 : 1);
|
||||
}
|
||||
|
||||
@ -1128,94 +1128,104 @@ void calcChecksum(udp_header* udp) {
|
||||
|
||||
|
||||
|
||||
int configureMAC(int numInterfaces, int selInterface,
|
||||
uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport,
|
||||
uint32_t destip2, uint64_t destmac2, uint64_t sourcemac2, uint32_t sourceip2, uint32_t udpport2) {
|
||||
int configureMAC() {
|
||||
|
||||
uint32_t srcip = udpDetails.srcip;
|
||||
uint32_t srcip2 = udpDetails.srcip2;
|
||||
uint32_t dstip = udpDetails.dstip;
|
||||
uint32_t dstip2 = udpDetails.dstip2;
|
||||
uint64_t srcmac = udpDetails.srcmac;
|
||||
uint64_t srcmac2 = udpDetails.srcmac2;
|
||||
uint64_t dstmac = udpDetails.dstmac;
|
||||
uint64_t dstmac2 = udpDetails.dstmac2;
|
||||
int srcport = udpDetails.srcport;
|
||||
int srcport2 = udpDetails.srcport2;
|
||||
int dstport = udpDetails.dstport;
|
||||
int dstport2 = udpDetails.dstport2;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, udpport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, udpport) == FAIL) {
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
#endif
|
||||
FILE_LOG(logINFOBLUE, ("Configuring MAC\n"));
|
||||
|
||||
uint32_t sourceport = DEFAULT_TX_UDP_PORT;
|
||||
|
||||
int numInterfaces = getNumberofUDPInterfaces();
|
||||
int selInterface = getPrimaryInterface();
|
||||
FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
|
||||
FILE_LOG(logINFO, ("\tInterface : %d %s\n\n", selInterface, (selInterface ? "Inner" : "Outer")));
|
||||
|
||||
FILE_LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": (selInterface ? "Not Used" : "Used")));
|
||||
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
||||
(srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip));
|
||||
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((sourcemac>>40)&0xFF),
|
||||
(unsigned int)((sourcemac>>32)&0xFF),
|
||||
(unsigned int)((sourcemac>>24)&0xFF),
|
||||
(unsigned int)((sourcemac>>16)&0xFF),
|
||||
(unsigned int)((sourcemac>>8)&0xFF),
|
||||
(unsigned int)((sourcemac>>0)&0xFF),
|
||||
(long long unsigned int)sourcemac));
|
||||
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport));
|
||||
(unsigned int)((srcmac>>40)&0xFF),
|
||||
(unsigned int)((srcmac>>32)&0xFF),
|
||||
(unsigned int)((srcmac>>24)&0xFF),
|
||||
(unsigned int)((srcmac>>16)&0xFF),
|
||||
(unsigned int)((srcmac>>8)&0xFF),
|
||||
(unsigned int)((srcmac>>0)&0xFF),
|
||||
(long long unsigned int)srcmac));
|
||||
FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport));
|
||||
|
||||
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t\t(0x%08x)\n",
|
||||
(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip));
|
||||
FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff, dstip));
|
||||
FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((destmac>>40)&0xFF),
|
||||
(unsigned int)((destmac>>32)&0xFF),
|
||||
(unsigned int)((destmac>>24)&0xFF),
|
||||
(unsigned int)((destmac>>16)&0xFF),
|
||||
(unsigned int)((destmac>>8)&0xFF),
|
||||
(unsigned int)((destmac>>0)&0xFF),
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
|
||||
(unsigned int)((dstmac>>40)&0xFF),
|
||||
(unsigned int)((dstmac>>32)&0xFF),
|
||||
(unsigned int)((dstmac>>24)&0xFF),
|
||||
(unsigned int)((dstmac>>16)&0xFF),
|
||||
(unsigned int)((dstmac>>8)&0xFF),
|
||||
(unsigned int)((dstmac>>0)&0xFF),
|
||||
(long long unsigned int)dstmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport));
|
||||
|
||||
uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1;
|
||||
FILE_LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": (selInterface ? "Used" : "Not Used")));
|
||||
FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(sourceip2>>24)&0xff,(sourceip2>>16)&0xff,(sourceip2>>8)&0xff,(sourceip2)&0xff, sourceip2));
|
||||
(srcip2>>24)&0xff,(srcip2>>16)&0xff,(srcip2>>8)&0xff,(srcip2)&0xff, srcip2));
|
||||
FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((sourcemac2>>40)&0xFF),
|
||||
(unsigned int)((sourcemac2>>32)&0xFF),
|
||||
(unsigned int)((sourcemac2>>24)&0xFF),
|
||||
(unsigned int)((sourcemac2>>16)&0xFF),
|
||||
(unsigned int)((sourcemac2>>8)&0xFF),
|
||||
(unsigned int)((sourcemac2>>0)&0xFF),
|
||||
(long long unsigned int)sourcemac2));
|
||||
FILE_LOG(logINFO, ("\tSource Port2: %d \t\t\t(0x%08x)\n",sourceport2, sourceport2));
|
||||
(unsigned int)((srcmac2>>40)&0xFF),
|
||||
(unsigned int)((srcmac2>>32)&0xFF),
|
||||
(unsigned int)((srcmac2>>24)&0xFF),
|
||||
(unsigned int)((srcmac2>>16)&0xFF),
|
||||
(unsigned int)((srcmac2>>8)&0xFF),
|
||||
(unsigned int)((srcmac2>>0)&0xFF),
|
||||
(long long unsigned int)srcmac2));
|
||||
FILE_LOG(logINFO, ("\tSource Port2: %d \t\t\t(0x%08x)\n", srcport2, srcport2));
|
||||
|
||||
FILE_LOG(logINFO, ("\tDest. IP2 : %d.%d.%d.%d \t\t\t(0x%08x)\n",
|
||||
(destip2>>24)&0xff,(destip2>>16)&0xff,(destip2>>8)&0xff,(destip2)&0xff, destip2));
|
||||
FILE_LOG(logINFO, ("\tDest. IP2 : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||
(dstip2>>24)&0xff,(dstip2>>16)&0xff,(dstip2>>8)&0xff,(dstip2)&0xff, dstip2));
|
||||
FILE_LOG(logINFO, ("\tDest. MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
(unsigned int)((destmac2>>40)&0xFF),
|
||||
(unsigned int)((destmac2>>32)&0xFF),
|
||||
(unsigned int)((destmac2>>24)&0xFF),
|
||||
(unsigned int)((destmac2>>16)&0xFF),
|
||||
(unsigned int)((destmac2>>8)&0xFF),
|
||||
(unsigned int)((destmac2>>0)&0xFF),
|
||||
(long long unsigned int)destmac2));
|
||||
FILE_LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n",udpport2, udpport2));
|
||||
(unsigned int)((dstmac2>>40)&0xFF),
|
||||
(unsigned int)((dstmac2>>32)&0xFF),
|
||||
(unsigned int)((dstmac2>>24)&0xFF),
|
||||
(unsigned int)((dstmac2>>16)&0xFF),
|
||||
(unsigned int)((dstmac2>>8)&0xFF),
|
||||
(unsigned int)((dstmac2>>0)&0xFF),
|
||||
(long long unsigned int)dstmac2));
|
||||
FILE_LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n", dstport2, dstport2));
|
||||
|
||||
// default one rxr entry (others not yet implemented in client yet)
|
||||
int iRxEntry = 0;
|
||||
|
||||
if (numInterfaces == 2) {
|
||||
// bottom
|
||||
setupHeader(iRxEntry, OUTER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip, srcport);
|
||||
// top
|
||||
setupHeader(iRxEntry, INNER, destip2, destmac2, udpport2, sourcemac2, sourceip2, sourceport2);
|
||||
setupHeader(iRxEntry, INNER, dstip2, dstmac2, dstport2, srcmac2, srcip2, srcport2);
|
||||
}
|
||||
// single interface
|
||||
else {
|
||||
// default
|
||||
if (selInterface == 0) {
|
||||
setupHeader(iRxEntry, OUTER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip, srcport);
|
||||
} else {
|
||||
setupHeader(iRxEntry, INNER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
setupHeader(iRxEntry, INNER, dstip, dstmac, dstport, srcmac, srcip, srcport2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1228,15 +1238,13 @@ int configureMAC(int numInterfaces, int selInterface,
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
int innerPos[2] = {pos[X], pos[Y]};
|
||||
int outerPos[2] = {pos[X], pos[Y]};
|
||||
int selInterface = getPrimaryInterface();
|
||||
int numInterfaces = getNumberofUDPInterfaces();
|
||||
|
||||
if (numInterfaces == 1) {
|
||||
if (getNumberofUDPInterfaces() == 1) {
|
||||
FILE_LOG(logDEBUG, ("Setting detector position: 1 Interface %s \n(%d, %d)\n",
|
||||
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
|
||||
}
|
||||
@ -1246,6 +1254,10 @@ int setDetectorPosition(int pos[]) {
|
||||
" inner top(%d, %d), outer bottom(%d, %d)\n"
|
||||
, innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
|
||||
}
|
||||
detPos[0] = innerPos[0];
|
||||
detPos[1] = innerPos[1];
|
||||
detPos[2] = outerPos[0];
|
||||
detPos[3] = outerPos[1];
|
||||
|
||||
// row
|
||||
//outer
|
||||
@ -1270,7 +1282,7 @@ int setDetectorPosition(int pos[]) {
|
||||
ret = FAIL;
|
||||
|
||||
if (ret == OK) {
|
||||
if (numInterfaces == 1) {
|
||||
if (getNumberofUDPInterfaces() == 1) {
|
||||
FILE_LOG(logINFOBLUE, ("Position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
|
||||
}
|
||||
else {
|
||||
@ -1282,6 +1294,10 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
|
||||
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll, flashing fpga */
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
extern udpStruct udpDetails;
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
@ -35,6 +36,7 @@ int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0};
|
||||
uint32_t clkDivider[NUM_CLOCKS] = {125, 20, 80};
|
||||
|
||||
int highvoltage = 0;
|
||||
int detPos[2] = {0, 0};
|
||||
|
||||
int isFirmwareCheckDone() {
|
||||
return firmware_check_done;
|
||||
@ -400,17 +402,19 @@ int setHighVoltage(int val){
|
||||
}
|
||||
|
||||
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport) {
|
||||
int configureMAC() {
|
||||
#ifdef VIRTUAL
|
||||
uint32_t dstip = udpDetails.dstip;
|
||||
int dstport = udpDetails.dstport;
|
||||
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, udpport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, udpport) == FAIL) {
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport));
|
||||
if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
@ -636,6 +640,15 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
@ -658,6 +671,8 @@ int startStateMachine(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
|
@ -14,6 +14,21 @@ Here are the definitions, but the actual implementation should be done for each
|
||||
****************************************************/
|
||||
|
||||
enum interfaceType {OUTER, INNER};
|
||||
typedef struct udpStruct_s {
|
||||
int srcport;
|
||||
int srcport2;
|
||||
int dstport;
|
||||
int dstport2;
|
||||
uint64_t srcmac;
|
||||
uint64_t srcmac2;
|
||||
uint64_t dstmac;
|
||||
uint64_t dstmac2;
|
||||
uint32_t srcip;
|
||||
uint32_t srcip2;
|
||||
uint32_t dstip;
|
||||
uint32_t dstip2;
|
||||
}udpStruct;
|
||||
|
||||
|
||||
// basic tests
|
||||
int isFirmwareCheckDone();
|
||||
@ -263,19 +278,14 @@ long int calcChecksum(int sourceip, int destip);
|
||||
int getAdcConfigured();
|
||||
#endif
|
||||
|
||||
#ifdef EIGERD
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2);
|
||||
#elif JUNGFRAUD
|
||||
int configureMAC(int numInterfaces, int selInterface,
|
||||
uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport,
|
||||
uint32_t destip2, uint64_t destmac2, uint64_t sourcemac2, uint32_t sourceip2, uint32_t udpport2);
|
||||
#else
|
||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport);
|
||||
#endif
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
|
||||
int configureMAC();
|
||||
int setDetectorPosition(int pos[]);
|
||||
#endif
|
||||
int* getDetectorPosition();
|
||||
int isConfigurable();
|
||||
|
||||
|
||||
#ifdef EIGERD
|
||||
int setQuad(int value);
|
||||
int getQuad();
|
||||
|
@ -56,7 +56,6 @@ int get_last_client_ip(int);
|
||||
int set_port(int);
|
||||
int update_client(int);
|
||||
int send_update(int);
|
||||
int configure_mac(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int set_all_trimbits(int);
|
||||
@ -108,6 +107,35 @@ int set_interrupt_subframe(int);
|
||||
int get_interrupt_subframe(int);
|
||||
int set_read_n_lines(int);
|
||||
int get_read_n_lines(int);
|
||||
void calculate_and_set_position();
|
||||
int set_detector_position(int);
|
||||
int check_detector_idle();
|
||||
int is_configurable();
|
||||
void configure_mac();
|
||||
int set_source_udp_ip(int);
|
||||
int get_source_udp_ip(int);
|
||||
int set_source_udp_ip2(int);
|
||||
int get_source_udp_ip2(int);
|
||||
int set_dest_udp_ip(int);
|
||||
int get_dest_udp_ip(int);
|
||||
int set_dest_udp_ip2(int);
|
||||
int get_dest_udp_ip2(int);
|
||||
int set_source_udp_mac(int);
|
||||
int get_source_udp_mac(int);
|
||||
int set_source_udp_mac2(int);
|
||||
int get_source_udp_mac2(int);
|
||||
int set_dest_udp_mac(int);
|
||||
int get_dest_udp_mac(int);
|
||||
int set_dest_udp_mac2(int);
|
||||
int get_dest_udp_mac2(int);
|
||||
int set_dest_udp_port(int);
|
||||
int get_dest_udp_port(int);
|
||||
int set_dest_udp_port2(int);
|
||||
int get_dest_udp_port2(int);
|
||||
int set_num_interfaces(int);
|
||||
int get_num_interfaces(int);
|
||||
int set_interface_sel(int);
|
||||
int get_interface_sel(int);
|
||||
int set_parallel_mode(int);
|
||||
int get_parallel_mode(int);
|
||||
int set_overflow_mode(int);
|
||||
|
@ -39,12 +39,17 @@ extern char mess[MAX_STR_LENGTH];
|
||||
// Variables that will be exported
|
||||
int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int configured = FAIL;
|
||||
char configureMessage[MAX_STR_LENGTH]="";
|
||||
int maxydet = -1;
|
||||
int detectorId = -1;
|
||||
|
||||
|
||||
|
||||
// Local variables
|
||||
int (*flist[NUM_DET_FUNCTIONS])(int);
|
||||
#ifdef EIGERD
|
||||
uint32_t dhcpipad = 0;
|
||||
#endif
|
||||
|
||||
|
||||
enum updateRet {NO_UPDATE, UPDATE};
|
||||
|
||||
@ -63,9 +68,6 @@ void init_detector() {
|
||||
if (isControlServer) {
|
||||
basictests();
|
||||
initControlServer();
|
||||
#ifdef EIGERD
|
||||
dhcpipad = getDetectorIP();
|
||||
#endif
|
||||
}
|
||||
else initStopServer();
|
||||
strcpy(mess,"dummy message");
|
||||
@ -199,7 +201,6 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP";
|
||||
case F_SET_PORT: return "F_SET_PORT";
|
||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
@ -250,6 +251,31 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
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 F_SET_POSITION: return "F_SET_POSITION";
|
||||
case F_SET_SOURCE_UDP_MAC: return "F_SET_SOURCE_UDP_MAC";
|
||||
case F_GET_SOURCE_UDP_MAC: return "F_GET_SOURCE_UDP_MAC";
|
||||
case F_SET_SOURCE_UDP_MAC2: return "F_SET_SOURCE_UDP_MAC2";
|
||||
case F_GET_SOURCE_UDP_MAC2: return "F_GET_SOURCE_UDP_MAC2";
|
||||
case F_SET_SOURCE_UDP_IP: return "F_SET_SOURCE_UDP_IP";
|
||||
case F_GET_SOURCE_UDP_IP: return "F_GET_SOURCE_UDP_IP";
|
||||
case F_SET_SOURCE_UDP_IP2: return "F_SET_SOURCE_UDP_IP2";
|
||||
case F_GET_SOURCE_UDP_IP2: return "F_GET_SOURCE_UDP_IP2";
|
||||
case F_SET_DEST_UDP_MAC: return "F_SET_DEST_UDP_MAC";
|
||||
case F_GET_DEST_UDP_MAC: return "F_GET_DEST_UDP_MAC";
|
||||
case F_SET_DEST_UDP_MAC2: return "F_SET_DEST_UDP_MAC2";
|
||||
case F_GET_DEST_UDP_MAC2: return "F_GET_DEST_UDP_MAC2";
|
||||
case F_SET_DEST_UDP_IP: return "F_SET_DEST_UDP_IP";
|
||||
case F_GET_DEST_UDP_IP: return "F_GET_DEST_UDP_IP";
|
||||
case F_SET_DEST_UDP_IP2: return "F_SET_DEST_UDP_IP2";
|
||||
case F_GET_DEST_UDP_IP2: return "F_GET_DEST_UDP_IP2";
|
||||
case F_SET_DEST_UDP_PORT: return "F_SET_DEST_UDP_PORT";
|
||||
case F_GET_DEST_UDP_PORT: return "F_GET_DEST_UDP_PORT";
|
||||
case F_SET_DEST_UDP_PORT2: return "F_SET_DEST_UDP_PORT2";
|
||||
case F_GET_DEST_UDP_PORT2: return "F_GET_DEST_UDP_PORT2";
|
||||
case F_SET_NUM_INTERFACES: return "F_SET_NUM_INTERFACES";
|
||||
case F_GET_NUM_INTERFACES: return "F_GET_NUM_INTERFACES";
|
||||
case F_SET_INTERFACE_SEL: return "F_SET_INTERFACE_SEL";
|
||||
case F_GET_INTERFACE_SEL: return "F_GET_INTERFACE_SEL";
|
||||
case F_SET_PARALLEL_MODE: return "F_SET_PARALLEL_MODE";
|
||||
case F_GET_PARALLEL_MODE: return "F_GET_PARALLEL_MODE";
|
||||
case F_SET_OVERFLOW_MODE: return "F_SET_OVERFLOW_MODE";
|
||||
@ -294,7 +320,6 @@ void function_table() {
|
||||
flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip;
|
||||
flist[F_SET_PORT] = &set_port;
|
||||
flist[F_UPDATE_CLIENT] = &update_client;
|
||||
flist[F_CONFIGURE_MAC] = &configure_mac;
|
||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||
@ -345,6 +370,31 @@ void function_table() {
|
||||
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;
|
||||
flist[F_SET_POSITION] = &set_detector_position;
|
||||
flist[F_SET_SOURCE_UDP_MAC] = &set_source_udp_mac;
|
||||
flist[F_GET_SOURCE_UDP_MAC] = &get_source_udp_mac;
|
||||
flist[F_SET_SOURCE_UDP_MAC2] = &set_source_udp_mac2;
|
||||
flist[F_GET_SOURCE_UDP_MAC2] = &get_source_udp_mac2;
|
||||
flist[F_SET_SOURCE_UDP_IP] = &set_source_udp_ip;
|
||||
flist[F_GET_SOURCE_UDP_IP] = &get_source_udp_ip;
|
||||
flist[F_SET_SOURCE_UDP_IP2] = &set_source_udp_ip2;
|
||||
flist[F_GET_SOURCE_UDP_IP2] = &get_source_udp_ip2;
|
||||
flist[F_SET_DEST_UDP_MAC] = &set_dest_udp_mac;
|
||||
flist[F_GET_DEST_UDP_MAC] = &get_dest_udp_mac;
|
||||
flist[F_SET_DEST_UDP_MAC2] = &set_dest_udp_mac2;
|
||||
flist[F_GET_DEST_UDP_MAC2] = &get_dest_udp_mac2;
|
||||
flist[F_SET_DEST_UDP_IP] = &set_dest_udp_ip;
|
||||
flist[F_GET_DEST_UDP_IP] = &get_dest_udp_ip;
|
||||
flist[F_SET_DEST_UDP_IP2] = &set_dest_udp_ip2;
|
||||
flist[F_GET_DEST_UDP_IP2] = &get_dest_udp_ip2;
|
||||
flist[F_SET_DEST_UDP_PORT] = &set_dest_udp_port;
|
||||
flist[F_GET_DEST_UDP_PORT] = &get_dest_udp_port;
|
||||
flist[F_SET_DEST_UDP_PORT2] = &set_dest_udp_port2;
|
||||
flist[F_GET_DEST_UDP_PORT2] = &get_dest_udp_port2;
|
||||
flist[F_SET_NUM_INTERFACES] = &set_num_interfaces;
|
||||
flist[F_GET_NUM_INTERFACES] = &get_num_interfaces;
|
||||
flist[F_SET_INTERFACE_SEL] = &set_interface_sel;
|
||||
flist[F_GET_INTERFACE_SEL] = &get_interface_sel;
|
||||
flist[F_SET_PARALLEL_MODE] = &set_parallel_mode;
|
||||
flist[F_GET_PARALLEL_MODE] = &get_parallel_mode;
|
||||
flist[F_SET_OVERFLOW_MODE] = &set_overflow_mode;
|
||||
@ -1501,15 +1551,35 @@ int start_acquisition(int file_des) {
|
||||
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Invalid udp source mac address for this detector. Must be same as hardware detector mac address \n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else if (!enableTenGigabitEthernet(-1) && (udpDetails.srcip != getDetectorIP())) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Invalid udp source ip address for this detector. Must be same as hardware detector ip address in 1G readout mode \n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition because %s\n", configureMessage);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret));
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
@ -1589,17 +1659,36 @@ int start_and_read_all(int file_des) {
|
||||
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Invalid udp source mac address for this detector. Must be same as hardware detector mac address \n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else if (!enableTenGigabitEthernet(-1) && (udpDetails.srcip != getDetectorIP())) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Invalid udp source ip address for this detector. Must be same as hardware detector ip address in 1G readout mode \n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition because %s\n", configureMessage);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret));
|
||||
|
||||
}
|
||||
|
||||
// lock or acquisition start error
|
||||
@ -1904,6 +1993,10 @@ int set_roi(int file_des) {
|
||||
sprintf(mess, "Could not set ROI. Invalid xmin or xmax\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
// old firmware requires a redo configure mac
|
||||
else {
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2276,7 +2369,7 @@ int send_update(int file_des) {
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int configure_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -2435,7 +2528,7 @@ int configure_mac(int file_des) {
|
||||
|
||||
// always remember the ip sent from the client (could be for 10g(if not dhcp))
|
||||
if (srcIp != getDetectorIP())
|
||||
dhcpipad = srcIp;
|
||||
custom10gIp = srcIp;
|
||||
|
||||
//only for 1Gbe, change ip to hardware ip
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
@ -2444,7 +2537,7 @@ int configure_mac(int file_des) {
|
||||
}
|
||||
// 10 gbe (use ip given from client)
|
||||
else
|
||||
srcIp = dhcpipad;
|
||||
srcIp = custom10gIp;
|
||||
ret = configureMAC(dstIp, dstMac, srcMac, srcIp, dstPort, dstPort2);
|
||||
#elif JUNGFRAUD
|
||||
ret = configureMAC(numInterfaces, selInterface, dstIp, dstMac, srcMac, srcIp, dstPort, dstIp2, dstMac2, srcMac2, srcIp2, dstPort2);
|
||||
@ -2486,7 +2579,7 @@ int configure_mac(int file_des) {
|
||||
}
|
||||
return Server_SendResult(file_des, OTHER, UPDATE, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
@ -2497,14 +2590,28 @@ int enable_ten_giga(int file_des) {
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Enable/ Disable 10GbE : %d\n", arg));
|
||||
FILE_LOG(logINFOBLUE, ("Setting 10GbE: %d\n", arg));
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// set & get
|
||||
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
||||
retval = enableTenGigabitEthernet(arg);
|
||||
if (arg >= 0 && enableTenGigabitEthernet(-1) != arg) {
|
||||
enableTenGigabitEthernet(arg);
|
||||
uint64_t hardwaremac = getDetectorMAC();
|
||||
if (udpDetails.srcmac != hardwaremac) {
|
||||
FILE_LOG(logINFOBLUE, ("Updating udp source mac\n"));
|
||||
udpDetails.srcmac = hardwaremac;
|
||||
}
|
||||
uint32_t hardwareip = getDetectorIP();
|
||||
if (arg == 0 && udpDetails.srcip != hardwareip) {
|
||||
FILE_LOG(logINFOBLUE, ("Updating udp source ip\n"));
|
||||
udpDetails.srcip = hardwareip;
|
||||
}
|
||||
configure_mac();
|
||||
}
|
||||
retval = enableTenGigabitEthernet(-1);
|
||||
FILE_LOG(logDEBUG1, ("10GbE: %d\n", retval));
|
||||
validate(arg, retval, "enable/disable 10GbE", DEC);
|
||||
}
|
||||
@ -4116,6 +4223,678 @@ int get_read_n_lines(int file_des) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void calculate_and_set_position() {
|
||||
if (maxydet == -1 || detectorId == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set detector position (did not get multi size).\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return;
|
||||
}
|
||||
int maxy = maxydet;
|
||||
#ifdef JUNGFRAUD
|
||||
maxy *= getNumberofUDPInterfaces();
|
||||
#endif
|
||||
int pos[2] = {0, 0};
|
||||
// row
|
||||
pos[0] = (detectorId % maxy);
|
||||
// col for horiz. udp ports
|
||||
pos[1] = (detectorId / maxy);
|
||||
#ifdef EIGERD
|
||||
pos[1] *= 2;
|
||||
#endif
|
||||
FILE_LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1]));
|
||||
if(setDetectorPosition(pos) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set detector position.\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
// to redo the detector mac (depends on positions)
|
||||
else {
|
||||
// create detector mac from x and y
|
||||
if (udpDetails.srcmac == 0) {
|
||||
char dmac[50];
|
||||
memset(dmac, 0, 50);
|
||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0]&0xFF, pos[1]&0xFF);
|
||||
FILE_LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]);
|
||||
udpDetails.srcmac = 0;
|
||||
int i;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
udpDetails.srcmac = (udpDetails.srcmac << 8) + a[i];
|
||||
}
|
||||
}
|
||||
#ifdef JUNGFRAUD
|
||||
if (getNumberofUDPInterfaces() > 1) {
|
||||
if (udpDetails.srcmac2 == 0) {
|
||||
char dmac2[50];
|
||||
memset(dmac2, 0, 50);
|
||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1 )&0xFF, pos[1]&0xFF);
|
||||
FILE_LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]);
|
||||
udpDetails.srcmac2 = 0;
|
||||
int i;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
udpDetails.srcmac2 = (udpDetails.srcmac2 << 8) + a[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
configure_mac();
|
||||
}
|
||||
// no need to do a get (also jungfrau gives bigger set for second)
|
||||
}
|
||||
|
||||
|
||||
int set_detector_position(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int args[2] = { 0, 0};
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1]));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
maxydet = args[0];
|
||||
detectorId = args[1];
|
||||
calculate_and_set_position();
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int check_detector_idle() {
|
||||
enum runStatus status = getRunStatus();
|
||||
if (status != IDLE && status != RUN_FINISHED && status != STOPPED) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Cannot configure mac when detector is not idle. Detector at %s state\n", getRunStateName(status));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int is_configurable() {
|
||||
if (udpDetails.srcip == 0) {
|
||||
strcpy(configureMessage, "udp source ip not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.dstip == 0) {
|
||||
strcpy(configureMessage, "udp destination ip not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.srcmac == 0) {
|
||||
strcpy(configureMessage, "udp source mac not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.dstmac == 0) {
|
||||
strcpy(configureMessage, "udp destination mac not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef JUNGFRAUD
|
||||
if (getNumberofUDPInterfaces() == 2) {
|
||||
if (udpDetails.srcip2 == 0) {
|
||||
strcpy(configureMessage, "udp source ip2 not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.dstip2 == 0) {
|
||||
strcpy(configureMessage, "udp destination ip2 not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.srcmac2 == 0) {
|
||||
strcpy(configureMessage, "udp source mac2 not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
if (udpDetails.dstmac2 == 0) {
|
||||
strcpy(configureMessage, "udp destination mac2 not configured\n");
|
||||
FILE_LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
void configure_mac() {
|
||||
if (is_configurable() == OK) {
|
||||
ret = configureMAC();
|
||||
if (ret != OK) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
if (ret == -1) {
|
||||
sprintf(mess, "Could not allocate RAM\n");
|
||||
} else {
|
||||
sprintf(mess,"Could not configure mac because of incorrect udp 1G destination IP and port\n");
|
||||
}
|
||||
#else
|
||||
sprintf(mess,"Configure Mac failed\n");
|
||||
#endif
|
||||
strcpy(configureMessage, mess);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
FILE_LOG(logINFOGREEN, ("\tConfigure MAC successful\n"));
|
||||
configured = OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
configured = FAIL;
|
||||
FILE_LOG(logWARNING, ("Configure FAIL, not all parameters configured yet\n"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_source_udp_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
arg = __builtin_bswap32(arg);
|
||||
FILE_LOG(logINFO, ("Setting udp source ip: 0x%x\n", arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.srcip != arg) {
|
||||
udpDetails.srcip = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_source_udp_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp source ip\n"));
|
||||
|
||||
// get only
|
||||
retval = udpDetails.srcip;
|
||||
retval = __builtin_bswap32(retval);
|
||||
FILE_LOG(logDEBUG1, ("udp soure ip retval: 0x%x\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_source_udp_ip2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
arg = __builtin_bswap32(arg);
|
||||
FILE_LOG(logINFO, ("Setting udp source ip2: 0x%x\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.srcip2 != arg) {
|
||||
udpDetails.srcip2 = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_source_udp_ip2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp source ip2\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = udpDetails.srcip2;
|
||||
retval = __builtin_bswap32(retval);
|
||||
FILE_LOG(logDEBUG1, ("udp soure ip2 retval: 0x%x\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
int set_dest_udp_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
arg = __builtin_bswap32(arg);
|
||||
FILE_LOG(logINFO, ("Setting udp destination ip: 0x%x\n", arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstip != arg) {
|
||||
udpDetails.dstip = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting destination ip\n"));
|
||||
|
||||
// get only
|
||||
retval = udpDetails.dstip;
|
||||
retval = __builtin_bswap32(retval);
|
||||
FILE_LOG(logDEBUG1, ("udp destination ip retval: 0x%x\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_dest_udp_ip2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
arg = __builtin_bswap32(arg);
|
||||
FILE_LOG(logINFO, ("Setting udp destination ip2: 0x%x\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstip2 != arg) {
|
||||
udpDetails.dstip2 = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_ip2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint32_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp destination ip2\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = udpDetails.dstip2;
|
||||
retval = __builtin_bswap32(retval);
|
||||
FILE_LOG(logDEBUG1, ("udp destination ip2 retval: 0x%x\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_source_udp_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting udp source mac: 0x%lx\n", arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.srcmac != arg) {
|
||||
udpDetails.srcmac = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int get_source_udp_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp source mac\n"));
|
||||
|
||||
// get only
|
||||
retval = udpDetails.srcmac;
|
||||
FILE_LOG(logDEBUG1, ("udp soure mac retval: 0x%lx\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int set_source_udp_mac2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting udp source mac2: 0x%lx\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.srcmac2 != arg) {
|
||||
udpDetails.srcmac2 = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_source_udp_mac2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp source mac2\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = udpDetails.srcmac2;
|
||||
FILE_LOG(logDEBUG1, ("udp soure mac2 retval: 0x%lx\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int set_dest_udp_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting udp destination mac: 0x%lx\n", arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstmac != arg) {
|
||||
udpDetails.dstmac = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp destination mac\n"));
|
||||
|
||||
// get only
|
||||
retval = udpDetails.dstmac;
|
||||
FILE_LOG(logDEBUG1, ("udp destination mac retval: 0x%lx\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_dest_udp_mac2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting udp destination mac2: 0x%lx\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstmac2 != arg) {
|
||||
udpDetails.dstmac2 = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_mac2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting udp destination mac2\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = udpDetails.dstmac2;
|
||||
FILE_LOG(logDEBUG1, ("udp destination mac2 retval: 0x%lx\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_dest_udp_port(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 udp destination port: %u\n", arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstport != arg) {
|
||||
udpDetails.dstport = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_port(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting destination port\n"));
|
||||
|
||||
// get only
|
||||
retval = udpDetails.dstport;
|
||||
FILE_LOG(logDEBUG, ("udp destination port retval: %u\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_dest_udp_port2(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 udp destination port2: %u\n", arg));
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(EIGERD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (udpDetails.dstport2 != arg) {
|
||||
udpDetails.dstport2 = arg;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_port2(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting destination port2\n"));
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(EIGERD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = udpDetails.dstport2;
|
||||
FILE_LOG(logDEBUG1, ("udp destination port2 retval: %u\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int set_num_interfaces(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 number of interfaces: %d\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (getNumberofUDPInterfaces() != arg) {
|
||||
setNumberofUDPInterfaces(arg);
|
||||
calculate_and_set_position(); // aleady configures mac
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int get_num_interfaces(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting number of udp interfaces\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
retval = 1;
|
||||
#else
|
||||
// get only
|
||||
retval = getNumberofUDPInterfaces();
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Number of udp interfaces retval: %u\n", retval));
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int set_interface_sel(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 selected interface: %d\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (check_detector_idle() == OK) {
|
||||
if (getPrimaryInterface() != arg) {
|
||||
selectPrimaryInterface(arg);
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_interface_sel(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1, ("Getting selected interface\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getPrimaryInterface();
|
||||
FILE_LOG(logDEBUG1, ("Selected interface retval: %u\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int set_parallel_mode(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -4323,3 +5102,4 @@ int get_readout_mode(int file_des) {
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "network_utils.h"
|
||||
|
||||
/** Macro to make an integer command.
|
||||
* CMDNAME name of the function that does the command
|
||||
@ -72,6 +73,7 @@
|
||||
return os.str(); \
|
||||
}
|
||||
|
||||
|
||||
namespace sls {
|
||||
|
||||
class CmdProxy {
|
||||
@ -127,7 +129,19 @@ class CmdProxy {
|
||||
{"lock", &CmdProxy::lock},
|
||||
{"rx_readfreq", &CmdProxy::rx_readfreq},
|
||||
{"rx_padding", &CmdProxy::rx_padding},
|
||||
{"rx_framesperfile", &CmdProxy::rx_framesperfile}};
|
||||
{"rx_framesperfile", &CmdProxy::rx_framesperfile},
|
||||
{"detectormac", &CmdProxy::detectormac},
|
||||
{"detectormac2", &CmdProxy::detectormac2},
|
||||
{"rx_udpmac", &CmdProxy::rx_udpmac},
|
||||
{"rx_udpmac2", &CmdProxy::rx_udpmac2},
|
||||
{"detectorip", &CmdProxy::detectorip},
|
||||
{"detectorip2", &CmdProxy::detectorip2},
|
||||
{"rx_udpip", &CmdProxy::rx_udpip},
|
||||
{"rx_udpip2", &CmdProxy::rx_udpip2},
|
||||
{"rx_udpport", &CmdProxy::rx_udpport},
|
||||
{"rx_udpport2", &CmdProxy::rx_udpport2},
|
||||
{"numinterfaces", &CmdProxy::numinterfaces},
|
||||
{"selinterface", &CmdProxy::selinterface}};
|
||||
|
||||
StringMap depreciated_functions{{"r_readfreq", "rx_readfreq"},
|
||||
{"r_padding", "rx_padding"},
|
||||
@ -179,6 +193,7 @@ class CmdProxy {
|
||||
"[0, 1]\n\tgets partial frames padding enable in the "
|
||||
"receiver. 0 does not pad partial frames(fastest), 1 "
|
||||
"(default) pads partial frames");
|
||||
|
||||
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile,
|
||||
std::stoi, "[n_frames]\n\tNumber of frames per file");
|
||||
|
||||
@ -197,6 +212,42 @@ class CmdProxy {
|
||||
|
||||
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, std::stoi,
|
||||
"[0, 1]\n\tFile index");
|
||||
|
||||
INTEGER_COMMAND(detectormac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
||||
"[x:x:x:x:x:x]\n\tMac address of the detector (source) udp interface. ");
|
||||
|
||||
INTEGER_COMMAND(detectormac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
|
||||
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom half of detector (source) udp interface. ");
|
||||
|
||||
INTEGER_COMMAND(rx_udpmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
|
||||
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp interface. Can be unused as rx_hostname/rx_udpip retrieves it.");
|
||||
|
||||
INTEGER_COMMAND(rx_udpmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
|
||||
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) udp interface where the second half of detector data is sent to. Can be unused as rx_hostname/rx_udpip2 retrieves it.")
|
||||
|
||||
INTEGER_COMMAND(detectorip, getSourceUDPIP, setSourceUDPIP, IpAddr,
|
||||
"[x.x.x.x]\n\tIp address of the detector (source) udp interface. Must be same subnet as destination udp ip.");
|
||||
|
||||
INTEGER_COMMAND(detectorip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
|
||||
"[x.x.x.x]\n\t[Jungfrau] Ip address of the bottom half of detector (source) udp interface. Must be same subnet as destination udp ip2.");
|
||||
|
||||
INTEGER_COMMAND(rx_udpip, getDestinationUDPIP, setDestinationUDPIP, IpAddr,
|
||||
"[x.x.x.x]\n\tIp address of the receiver (destination) udp interface.");
|
||||
|
||||
INTEGER_COMMAND(rx_udpip2, getDestinationUDPIP2, setDestinationUDPIP2, IpAddr,
|
||||
"[x.x.x.x]\n\t[Jungfrau] Ip address of the receiver (destination) udp interface where the second half of detector data is sent to.");
|
||||
|
||||
INTEGER_COMMAND(rx_udpport, getDestinationUDPPort, setDestinationUDPPort, std::stoi,
|
||||
"[n]\n\tPort number of the receiver (destination) udp interface.");
|
||||
|
||||
INTEGER_COMMAND(rx_udpport2, getDestinationUDPPort2, setDestinationUDPPort2, std::stoi,
|
||||
"[n]\n\t[Jungfrau] Port number of the receiver (destination) udp interface where the second half of detector data is sent to.\n[Eiger] Port number of the reciever (desintation) udp interface where the right half of the detector data is sent to.");
|
||||
|
||||
INTEGER_COMMAND(numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, std::stoi,
|
||||
"[1, 2]\n\t[Jungfrau] Number of udp interfaces to stream data from detector. Default: 1.");
|
||||
|
||||
INTEGER_COMMAND(selinterface, getSelectedUDPInterface, selectUDPInterface, std::stoi,
|
||||
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. Effective only when number of interfaces is 1. Default: 0 (outer)");
|
||||
|
||||
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, std::stoi,
|
||||
"[0, 1]\n\tEnable or disable parallel mode. [Eiger]");
|
||||
|
@ -263,12 +263,6 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/** Configures the destination for UDP packets in the detector
|
||||
* Needed only if you use a custom receiver (not slsReceiver)
|
||||
* as it is already included in setReceiverHostname.
|
||||
*/
|
||||
void configureMAC(Positions pos = {}); // TODO: find a reasonable name
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
|
||||
|
||||
@ -291,13 +285,13 @@ class Detector {
|
||||
* 10G Eiger and other detectors, the source UDP IP must be in the
|
||||
* same subnet of the destination UDP IP
|
||||
*/
|
||||
void setSourceUDPIP(const std::string &ip, Positions pos = {});
|
||||
void setSourceUDPIP(const IpAddr ip, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
void setSourceUDPIP2(const std::string &ip, Positions pos = {});
|
||||
void setSourceUDPIP2(const IpAddr ip, Positions pos = {});
|
||||
|
||||
Result<MacAddr> getSourceUDPMAC(Positions pos = {}) const;
|
||||
|
||||
@ -306,24 +300,24 @@ class Detector {
|
||||
* Others can be anything (beware of certain bits)
|
||||
*/
|
||||
|
||||
void setSourceUDPMAC(const std::string &mac, Positions pos = {});
|
||||
void setSourceUDPMAC(const MacAddr mac, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
void setSourceUDPMAC2(const std::string &mac, Positions pos = {});
|
||||
void setSourceUDPMAC2(const MacAddr mac, Positions pos = {});
|
||||
|
||||
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
|
||||
|
||||
/** IP of the interface in receiver that the detector sends data to */
|
||||
void setDestinationUDPIP(const std::string &ip, Positions pos = {});
|
||||
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
void setDestinationUDPIP2(const std::string &ip, Positions pos = {});
|
||||
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
|
||||
|
||||
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
|
||||
|
||||
@ -331,13 +325,13 @@ class Detector {
|
||||
* Only needed if you use a custom receiver (not slsReceiver)
|
||||
* Must be followed by configuremac.
|
||||
*/
|
||||
void setDestinationUDPMAC(const std::string &mac, Positions pos = {});
|
||||
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
void setDestinationUDPMAC2(const std::string &mac, Positions pos = {});
|
||||
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
|
||||
|
||||
Result<int> getDestinationUDPPort(Positions pos = {}) const;
|
||||
|
||||
|
@ -582,7 +582,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* Configures in detector the destination for UDP packets
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void configureMAC(int detPos = -1); //
|
||||
//void configureMAC(int detPos = -1); //TODO
|
||||
|
||||
/**
|
||||
* Set starting frame number for the next acquisition
|
||||
@ -840,73 +840,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint32_t clearBit(uint32_t addr, int n, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it
|
||||
* @param detectorMAC detector MAC address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
std::string setDetectorMAC(const std::string &detectorMAC,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
std::string getDetectorMAC(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address (bottom half) and sets
|
||||
* it (Jungfrau only)
|
||||
* @param detectorMAC detector MAC address (bottom half)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector MAC address (bottom half)
|
||||
*/
|
||||
std::string setDetectorMAC2(const std::string &detectorMAC,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address (bottom half) Jungfrau only
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector MAC address (bottom half)
|
||||
*/
|
||||
std::string getDetectorMAC2(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* //TODO: custom ip (eiger 10G and other detectors), use 0.0.0.0 and test
|
||||
* Validates the format of the detector IP address and sets it
|
||||
* @param detectorIP detector IP address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
std::string setDetectorIP(const std::string &detectorIP,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the detector IP address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
std::string getDetectorIP(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address (bottom half) and sets it
|
||||
* (Jungfrau only)
|
||||
* @param detectorIP detector IP address (bottom half)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector IP address (bottom half)
|
||||
*/
|
||||
std::string setDetectorIP2(const std::string &detectorIP,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the detector IP address (bottom half) Jungfrau only
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the detector IP address (bottom half)
|
||||
*/
|
||||
std::string getDetectorIP2(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
* Also updates the receiver with all the shared memory parameters
|
||||
@ -927,108 +860,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
std::string getReceiverHostname(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* TODO: replace this with setEthernetInterface
|
||||
* Validates the format of the receiver UDP IP address and sets it
|
||||
* @param udpip receiver UDP IP address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
std::string setReceiverUDPIP(const std::string &udpip, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
std::string getReceiverUDPIP(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address (bottom half) and
|
||||
* sets it(Jungfrau only)
|
||||
* @param udpip receiver UDP IP address (bottom half)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP IP address (bottom half)
|
||||
*/
|
||||
std::string setReceiverUDPIP2(const std::string &udpip, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address (bottom half) Jungfrau only
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP IP address (bottom half)
|
||||
*/
|
||||
std::string getReceiverUDPIP2(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it
|
||||
* @param udpmac receiver UDP MAC address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
std::string setReceiverUDPMAC(const std::string &udpmac,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
std::string getReceiverUDPMAC(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address (bottom half) and
|
||||
* sets it (Jungfrau only)
|
||||
* @param udpmac receiver UDP MAC address (bottom half)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP MAC address (bottom half)
|
||||
*/
|
||||
std::string setReceiverUDPMAC2(const std::string &udpmac, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address (bottom half) Jungfrau only
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP MAC address (bottom half)
|
||||
*/
|
||||
std::string getReceiverUDPMAC2(int detPos = -1) const;
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port
|
||||
* @param udpport receiver UDP port
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
int setReceiverUDPPort(int udpport, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
int getReceiverUDPPort(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port 2 (Eiger and Jungfrau only)
|
||||
* @param udpport receiver UDP port 2
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP port 2
|
||||
*/
|
||||
int setReceiverUDPPort2(int udpport, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface (Eiger and Jungfrau
|
||||
* only)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
int getReceiverUDPPort2(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Sets the number of UDP interfaces to stream data from detector (Jungfrau
|
||||
* ets the number of UDP interfaces to stream data from detector (Jungfrau
|
||||
* only)
|
||||
* @param n number of interfaces. Options 1 or 2.
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the number of interfaces
|
||||
*/
|
||||
int setNumberofUDPInterfaces(int n, int detPos = -1); //
|
||||
void setNumberofUDPInterfaces(int n, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the number of UDP interfaces to stream data from detector
|
||||
@ -1036,16 +873,15 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the number of interfaces
|
||||
*/
|
||||
int getNumberofUDPInterfaces(int detPos = -1) const; //
|
||||
int getNumberofUDPInterfaces(int detPos = -1) ; //
|
||||
|
||||
/**
|
||||
* Selects the UDP interfaces to stream data from detector. Effective only
|
||||
* when number of interfaces is 1. (Jungfrau only)
|
||||
* @param n selected interface. Options 1 or 2.
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the interface selected
|
||||
*/
|
||||
int selectUDPInterface(int n, int detPos = -1);
|
||||
void selectUDPInterface(int n, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Returns the UDP interfaces to stream data from detector. Effective only
|
||||
@ -1053,7 +889,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the interface selected
|
||||
*/
|
||||
int getSelectedUDPInterface(int detPos = -1) const; //
|
||||
int getSelectedUDPInterface(int detPos = -1) ; //
|
||||
|
||||
/**
|
||||
* (advanced users)
|
||||
|
@ -13,7 +13,7 @@
|
||||
class ServerInterface;
|
||||
|
||||
#define SLS_SHMAPIVERSION 0x190726
|
||||
#define SLS_SHMVERSION 0x190816
|
||||
#define SLS_SHMVERSION 0x190830
|
||||
|
||||
/**
|
||||
* @short structure allocated in shared memory to store detector settings for
|
||||
@ -89,45 +89,6 @@ struct sharedSlsDetector {
|
||||
/** is the TCP port used to communicate between client and the receiver */
|
||||
int rxTCPPort;
|
||||
|
||||
/** is the UDP port used to send data from detector to receiver */
|
||||
int rxUDPPort;
|
||||
|
||||
/** is the port used to communicate between second half module of
|
||||
* Eiger/ Jungfrau detector and the receiver*/
|
||||
int rxUDPPort2;
|
||||
|
||||
/** ip address of the receiver for the detector to send packets to**/
|
||||
sls::IpAddr rxUDPIP;
|
||||
|
||||
/** ip address of the receiver for the 2nd interface of the detector to send
|
||||
* packets to**/
|
||||
sls::IpAddr rxUDPIP2;
|
||||
|
||||
/** mac address of receiver for the detector to send packets to **/
|
||||
sls::MacAddr rxUDPMAC;
|
||||
|
||||
/** mac address of receiver for the 2nd interface of the detector to send
|
||||
* packets to **/
|
||||
sls::MacAddr rxUDPMAC2;
|
||||
|
||||
/** mac address of the detector **/
|
||||
sls::MacAddr detectorMAC;
|
||||
|
||||
/** mac address of the 2nd interface of the detector **/
|
||||
sls::MacAddr detectorMAC2;
|
||||
|
||||
/** ip address of the detector **/
|
||||
sls::IpAddr detectorIP;
|
||||
|
||||
/** ip address of the 2nd interface of the detector **/
|
||||
sls::IpAddr detectorIP2;
|
||||
|
||||
/** number of udp interface */
|
||||
int numUDPInterfaces;
|
||||
|
||||
/** selected udp interface */
|
||||
int selectedUDPInterface;
|
||||
|
||||
/** is set if the receiver hostname given and is connected,
|
||||
* unset if socket connection is not possible */
|
||||
bool useReceiverFlag;
|
||||
@ -719,63 +680,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint32_t clearBit(uint32_t addr, int n);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it \sa
|
||||
* sharedSlsDetector
|
||||
* @param detectorMAC detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
std::string setDetectorMAC(const std::string &detectorMAC);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address\sa sharedSlsDetector
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
sls::MacAddr getDetectorMAC();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address (bottom half) and sets
|
||||
* it (Jungfrau only)
|
||||
* @param detectorMAC detector MAC address (bottom half)
|
||||
* @returns the detector MAC address (bottom half)
|
||||
*/
|
||||
std::string setDetectorMAC2(const std::string &detectorMAC);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address (bottom half) Jungfrau only
|
||||
* @returns the detector MAC address (bottom half)
|
||||
*/
|
||||
sls::MacAddr getDetectorMAC2();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it \sa
|
||||
* sharedSlsDetector
|
||||
* @param detectorIP detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
std::string setDetectorIP(const std::string &detectorIP);
|
||||
|
||||
/**
|
||||
* Returns the detector IP address\sa sharedSlsDetector
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
sls::IpAddr getDetectorIP() const;
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address (bottom half) and sets it
|
||||
* (Jungfrau only)
|
||||
* @param detectorIP detector IP address (bottom half)
|
||||
* @returns the detector IP address (bottom half)
|
||||
*/
|
||||
std::string setDetectorIP2(const std::string &detectorIP);
|
||||
|
||||
/**
|
||||
* Returns the detector IP address (bottom half) Jungfrau only
|
||||
* @returns the detector IP address (bottom half)
|
||||
*/
|
||||
sls::IpAddr getDetectorIP2() const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
* Also updates the receiver with all the shared memory parameters
|
||||
* significant for the receiver Also configures the detector to the receiver
|
||||
@ -791,104 +696,164 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
std::string getReceiverHostname() const;
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address and sets it \sa
|
||||
* sharedSlsDetector
|
||||
* @param udpip receiver UDP IP address
|
||||
* @returns the receiver UDP IP address
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it
|
||||
* @param mac detector MAC address
|
||||
*/
|
||||
std::string setReceiverUDPIP(const std::string &udpip);
|
||||
void setSourceUDPMAC(const sls::MacAddr mac);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||
* Returns the detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
sls::MacAddr getSourceUDPMAC();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address (bottom half) and sets
|
||||
* it (Jungfrau only)
|
||||
* @param mac detector MAC address (bottom half)
|
||||
*/
|
||||
void setSourceUDPMAC2(const sls::MacAddr mac);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address (bottom half) Jungfrau only
|
||||
* @returns the detector MAC address (bottom half)
|
||||
*/
|
||||
sls::MacAddr getSourceUDPMAC2();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it
|
||||
* @param ip detector IP address
|
||||
*/
|
||||
void setSourceUDPIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
sls::IpAddr getSourceUDPIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address (bottom half) and sets it
|
||||
* (Jungfrau only)
|
||||
* @param ip detector IP address (bottom half)
|
||||
*/
|
||||
void setSourceUDPIP2(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the detector IP address (bottom half) Jungfrau only
|
||||
* @returns the detector IP address (bottom half)
|
||||
*/
|
||||
sls::IpAddr getSourceUDPIP2();
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address and sets it
|
||||
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
|
||||
* @param ip receiver UDP IP address
|
||||
*/
|
||||
void setDestinationUDPIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address
|
||||
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
sls::IpAddr getReceiverUDPIP() const;
|
||||
sls::IpAddr getDestinationUDPIP();
|
||||
|
||||
/**
|
||||
* Gets destination udp ip from detector,
|
||||
* if 0, it converts rx_hostname to ip and
|
||||
* updates both detector and receiver
|
||||
*/
|
||||
void updateRxDestinationUDPIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address (bottom half) and
|
||||
* sets it(Jungfrau only)
|
||||
* @param udpip receiver UDP IP address (bottom half)
|
||||
* @returns the receiver UDP IP address (bottom half)
|
||||
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
|
||||
* @param ip receiver UDP IP address (bottom half)
|
||||
*/
|
||||
std::string setReceiverUDPIP2(const std::string &udpip);
|
||||
void setDestinationUDPIP2(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address (bottom half) Jungfrau only
|
||||
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
|
||||
* @returns the receiver UDP IP address (bottom half)
|
||||
*/
|
||||
sls::IpAddr getReceiverUDPIP2() const;
|
||||
sls::IpAddr getDestinationUDPIP2();
|
||||
|
||||
/**
|
||||
* Gets destination udp ip2 from detector,
|
||||
* if 0, it converts rx_hostname to ip and
|
||||
* updates both detector and receiver
|
||||
*/
|
||||
void updateRxDestinationUDPIP2();
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it
|
||||
* @param mac receiver UDP MAC address
|
||||
*/
|
||||
void setDestinationUDPMAC(const sls::MacAddr mac);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it \sa
|
||||
* sharedSlsDetector
|
||||
* @param udpmac receiver UDP MAC address
|
||||
* Returns the receiver UDP MAC address
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
std::string setReceiverUDPMAC(const std::string &udpmac);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
sls::MacAddr getReceiverUDPMAC() const;
|
||||
sls::MacAddr getDestinationUDPMAC();
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address (bottom half) and
|
||||
* sets it (Jungfrau only)
|
||||
* @param udpmac receiver UDP MAC address (bottom half)
|
||||
* @returns the receiver UDP MAC address (bottom half)
|
||||
* @param mac receiver UDP MAC address (bottom half)
|
||||
*/
|
||||
std::string setReceiverUDPMAC2(const std::string &udpmac);
|
||||
void setDestinationUDPMAC2(const sls::MacAddr mac);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address (bottom half) Jungfrau only
|
||||
* @returns the receiver UDP MAC address (bottom half)
|
||||
*/
|
||||
sls::MacAddr getReceiverUDPMAC2() const;
|
||||
sls::MacAddr getDestinationUDPMAC2();
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||
* @param udpport receiver UDP port
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
int setReceiverUDPPort(int udpport);
|
||||
void setDestinationUDPPort(int udpport);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
int getReceiverUDPPort() const;
|
||||
int getDestinationUDPPort();
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port 2\sa sharedSlsDetector (Eiger and Jungfrau
|
||||
* only)
|
||||
* @param udpport receiver UDP port 2
|
||||
* @returns the receiver UDP port 2
|
||||
*/
|
||||
int setReceiverUDPPort2(int udpport);
|
||||
void setDestinationUDPPort2(int udpport);
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||
* (Eiger and Jungfrau only)
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
int getReceiverUDPPort2() const;
|
||||
int getDestinationUDPPort2();
|
||||
|
||||
/**
|
||||
* Sets the number of UDP interfaces to stream data from detector (Jungfrau
|
||||
* only)
|
||||
* @param n number of interfaces. Options 1 or 2.
|
||||
* @returns the number of interfaces
|
||||
* @returns the number of interface
|
||||
*/
|
||||
int setNumberofUDPInterfaces(int n);
|
||||
void setNumberofUDPInterfaces(int n);
|
||||
|
||||
/**
|
||||
* Returns the number of UDP interfaces to stream data from detector
|
||||
* (Jungfrau only)
|
||||
* @returns the number of interfaces
|
||||
*/
|
||||
int getNumberofUDPInterfaces() const;
|
||||
int getNumberofUDPInterfaces();
|
||||
|
||||
/**
|
||||
* Selects the UDP interfaces to stream data from detector. Effective only
|
||||
@ -896,14 +861,14 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
* @param n selected interface. Options 1 or 2.
|
||||
* @returns the interface selected
|
||||
*/
|
||||
int selectUDPInterface(int n);
|
||||
void selectUDPInterface(int n);
|
||||
|
||||
/**
|
||||
* Returns the UDP interfaces to stream data from detector. Effective only
|
||||
* when number of interfaces is 1. (Jungfrau only)
|
||||
* @returns the interface selected
|
||||
*/
|
||||
int getSelectedUDPInterface() const;
|
||||
int getSelectedUDPInterface();
|
||||
|
||||
/**
|
||||
* Sets the client zmq port\sa sharedSlsDetector
|
||||
@ -1727,7 +1692,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
void *retval, size_t retval_size);
|
||||
|
||||
template <typename Arg, typename Ret>
|
||||
void sendToDetector(int fnum, const Arg &args, Ret &retval);
|
||||
void sendToDetector(int fnum, const Arg &args, Ret &retval);
|
||||
template <typename Arg>
|
||||
void sendToDetector(int fnum, const Arg &args, std::nullptr_t);
|
||||
template <typename Ret>
|
||||
|
@ -58,7 +58,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
static std::string helpPort(int action);
|
||||
static std::string helpLastClient(int action);
|
||||
static std::string helpOnline(int action);
|
||||
static std::string helpConfigureMac(int action);
|
||||
static std::string helpDetectorSize(int action);
|
||||
static std::string helpSettings(int action);
|
||||
static std::string helpSN(int action);
|
||||
@ -102,7 +101,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdPort(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdLastClient(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdOnline(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdConfigureMac(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDetectorSize(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||
|
@ -303,10 +303,6 @@ void Detector::sendSoftwareTrigger(Positions pos) {
|
||||
|
||||
// Network Configuration (Detector<->Receiver)
|
||||
|
||||
void Detector::configureMAC(Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::configureMAC, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberofUDPInterfaces, pos);
|
||||
}
|
||||
@ -335,98 +331,98 @@ void Detector::selectUDPInterface(int interface, Positions pos) {
|
||||
}
|
||||
|
||||
Result<IpAddr> Detector::getSourceUDPIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorIP, pos);
|
||||
return pimpl->Parallel(&slsDetector::getSourceUDPIP, pos);
|
||||
}
|
||||
|
||||
void Detector::setSourceUDPIP(const std::string &ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDetectorIP, pos, ip);
|
||||
void Detector::setSourceUDPIP(const IpAddr ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSourceUDPIP, pos, ip);
|
||||
}
|
||||
|
||||
Result<IpAddr> Detector::getSourceUDPIP2(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorIP2, pos);
|
||||
return pimpl->Parallel(&slsDetector::getSourceUDPIP2, pos);
|
||||
}
|
||||
|
||||
void Detector::setSourceUDPIP2(const std::string &ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDetectorIP2, pos, ip);
|
||||
void Detector::setSourceUDPIP2(const IpAddr ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSourceUDPIP2, pos, ip);
|
||||
}
|
||||
|
||||
Result<MacAddr> Detector::getSourceUDPMAC(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorMAC, pos);
|
||||
return pimpl->Parallel(&slsDetector::getSourceUDPMAC, pos);
|
||||
}
|
||||
|
||||
void Detector::setSourceUDPMAC(const std::string &mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDetectorMAC, pos, mac);
|
||||
void Detector::setSourceUDPMAC(const MacAddr mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSourceUDPMAC, pos, mac);
|
||||
}
|
||||
|
||||
Result<MacAddr> Detector::getSourceUDPMAC2(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorMAC2, pos);
|
||||
return pimpl->Parallel(&slsDetector::getSourceUDPMAC2, pos);
|
||||
}
|
||||
|
||||
void Detector::setSourceUDPMAC2(const std::string &mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDetectorMAC2, pos, mac);
|
||||
void Detector::setSourceUDPMAC2(const MacAddr mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSourceUDPMAC2, pos, mac);
|
||||
}
|
||||
|
||||
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPIP, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPIP, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPIP(const std::string &ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPIP, pos, ip);
|
||||
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPIP, pos, ip);
|
||||
}
|
||||
|
||||
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPIP2, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPIP2, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPIP2(const std::string &ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPIP2, pos, ip);
|
||||
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPIP2, pos, ip);
|
||||
}
|
||||
|
||||
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPMAC(const std::string &mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPMAC, pos, mac);
|
||||
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPMAC, pos, mac);
|
||||
}
|
||||
|
||||
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC2, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPMAC2, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPMAC2(const std::string &mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPMAC2, pos, mac);
|
||||
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPMAC2, pos, mac);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDestinationUDPPort(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPPort, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPPort, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPPort(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet},
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port);
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPPort, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
Result<int> Detector::getDestinationUDPPort2(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPPort2, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDestinationUDPPort2, pos);
|
||||
}
|
||||
|
||||
void Detector::setDestinationUDPPort2(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet},
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port);
|
||||
pimpl->Parallel(&slsDetector::setDestinationUDPPort2, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -888,7 +888,7 @@ void multiSlsDetector::readAll(int detPos) {
|
||||
// multi
|
||||
parallelCall(&slsDetector::readAll);
|
||||
}
|
||||
|
||||
/*
|
||||
void multiSlsDetector::configureMAC(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
@ -898,6 +898,7 @@ void multiSlsDetector::configureMAC(int detPos) {
|
||||
// multi
|
||||
parallelCall(&slsDetector::configureMAC);
|
||||
}
|
||||
*/
|
||||
|
||||
void multiSlsDetector::setStartingFrameNumber(const uint64_t value,
|
||||
int detPos) {
|
||||
@ -1275,98 +1276,6 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n, int detPos) {
|
||||
throw RuntimeError(ss.str());
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorMAC(const std::string &detectorMAC,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDetectorMAC(detectorMAC);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setDetectorMAC, detectorMAC);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getDetectorMAC(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getDetectorMAC().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getDetectorMAC);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorMAC2(const std::string &detectorMAC,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDetectorMAC2(detectorMAC);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setDetectorMAC2, detectorMAC);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getDetectorMAC2(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getDetectorMAC2().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getDetectorMAC2);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorIP(const std::string &detectorIP,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDetectorIP(detectorIP);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setDetectorIP, detectorIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getDetectorIP(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getDetectorIP().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getDetectorIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setDetectorIP2(const std::string &detectorIP,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDetectorIP2(detectorIP);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setDetectorIP2, detectorIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getDetectorIP2(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getDetectorIP2().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getDetectorIP2);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverHostname(const std::string &receiver,
|
||||
int detPos) {
|
||||
// single
|
||||
@ -1390,155 +1299,19 @@ std::string multiSlsDetector::getReceiverHostname(int detPos) const {
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverUDPIP(const std::string &udpip,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPIP(udpip);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPIP, udpip);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverUDPIP(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPIP().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverUDPIP2(const std::string &udpip,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPIP2(udpip);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPIP2, udpip);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverUDPIP2(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPIP2().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPIP2);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverUDPMAC(const std::string &udpmac,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPMAC(udpmac);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPMAC, udpmac);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverUDPMAC(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPMAC().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPMAC);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::setReceiverUDPMAC2(const std::string &udpmac,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPMAC2(udpmac);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPMAC2, udpmac);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverUDPMAC2(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPMAC2().str();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPMAC2);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setReceiverUDPPort(int udpport, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPPort(udpport);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPPort, udpport);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getReceiverUDPPort(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPPort();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPPort);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setReceiverUDPPort2(int udpport, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverUDPPort2(udpport);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setReceiverUDPPort2, udpport);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getReceiverUDPPort2(int detPos) const {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverUDPPort2();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverUDPPort2);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
|
||||
void multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
|
||||
|
||||
bool previouslyClientStreaming = enableDataStreamingToClient();
|
||||
int previouslyReceiverStreaming = enableDataStreamingFromReceiver();
|
||||
|
||||
// single
|
||||
int ret = OK;
|
||||
if (detPos >= 0) {
|
||||
ret = detectors[detPos]->setNumberofUDPInterfaces(n);
|
||||
detectors[detPos]->setNumberofUDPInterfaces(n);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
|
||||
parallelCall(&slsDetector::setNumberofUDPInterfaces, n);
|
||||
|
||||
// redo the zmq sockets
|
||||
if (previouslyClientStreaming) {
|
||||
@ -1549,45 +1322,37 @@ int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
|
||||
enableDataStreamingFromReceiver(0);
|
||||
enableDataStreamingFromReceiver(1);
|
||||
}
|
||||
|
||||
// return single
|
||||
if (detPos >= 0)
|
||||
return ret;
|
||||
|
||||
// return multi
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) const {
|
||||
int multiSlsDetector::getNumberofUDPInterfaces(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getNumberofUDPInterfaces();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getNumberofUDPInterfaces);
|
||||
auto r = parallelCall(&slsDetector::getNumberofUDPInterfaces);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::selectUDPInterface(int n, int detPos) {
|
||||
void multiSlsDetector::selectUDPInterface(int n, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->selectUDPInterface(n);
|
||||
detectors[detPos]->selectUDPInterface(n);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::selectUDPInterface, n);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
parallelCall(&slsDetector::selectUDPInterface, n);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getSelectedUDPInterface(int detPos) const {
|
||||
int multiSlsDetector::getSelectedUDPInterface(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getSelectedUDPInterface();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getSelectedUDPInterface);
|
||||
auto r = parallelCall(&slsDetector::getSelectedUDPInterface);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
@ -2410,7 +2175,12 @@ std::string multiSlsDetector::printReceiverConfiguration(int detPos) {
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
// concatenate without '+'
|
||||
std::string ret;
|
||||
for (const auto &s : r)
|
||||
if (!s.empty())
|
||||
ret += s;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool multiSlsDetector::getUseReceiverFlag(int detPos) {
|
||||
|
@ -338,21 +338,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->deadTime = 0;
|
||||
sls::strcpy_safe(shm()->rxHostname, "none");
|
||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||
shm()->rxUDPPort = DEFAULT_UDP_PORTNO;
|
||||
shm()->rxUDPPort2 = DEFAULT_UDP_PORTNO + 1;
|
||||
|
||||
shm()->rxUDPIP = 0u;
|
||||
shm()->rxUDPIP2 = 0u;
|
||||
shm()->rxUDPMAC = 0ul;
|
||||
shm()->rxUDPMAC2 = 0ul;
|
||||
|
||||
shm()->detectorMAC = DEFAULT_DET_MAC;
|
||||
shm()->detectorMAC2 = DEFAULT_DET_MAC2;
|
||||
shm()->detectorIP = DEFAULT_DET_MAC;
|
||||
shm()->detectorIP2 = DEFAULT_DET_MAC2;
|
||||
|
||||
shm()->numUDPInterfaces = 1;
|
||||
shm()->selectedUDPInterface = 0;
|
||||
shm()->useReceiverFlag = false;
|
||||
shm()->tenGigaEnable = 0;
|
||||
shm()->flippedDataX = 0;
|
||||
@ -645,8 +630,11 @@ int slsDetector::getReadNLines() {
|
||||
|
||||
void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
|
||||
shm()->multiSize = det;
|
||||
int args[2] = {shm()->multiSize.y, detId};
|
||||
sendToDetector(F_SET_POSITION, args, nullptr);
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::setControlPort(int port_number) {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Setting control port to " << port_number;
|
||||
@ -1214,6 +1202,7 @@ void slsDetector::readAll() {
|
||||
FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames";
|
||||
}
|
||||
|
||||
/*
|
||||
void slsDetector::configureMAC() {
|
||||
int fnum = F_CONFIGURE_MAC;
|
||||
const size_t array_size = 50;
|
||||
@ -1321,6 +1310,7 @@ void slsDetector::configureMAC() {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void slsDetector::setStartingFrameNumber(uint64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value;
|
||||
@ -1615,75 +1605,6 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string slsDetector::setDetectorMAC(const std::string &detectorMAC) {
|
||||
auto addr = MacAddr(detectorMAC);
|
||||
if (addr == 0) {
|
||||
throw RuntimeError(
|
||||
"server MAC Address should be in xx:xx:xx:xx:xx:xx format");
|
||||
}
|
||||
shm()->detectorMAC = addr;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
|
||||
return getDetectorMAC().str();
|
||||
}
|
||||
|
||||
MacAddr slsDetector::getDetectorMAC() { return shm()->detectorMAC; }
|
||||
|
||||
std::string slsDetector::setDetectorMAC2(const std::string &detectorMAC) {
|
||||
auto addr = MacAddr(detectorMAC);
|
||||
if (addr == 0) {
|
||||
throw RuntimeError(
|
||||
"server MAC Address 2 should be in xx:xx:xx:xx:xx:xx format");
|
||||
}
|
||||
shm()->detectorMAC2 = addr;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return getDetectorMAC2().str();
|
||||
}
|
||||
|
||||
MacAddr slsDetector::getDetectorMAC2() { return shm()->detectorMAC2; }
|
||||
|
||||
std::string slsDetector::setDetectorIP(const std::string &ip) {
|
||||
auto addr = IpAddr(ip);
|
||||
if (addr == 0) {
|
||||
throw RuntimeError("setDetectorIP: IP Address should be VALID and "
|
||||
"in xxx.xxx.xxx.xxx format");
|
||||
}
|
||||
shm()->detectorIP = ip;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return getDetectorIP().str();
|
||||
}
|
||||
|
||||
IpAddr slsDetector::getDetectorIP() const { return shm()->detectorIP; }
|
||||
|
||||
std::string slsDetector::setDetectorIP2(const std::string &ip) {
|
||||
auto addr = IpAddr(ip);
|
||||
if (addr == 0) {
|
||||
throw RuntimeError("setDetectorIP: IP2 Address should be VALID and "
|
||||
"in xxx.xxx.xxx.xxx format");
|
||||
}
|
||||
shm()->detectorIP2 = ip;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return getDetectorIP().str();
|
||||
}
|
||||
|
||||
IpAddr slsDetector::getDetectorIP2() const { return shm()->detectorIP2; }
|
||||
|
||||
std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
|
||||
// recieverIP is none
|
||||
@ -1750,7 +1671,19 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
sendMultiDetectorSize();
|
||||
setDetectorId();
|
||||
setDetectorHostname();
|
||||
setUDPConnection();
|
||||
|
||||
// setup udp
|
||||
updateRxDestinationUDPIP();
|
||||
setDestinationUDPPort(getDestinationUDPPort());
|
||||
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER ) {
|
||||
setDestinationUDPPort2(getDestinationUDPPort2());
|
||||
}
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
updateRxDestinationUDPIP2();
|
||||
setNumberofUDPInterfaces(getNumberofUDPInterfaces());
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
|
||||
|
||||
setReceiverUDPSocketBufferSize(0);
|
||||
setFilePath(shm()->rxFilePath);
|
||||
setFileName(shm()->rxFileName);
|
||||
@ -1825,119 +1758,237 @@ std::string slsDetector::getReceiverHostname() const {
|
||||
return std::string(shm()->rxHostname);
|
||||
}
|
||||
|
||||
std::string slsDetector::setReceiverUDPIP(const std::string &udpip) {
|
||||
auto ip = IpAddr(udpip);
|
||||
if (ip == 0) {
|
||||
throw ReceiverError("setReceiverUDPIP: UDP IP Address should be "
|
||||
"VALID and in xxx.xxx.xxx.xxx format");
|
||||
}
|
||||
shm()->rxUDPIP = ip;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return getReceiverUDPIP().str();
|
||||
}
|
||||
|
||||
sls::IpAddr slsDetector::getReceiverUDPIP() const { return shm()->rxUDPIP; }
|
||||
|
||||
std::string slsDetector::setReceiverUDPIP2(const std::string &udpip) {
|
||||
auto ip = IpAddr(udpip);
|
||||
if (ip == 0) {
|
||||
throw ReceiverError("setReceiverUDPIP: UDP IP Address 2 should be "
|
||||
"VALID and in xxx.xxx.xxx.xxx format");
|
||||
}
|
||||
shm()->rxUDPIP2 = ip;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return getReceiverUDPIP2().str();
|
||||
}
|
||||
|
||||
sls::IpAddr slsDetector::getReceiverUDPIP2() const { return shm()->rxUDPIP2; }
|
||||
|
||||
std::string slsDetector::setReceiverUDPMAC(const std::string &udpmac) {
|
||||
auto mac = MacAddr(udpmac);
|
||||
void slsDetector::setSourceUDPMAC(const sls::MacAddr mac) {
|
||||
FILE_LOG(logDEBUG1) << "Setting source udp mac to " << mac;
|
||||
if (mac == 0) {
|
||||
throw ReceiverError("Could not decode UDPMAC from: " + udpmac);
|
||||
throw RuntimeError("Invalid source udp mac address");
|
||||
}
|
||||
shm()->rxUDPMAC = mac;
|
||||
return getReceiverUDPMAC().str();
|
||||
sendToDetector(F_SET_SOURCE_UDP_MAC, mac, nullptr);
|
||||
}
|
||||
|
||||
MacAddr slsDetector::getReceiverUDPMAC() const { return shm()->rxUDPMAC; }
|
||||
sls::MacAddr slsDetector::getSourceUDPMAC() {
|
||||
sls::MacAddr retval(0lu);
|
||||
FILE_LOG(logDEBUG1) << "Getting source udp mac";
|
||||
sendToDetector(F_GET_SOURCE_UDP_MAC, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Source udp mac: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string slsDetector::setReceiverUDPMAC2(const std::string &udpmac) {
|
||||
auto mac = MacAddr(udpmac);
|
||||
void slsDetector::setSourceUDPMAC2(const sls::MacAddr mac) {
|
||||
FILE_LOG(logDEBUG1) << "Setting source udp mac2 to " << mac;
|
||||
if (mac == 0) {
|
||||
throw ReceiverError("Could not decode UDPMA2C from: " + udpmac);
|
||||
throw RuntimeError("Invalid source udp mac address2");
|
||||
}
|
||||
shm()->rxUDPMAC2 = mac;
|
||||
return getReceiverUDPMAC2().str();
|
||||
sendToDetector(F_SET_SOURCE_UDP_MAC2, mac, nullptr);
|
||||
}
|
||||
|
||||
MacAddr slsDetector::getReceiverUDPMAC2() const { return shm()->rxUDPMAC2; }
|
||||
|
||||
int slsDetector::setReceiverUDPPort(int udpport) {
|
||||
shm()->rxUDPPort = udpport;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return shm()->rxUDPPort;
|
||||
sls::MacAddr slsDetector::getSourceUDPMAC2() {
|
||||
sls::MacAddr retval(0lu);
|
||||
FILE_LOG(logDEBUG1) << "Getting source udp mac2";
|
||||
sendToDetector(F_GET_SOURCE_UDP_MAC2, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Source udp mac2: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::getReceiverUDPPort() const { return shm()->rxUDPPort; }
|
||||
|
||||
int slsDetector::setReceiverUDPPort2(int udpport) {
|
||||
shm()->rxUDPPort2 = udpport;
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
void slsDetector::setSourceUDPIP(const IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting source udp ip to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid source udp ip address");
|
||||
}
|
||||
return shm()->rxUDPPort2;
|
||||
|
||||
sendToDetector(F_SET_SOURCE_UDP_IP, ip, nullptr);
|
||||
}
|
||||
|
||||
int slsDetector::getReceiverUDPPort2() const { return shm()->rxUDPPort2; }
|
||||
|
||||
int slsDetector::setNumberofUDPInterfaces(int n) {
|
||||
if (shm()->myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError(
|
||||
"Cannot choose number of interfaces for this detector");
|
||||
}
|
||||
shm()->numUDPInterfaces = (n > 1 ? 2 : 1);
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return shm()->numUDPInterfaces;
|
||||
sls::IpAddr slsDetector::getSourceUDPIP() {
|
||||
sls::IpAddr retval(0u);
|
||||
FILE_LOG(logDEBUG1) << "Getting source udp ip";
|
||||
sendToDetector(F_GET_SOURCE_UDP_IP, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Source udp ip: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::getNumberofUDPInterfaces() const {
|
||||
return shm()->numUDPInterfaces;
|
||||
void slsDetector::setSourceUDPIP2(const IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting source udp ip2 to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid source udp ip address2");
|
||||
}
|
||||
|
||||
sendToDetector(F_SET_SOURCE_UDP_IP2, ip, nullptr);
|
||||
}
|
||||
|
||||
int slsDetector::selectUDPInterface(int n) {
|
||||
if (shm()->myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError("Cannot select an interface for this detector");
|
||||
}
|
||||
shm()->selectedUDPInterface = (n == 0 ? 0 : 1);
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else {
|
||||
setUDPConnection();
|
||||
}
|
||||
return shm()->selectedUDPInterface;
|
||||
sls::IpAddr slsDetector::getSourceUDPIP2() {
|
||||
sls::IpAddr retval(0u);
|
||||
FILE_LOG(logDEBUG1) << "Getting source udp ip2";
|
||||
sendToDetector(F_GET_SOURCE_UDP_IP2, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Source udp ip2: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::getSelectedUDPInterface() const {
|
||||
return shm()->selectedUDPInterface;
|
||||
void slsDetector::setDestinationUDPIP(const IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp ip to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid destination udp ip address");
|
||||
}
|
||||
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0lu);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||
FILE_LOG(logINFO) << "Setting destination udp mac to " << retval;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
sls::IpAddr slsDetector::getDestinationUDPIP() {
|
||||
sls::IpAddr retval(0u);
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp ip";
|
||||
sendToDetector(F_GET_DEST_UDP_IP, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp ip: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::updateRxDestinationUDPIP() {
|
||||
auto ip = getDestinationUDPIP();
|
||||
if (ip == 0) {
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
ip = shm()->rxHostname;
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Setting destination default udp ip to " << ip;
|
||||
}
|
||||
setDestinationUDPIP(ip);
|
||||
}
|
||||
|
||||
void slsDetector::setDestinationUDPIP2(const IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid destination udp ip address2");
|
||||
}
|
||||
|
||||
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0lu);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||
FILE_LOG(logINFO) << "Setting destination udp mac2 to " << retval;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
sls::IpAddr slsDetector::getDestinationUDPIP2() {
|
||||
sls::IpAddr retval(0u);
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp ip2";
|
||||
sendToDetector(F_GET_DEST_UDP_IP2, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp ip2: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::updateRxDestinationUDPIP2() {
|
||||
auto ip = getDestinationUDPIP2();
|
||||
if (ip == 0) {
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
ip = shm()->rxHostname;
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Setting destination default udp ip2 to " << ip;
|
||||
}
|
||||
setDestinationUDPIP2(ip);
|
||||
}
|
||||
|
||||
void slsDetector::setDestinationUDPMAC(const MacAddr mac) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp mac to " << mac;
|
||||
if (mac == 0) {
|
||||
throw RuntimeError("Invalid destination udp mac address");
|
||||
}
|
||||
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
|
||||
}
|
||||
|
||||
sls::MacAddr slsDetector::getDestinationUDPMAC() {
|
||||
sls::MacAddr retval(0lu);
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp mac";
|
||||
sendToDetector(F_GET_DEST_UDP_MAC, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp mac: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setDestinationUDPMAC2(const MacAddr mac) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac;
|
||||
if (mac == 0) {
|
||||
throw RuntimeError("Invalid desinaion udp mac address2");
|
||||
}
|
||||
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
|
||||
}
|
||||
|
||||
sls::MacAddr slsDetector::getDestinationUDPMAC2() {
|
||||
sls::MacAddr retval(0lu);
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp mac2";
|
||||
sendToDetector(F_GET_DEST_UDP_MAC2, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp mac2: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setDestinationUDPPort(const int port) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp port to " << port;
|
||||
sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::getDestinationUDPPort() {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp port";
|
||||
sendToDetector(F_GET_DEST_UDP_PORT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp port: " << retval;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setDestinationUDPPort2(const int port) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp port2 to " << port;
|
||||
sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_PORT2, port, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::getDestinationUDPPort2() {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting destination udp port2";
|
||||
sendToDetector(F_GET_DEST_UDP_PORT2, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Destination udp port2: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberofUDPInterfaces(int n) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of udp interfaces to " << n;
|
||||
sendToDetector(F_SET_NUM_INTERFACES, n, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::getNumberofUDPInterfaces() {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting number of udp interfaces";
|
||||
sendToDetector(F_GET_NUM_INTERFACES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Number of udp interfaces: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::selectUDPInterface(int n) {
|
||||
FILE_LOG(logDEBUG1) << "Setting selected udp interface to " << n;
|
||||
sendToDetector(F_SET_INTERFACE_SEL, n, nullptr);
|
||||
}
|
||||
|
||||
int slsDetector::getSelectedUDPInterface() {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting selected udp interface";
|
||||
sendToDetector(F_GET_INTERFACE_SEL, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Selected udp interface: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setClientStreamingPort(int port) { shm()->zmqport = port; }
|
||||
@ -2159,62 +2210,6 @@ int64_t slsDetector::getReceiverRealUDPSocketBufferSize() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setUDPConnection() {
|
||||
char args[5][MAX_STR_LENGTH]{};
|
||||
char retvals[2][MAX_STR_LENGTH]{};
|
||||
FILE_LOG(logDEBUG1) << "Setting UDP Connection";
|
||||
|
||||
// called before set up
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
throw RuntimeError(
|
||||
"Cannot set udp connection. Receiver hostname not set yet.");
|
||||
}
|
||||
|
||||
if (shm()->rxUDPIP == 0) {
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
shm()->rxUDPIP = shm()->rxHostname;
|
||||
if (shm()->rxUDPIP == 0) {
|
||||
shm()->rxUDPIP = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
}
|
||||
// jungfrau 2 interfaces, copy udpip if udpip2 empty
|
||||
if (shm()->numUDPInterfaces == 2) {
|
||||
if (shm()->rxUDPIP2 == 0) {
|
||||
shm()->rxUDPIP2 = shm()->rxUDPIP;
|
||||
}
|
||||
}
|
||||
|
||||
// copy arguments to args[][]
|
||||
snprintf(args[0], sizeof(args[0]), "%d", shm()->numUDPInterfaces);
|
||||
sls::strcpy_safe(args[1], getReceiverUDPIP().str());
|
||||
sls::strcpy_safe(args[2], getReceiverUDPIP2().str());
|
||||
snprintf(args[3], sizeof(args[3]), "%d", shm()->rxUDPPort);
|
||||
snprintf(args[4], sizeof(args[4]), "%d", shm()->rxUDPPort2);
|
||||
FILE_LOG(logDEBUG1) << "Receiver Number of UDP Interfaces: "
|
||||
<< shm()->numUDPInterfaces;
|
||||
FILE_LOG(logDEBUG1) << "Receiver udp ip address: " << shm()->rxUDPIP;
|
||||
FILE_LOG(logDEBUG1) << "Receiver udp ip address2: " << shm()->rxUDPIP2;
|
||||
FILE_LOG(logDEBUG1) << "Receiver udp port: " << shm()->rxUDPPort;
|
||||
FILE_LOG(logDEBUG1) << "Receiver udp port2: " << shm()->rxUDPPort2;
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SETUP_RECEIVER_UDP, args, retvals);
|
||||
if (strlen(retvals[0]) != 0u) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver UDP MAC returned : " << retvals[0];
|
||||
shm()->rxUDPMAC = retvals[0];
|
||||
}
|
||||
if (strlen(retvals[1]) != 0u) {
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Receiver UDP MAC2 returned : " << retvals[1];
|
||||
shm()->rxUDPMAC2 = retvals[1];
|
||||
}
|
||||
configureMAC();
|
||||
} else {
|
||||
throw ReceiverError("setUDPConnection: Receiver is OFFLINE");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << printReceiverConfiguration();
|
||||
}
|
||||
|
||||
int slsDetector::digitalTest(digitalTestMode mode, int ival) {
|
||||
int args[]{static_cast<int>(mode), ival};
|
||||
int retval = -1;
|
||||
@ -2268,11 +2263,6 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
|
||||
}
|
||||
}
|
||||
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (shm()->myDetectorType == GOTTHARD) {
|
||||
configureMAC();
|
||||
}
|
||||
|
||||
sendROItoReceiver();
|
||||
}
|
||||
|
||||
@ -2805,17 +2795,30 @@ void slsDetector::updateRateCorrection() {
|
||||
|
||||
std::string slsDetector::printReceiverConfiguration() {
|
||||
std::ostringstream os;
|
||||
os << "#Detector " << detId << ":\n Receiver Hostname:\t"
|
||||
<< getReceiverHostname() << "\nDetector UDP IP (Source):\t\t"
|
||||
<< getDetectorIP() << "\nDetector UDP IP2 (Source):\t\t"
|
||||
<< getDetectorIP2() << "\nDetector UDP MAC:\t\t" << getDetectorMAC()
|
||||
<< "\nDetector UDP MAC2:\t\t" << getDetectorMAC2()
|
||||
<< "\nReceiver UDP IP:\t" << getReceiverUDPIP()
|
||||
<< "\nReceiver UDP IP2:\t" << getReceiverUDPIP2()
|
||||
<< "\nReceiver UDP MAC:\t" << getReceiverUDPMAC()
|
||||
<< "\nReceiver UDP MAC2:\t" << getReceiverUDPMAC2()
|
||||
<< "\nReceiver UDP Port:\t" << getReceiverUDPPort()
|
||||
<< "\nReceiver UDP Port2:\t" << getReceiverUDPPort2();
|
||||
os << "\n\nDetector " << detId << "\nReceiver Hostname:\t"
|
||||
<< getReceiverHostname();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||
}
|
||||
|
||||
os << "\nDetector UDP IP:\t"
|
||||
<< getSourceUDPIP() << "\nDetector UDP MAC:\t"
|
||||
<< getSourceUDPMAC() << "\nReceiver UDP IP:\t"
|
||||
<< getDestinationUDPIP() << "\nReceiver UDP MAC:\t" << getDestinationUDPMAC();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nDetector UDP IP2:\t" << getSourceUDPIP2()
|
||||
<< "\nDetector UDP MAC2:\t" << getSourceUDPMAC2()
|
||||
<< "\nReceiver UDP IP2:\t" << getDestinationUDPIP2()
|
||||
<< "\nReceiver UDP MAC2:\t" << getDestinationUDPMAC2();
|
||||
}
|
||||
os << "\nReceiver UDP Port:\t" << getDestinationUDPPort();
|
||||
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER) {
|
||||
os << "\nReceiver UDP Port2:\t" << getDestinationUDPPort2();
|
||||
}
|
||||
os << "\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -3259,9 +3262,6 @@ int slsDetector::enableTenGigabitEthernet(int value) {
|
||||
sendToDetector(F_ENABLE_TEN_GIGA, value, retval);
|
||||
FILE_LOG(logDEBUG1) << "10Gbe: " << retval;
|
||||
shm()->tenGigaEnable = retval;
|
||||
if (value >= 0) {
|
||||
configureMAC();
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
retval = -1;
|
||||
value = shm()->tenGigaEnable;
|
||||
|
@ -1492,48 +1492,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpip [ip]</b> sets/gets the ip address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpip";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpip2 [ip]</b> sets/gets the ip address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). Used if different from eth0. JUNGFRAU only. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpip2";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpmac [mac]</b> sets/gets the mac address of the receiver UDP interface where the data from the detector will be streamed to. Normally used for single detectors (Can be multi-detector). \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpmac";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpmac2 [mac]</b> sets/gets the mac address of the second receiver UDP interface where the data from the top half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). JUNGFRAU only.\c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpmac2";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpport [port]</b> sets/gets the port of the receiver UDP interface where the data from the detector will be streamed to. Use single-detector command. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpport";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpport2 [port]</b> sets/gets the second port of the receiver UDP interface where the data from the second half of the detector will be streamed to. Use single-detector command. For Eiger, it is the right half and for Jungfrau, it is the top half module. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_udpport2";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpsocksize [size]</b> sets/gets the UDP socket buffer size. Already trying to set by default to 100mb, 2gb for Jungfrau. Does not remember in client shared memory, so must be initialized each time after setting receiver hostname in config file.\c Returns \c (int)
|
||||
*/
|
||||
@ -1548,48 +1506,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>detectormac [mac]</b> sets/gets the mac address of the detector UDP interface from where the detector will stream data. Use single-detector command. Normally unused. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "detectormac";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>detectormac2 [mac]</b> sets/gets the mac address of the second half of the detector UDP interface from where the top half module of the detector will stream data. Use single-detector command. Normally unused. JUNGFRAU only. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "detectormac2";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>detectorip [ip]</b> sets/gets the ip address of the detector UDP interface from where the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip (if rx_udpip specified). \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "detectorip";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>detectorip2 [ip]</b> sets/gets the ip address of the top half of the detector UDP interface from where the top half of the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip2 (if rx_udpip2 specified). JUNGFRAU only. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "detectorip2";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>numinterfaces [n]</b> sets/gets the number of interfaces used to stream out from the detector. Options: 1(default), 2. JUNGFRAU only. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "numinterfaces";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>selinterface [n]</b> sets/gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when \c numinterfaces is 1. JUNGFRAU only. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "selinterface";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>txndelay_left [delay]</b> sets/gets the transmission delay of first packet in an image being streamed out from the detector's left UDP port. Use single-detector command. Used for EIGER only. \c Returns \c (int)
|
||||
*/
|
||||
@ -1653,13 +1569,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
/*! \page network
|
||||
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "configuremac";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdConfigureMac;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_tcpport [port]</b> sets/gets the port of the client-receiver TCP interface. Use single-detector command. Is different for each detector if same \c rx_hostname used. Must be first command to communicate with receiver. \c Returns \c (int)
|
||||
*/
|
||||
@ -2574,88 +2483,12 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, const char * const
|
||||
if (action == HELP_ACTION)
|
||||
return helpNetworkParameter(action);
|
||||
|
||||
if (cmd == "detectormac") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorMAC(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorMAC(detPos);
|
||||
} else if (cmd == "detectormac2") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorMAC2(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorMAC2(detPos);
|
||||
} else if (cmd == "detectorip") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorIP(detPos);
|
||||
} else if (cmd == "detectorip2") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setDetectorIP2(args[1], detPos);
|
||||
}
|
||||
return myDet->getDetectorIP2(detPos);
|
||||
} else if (cmd == "rx_hostname") {
|
||||
if (cmd == "rx_hostname") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverHostname(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverHostname(detPos);
|
||||
} else if (cmd == "rx_udpip") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPIP(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPIP(detPos);
|
||||
} else if (cmd == "rx_udpip2") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPIP2(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPIP2(detPos);
|
||||
} else if (cmd == "rx_udpmac") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPMAC(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPMAC(detPos);
|
||||
} else if (cmd == "rx_udpmac2") {
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->setReceiverUDPMAC2(args[1], detPos);
|
||||
}
|
||||
return myDet->getReceiverUDPMAC2(detPos);
|
||||
} else if (cmd == "rx_udpport") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setReceiverUDPPort(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getReceiverUDPPort(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "rx_udpport2") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setReceiverUDPPort2(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getReceiverUDPPort2(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "numinterfaces") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->setNumberofUDPInterfaces(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getNumberofUDPInterfaces(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "selinterface") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (!(sscanf(args[1], "%d", &i))) {
|
||||
return ("cannot parse argument") + std::string(args[1]);
|
||||
}
|
||||
myDet->selectUDPInterface(i, detPos);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getSelectedUDPInterface(detPos));
|
||||
return ans;
|
||||
} else if (cmd == "rx_udpsocksize") {
|
||||
} else if (cmd == "rx_udpsocksize") {
|
||||
if (action == PUT_ACTION) {
|
||||
int64_t ival = -1;
|
||||
if (!(sscanf(args[1], "%ld", &ival))) {
|
||||
@ -2748,19 +2581,8 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << "detectormac mac \n sets detector mac to mac" << std::endl;
|
||||
os << "detectormac2 mac \n sets detector mac of 2nd udp interface to mac. Jungfrau only" << std::endl;
|
||||
os << "detectorip ip \n sets detector ip to ip" << std::endl;
|
||||
os << "detectorip2 ip \n sets detector ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
|
||||
|
||||
os << "rx_hostname name \n sets receiver ip/hostname to name" << std::endl;
|
||||
os << "rx_udpip ip \n sets receiver udp ip to ip" << std::endl;
|
||||
os << "rx_udpip2 ip \n sets receiver udp ip of 2nd udp interface to ip. Jungfrau only" << std::endl;
|
||||
os << "rx_udpmac mac \n sets receiver udp mac to mac" << std::endl;
|
||||
os << "rx_udpmac2 mac \n sets receiver udp mac of 2nd udp interface to mac. Jungfrau only." << std::endl;
|
||||
os << "rx_udpport port \n sets receiver udp port to port" << std::endl;
|
||||
os << "rx_udpport2 port \n sets receiver udp port to port. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
|
||||
os << "numinterfaces n \n sets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
|
||||
os << "selinterface n \n sets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
|
||||
os << "txndelay_left port \n sets detector transmission delay of the left port" << std::endl;
|
||||
os << "txndelay_right port \n sets detector transmission delay of the right port" << std::endl;
|
||||
os << "txndelay_frame port \n sets detector transmission delay of the entire frame" << std::endl;
|
||||
@ -2788,19 +2610,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
||||
<< std::endl;
|
||||
}
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << "detectormac \n gets detector mac " << std::endl;
|
||||
os << "detectormac2 \n gets detector mac of 2nd udp interface. Jungfrau only" << std::endl;
|
||||
os << "detectorip \n gets detector ip " << std::endl;
|
||||
os << "detectorip2 \n gets detector ip of 2nd udp interface. Jungfrau only" << std::endl;
|
||||
os << "rx_hostname \n gets receiver ip " << std::endl;
|
||||
os << "rx_udpmac \n gets receiver udp mac " << std::endl;
|
||||
os << "rx_udpmac2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
|
||||
os << "rx_udpip \n gets receiver udp mac " << std::endl;
|
||||
os << "rx_udpip2 \n gets receiver udp mac of 2nd udp interface. Jungfrau only" << std::endl;
|
||||
os << "rx_udpport \n gets receiver udp port " << std::endl;
|
||||
os << "rx_udpport2 \n gets receiver udp port of 2nd udp interface. For Eiger, it is the right half and for Jungfrau, it is the top half module and for other detectors, same as rx_udpport" << std::endl;
|
||||
os << "numinterfaces \n gets the number of interfaces to n used to stream out from the detector. Options: 1 (default), 2. JUNGFRAU only. " << std::endl;
|
||||
os << "selinterface \n gets interface to use to stream data out of the detector. Options: 0 (outer, default), 1(inner). Effective only when numinterfaces is 1. JUNGFRAU only. " << std::endl;
|
||||
os << "txndelay_left \n gets detector transmission delay of the left port" << std::endl;
|
||||
os << "txndelay_right \n gets detector transmission delay of the right port" << std::endl;
|
||||
os << "txndelay_frame \n gets detector transmission delay of the entire frame" << std::endl;
|
||||
@ -2937,30 +2747,6 @@ std::string slsDetectorCommand::helpOnline(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdConfigureMac(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
if (action == HELP_ACTION) {
|
||||
return helpConfigureMac(action);
|
||||
}
|
||||
if (action == PUT_ACTION) {
|
||||
myDet->configureMAC(detPos);
|
||||
} else
|
||||
return std::string("Cannot get ") + cmd;
|
||||
|
||||
return std::string("successful");
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpConfigureMac(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||
os << "configuremac i \n configures the MAC of the detector." << std::endl;
|
||||
if (action == GET_ACTION || action == HELP_ACTION)
|
||||
os << "configuremac "
|
||||
<< "Cannot get " << std::endl;
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
@ -4534,8 +4320,7 @@ std::string slsDetectorCommand::cmdConfiguration(int narg, const char * const ar
|
||||
} else if (cmd == "rx_printconfig") {
|
||||
if (action == PUT_ACTION)
|
||||
return std::string("cannot put");
|
||||
FILE_LOG(logINFO) << myDet->printReceiverConfiguration(detPos);
|
||||
return std::string("");
|
||||
return myDet->printReceiverConfiguration(detPos);
|
||||
} else if (cmd == "parameters") {
|
||||
if (action == PUT_ACTION) {
|
||||
sval = std::string(args[1]);
|
||||
|
@ -40,7 +40,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param sm pointer to silent mode
|
||||
*/
|
||||
Listener(int ind, detectorType dtype, Fifo* f, std::atomic<runStatus>* s,
|
||||
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
|
||||
uint32_t* portno, std::string* e, uint64_t* nf, uint32_t* dr,
|
||||
int64_t* us, int64_t* as, uint32_t* fpf,
|
||||
frameDiscardPolicy* fdp, bool* act, bool* depaden, bool* sm);
|
||||
|
||||
@ -222,7 +222,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
uint32_t* udpPortNumber;
|
||||
|
||||
/** ethernet interface */
|
||||
char* eth;
|
||||
std::string* eth;
|
||||
|
||||
/** Number of Images to catch */
|
||||
uint64_t* numImages;
|
||||
|
@ -503,15 +503,15 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
|
||||
/**
|
||||
* Set Ethernet Interface to listen to
|
||||
* @param c ethernet inerface eg. eth0 (max of 1000 characters)
|
||||
* @param c ethernet inerface eg. eth0
|
||||
*/
|
||||
void setEthernetInterface(const char *c);
|
||||
void setEthernetInterface(const std::string &c);
|
||||
|
||||
/**
|
||||
* Set second Ethernet Interface to listen to (jungfrau specific)
|
||||
* @param c second ethernet inerface eg. eth0 (max of 1000 characters)
|
||||
* @param c second ethernet inerface eg. eth0
|
||||
*/
|
||||
void setEthernetInterface2(const char *c);
|
||||
void setEthernetInterface2(const std::string &c);
|
||||
|
||||
/**
|
||||
* Set number of UDP Interfaces (jungfrau specific)
|
||||
@ -933,7 +933,7 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
/** Number of UDP Interfaces */
|
||||
int numUDPInterfaces;
|
||||
/** Ethernet Interface */
|
||||
char eth[MAX_NUMBER_OF_LISTENING_THREADS][MAX_STR_LENGTH];
|
||||
std::vector <std::string> eth;
|
||||
/** Server UDP Port Number*/
|
||||
uint32_t udpPortNum[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||
/** udp socket buffer size */
|
||||
|
@ -159,9 +159,6 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
/** set roi */
|
||||
int set_roi(sls::ServerInterface2 &socket);
|
||||
|
||||
/** Set up UDP Details */
|
||||
int setup_udp(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set acquisition period, frame number etc */
|
||||
int set_timer(sls::ServerInterface2 &socket);
|
||||
|
||||
@ -300,6 +297,22 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
/** read n lines */
|
||||
int set_read_n_lines(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp ip */
|
||||
int set_udp_ip(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp ip2 */
|
||||
int set_udp_ip2(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp port */
|
||||
int set_udp_port(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set udp port2 */
|
||||
int set_udp_port2(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set number of udp interfaces */
|
||||
int set_num_interfaces(sls::ServerInterface2 &socket);
|
||||
|
||||
|
||||
/** detector type */
|
||||
detectorType myDetectorType;
|
||||
|
||||
|
@ -21,7 +21,7 @@ const std::string Listener::TypeName = "Listener";
|
||||
|
||||
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo* f, std::atomic<runStatus>* s,
|
||||
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
|
||||
uint32_t* portno, std::string* e, uint64_t* nf, uint32_t* dr,
|
||||
int64_t* us, int64_t* as, uint32_t* fpf,
|
||||
frameDiscardPolicy* fdp, bool* act, bool* depaden, bool* sm) :
|
||||
ThreadObject(ind),
|
||||
@ -187,10 +187,10 @@ int Listener::CreateUDPSockets() {
|
||||
}
|
||||
|
||||
//if eth is mistaken with ip address
|
||||
if (strchr(eth,'.') != nullptr){
|
||||
memset(eth, 0, MAX_STR_LENGTH);
|
||||
if ((*eth).find('.') != std::string::npos) {
|
||||
(*eth) = "";
|
||||
}
|
||||
if(!strlen(eth)){
|
||||
if (!(*eth).length()) {
|
||||
FILE_LOG(logWARNING) << "eth is empty. Listening to all";
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ int Listener::CreateUDPSockets() {
|
||||
|
||||
try{
|
||||
udpSocket = sls::make_unique<genericSocket>(*udpPortNumber, genericSocket::UDP,
|
||||
generalData->packetSize, (strlen(eth)?eth:nullptr), generalData->headerPacketSize,
|
||||
generalData->packetSize, ((*eth).length() ? (*eth).c_str() : nullptr), generalData->headerPacketSize,
|
||||
*udpSocketBufferSize);
|
||||
FILE_LOG(logINFO) << index << ": UDP port opened at port " << *udpPortNumber;
|
||||
} catch (...) {
|
||||
@ -244,14 +244,14 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) {
|
||||
*udpSocketBufferSize = s;
|
||||
|
||||
//if eth is mistaken with ip address
|
||||
if (strchr(eth,'.') != nullptr){
|
||||
memset(eth, 0, MAX_STR_LENGTH);
|
||||
}
|
||||
if ((*eth).find('.') != std::string::npos) {
|
||||
(*eth) = "";
|
||||
}
|
||||
|
||||
//create dummy socket
|
||||
try {
|
||||
genericSocket g(*udpPortNumber, genericSocket::UDP,
|
||||
generalData->packetSize, (strlen(eth)?eth:nullptr), generalData->headerPacketSize,
|
||||
generalData->packetSize, ((*eth).length() ? (*eth).c_str() : nullptr), generalData->headerPacketSize,
|
||||
*udpSocketBufferSize);
|
||||
|
||||
// doubled due to kernel bookkeeping (could also be less due to permissions)
|
||||
|
@ -86,8 +86,8 @@ void slsReceiverImplementation::InitializeMembers() {
|
||||
|
||||
//***connection parameters***
|
||||
numUDPInterfaces = 1;
|
||||
eth.resize(MAX_NUMBER_OF_LISTENING_THREADS);
|
||||
for (int i = 0; i < MAX_NUMBER_OF_LISTENING_THREADS; i++) {
|
||||
strcpy(eth[i], "");
|
||||
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
||||
}
|
||||
udpSocketBufferSize = 0;
|
||||
@ -285,12 +285,12 @@ uint32_t slsReceiverImplementation::getUDPPortNumber2() const {
|
||||
|
||||
std::string slsReceiverImplementation::getEthernetInterface() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(eth[0]);
|
||||
return eth[0];
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getEthernetInterface2() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(eth[1]);
|
||||
return eth[1];
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::getNumberofUDPInterfaces() const {
|
||||
@ -677,17 +677,17 @@ void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i) {
|
||||
FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setEthernetInterface(const char *c) {
|
||||
void slsReceiverImplementation::setEthernetInterface(const std::string &c) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
strcpy(eth[0], c);
|
||||
eth[0] = c;
|
||||
FILE_LOG(logINFO) << "Ethernet Interface: " << eth[0];
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setEthernetInterface2(const char *c) {
|
||||
void slsReceiverImplementation::setEthernetInterface2(const std::string &c) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
strcpy(eth[1], c);
|
||||
eth[1] = c;
|
||||
FILE_LOG(logINFO) << "Ethernet Interface 2: " << eth[1];
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ int slsReceiverImplementation::setNumberofUDPInterfaces(const int n) {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i],
|
||||
eth[i], &numberOfFrames, &dynamicRange,
|
||||
ð[i], &numberOfFrames, &dynamicRange,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize,
|
||||
&framesPerFile, &frameDiscardMode, &activated,
|
||||
&deactivatedPaddingEnable, &silentMode));
|
||||
@ -1167,7 +1167,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
try {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], eth[i],
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
||||
&numberOfFrames, &dynamicRange, &udpSocketBufferSize,
|
||||
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
||||
&activated, &deactivatedPaddingEnable, &silentMode));
|
||||
|
@ -156,7 +156,6 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_GET_RECEIVER_TYPE] = &slsReceiverTCPIPInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &slsReceiverTCPIPInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SET_ROI] = &slsReceiverTCPIPInterface::set_roi;
|
||||
flist[F_SETUP_RECEIVER_UDP] = &slsReceiverTCPIPInterface::setup_udp;
|
||||
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
||||
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
||||
flist[F_RECEIVER_STREAMING_FREQUENCY] = &slsReceiverTCPIPInterface::set_streaming_frequency;
|
||||
@ -202,6 +201,11 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
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;
|
||||
flist[F_SET_RECEIVER_UDP_IP] = &slsReceiverTCPIPInterface::set_udp_ip;
|
||||
flist[F_SET_RECEIVER_UDP_IP2] = &slsReceiverTCPIPInterface::set_udp_ip2;
|
||||
flist[F_SET_RECEIVER_UDP_PORT] = &slsReceiverTCPIPInterface::set_udp_port;
|
||||
flist[F_SET_RECEIVER_UDP_PORT2] = &slsReceiverTCPIPInterface::set_udp_port2;
|
||||
flist[F_SET_RECEIVER_NUM_INTERFACES] = &slsReceiverTCPIPInterface::set_num_interfaces;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@ -524,102 +528,6 @@ int slsReceiverTCPIPInterface::set_roi(Interface &socket) {
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::setup_udp(Interface &socket) {
|
||||
ret = OK;
|
||||
char args[5][MAX_STR_LENGTH]{};
|
||||
char retvals[2][MAX_STR_LENGTH]{};
|
||||
socket.Receive(args);
|
||||
VerifyIdle(socket);
|
||||
|
||||
// setup interfaces count
|
||||
int numInterfaces = atoi(args[0]) > 1 ? 2 : 1;
|
||||
char *ip1 = args[1];
|
||||
char *ip2 = args[2];
|
||||
uint32_t port1 = atoi(args[3]);
|
||||
uint32_t port2 = atoi(args[4]);
|
||||
|
||||
// 1st interface
|
||||
impl()->setUDPPortNumber(port1);
|
||||
if (myDetectorType == EIGER) {
|
||||
impl()->setUDPPortNumber2(port2);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP: " << ip1;
|
||||
// get eth
|
||||
std::string temp = sls::IpToInterfaceName(ip1);
|
||||
if (temp == "none") {
|
||||
throw RuntimeError("Failed to get ethernet interface or IP");
|
||||
} else {
|
||||
char eth[MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(eth, temp.c_str());
|
||||
// if there is a dot in eth name
|
||||
if (strchr(eth, '.') != nullptr) {
|
||||
sls::strcpy_safe(eth, "");
|
||||
FILE_LOG(logERROR)
|
||||
<< "Failed to get ethernet interface from IP. Got " << temp
|
||||
<< '\n';
|
||||
}
|
||||
impl()->setEthernetInterface(eth);
|
||||
if (myDetectorType == EIGER) {
|
||||
impl()->setEthernetInterface2(eth);
|
||||
}
|
||||
// get mac address
|
||||
if (ret != FAIL) {
|
||||
temp = sls::InterfaceNameToMac(eth).str();
|
||||
if (temp == "00:00:00:00:00:00") {
|
||||
throw RuntimeError("failed to get mac adddress to listen to\n");
|
||||
} else {
|
||||
sls::strcpy_safe(retvals[0], temp.c_str());
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address: " << retvals[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2nd interface
|
||||
if (myDetectorType == JUNGFRAU && numInterfaces == 2) {
|
||||
impl()->setUDPPortNumber2(port2);
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP 2: " << ip2;
|
||||
// get eth
|
||||
temp = sls::IpToInterfaceName(ip2);
|
||||
if (temp == "none") {
|
||||
throw RuntimeError("Failed to get 2nd ethernet interface or IP");
|
||||
} else {
|
||||
char eth[MAX_STR_LENGTH]{};
|
||||
memset(eth, 0, MAX_STR_LENGTH);
|
||||
sls::strcpy_safe(eth, temp.c_str());
|
||||
// if there is a dot in eth name
|
||||
if (strchr(eth, '.') != nullptr) {
|
||||
sls::strcpy_safe(eth, "");
|
||||
FILE_LOG(logERROR)
|
||||
<< "Failed to get 2nd ethernet interface from IP. Got "
|
||||
<< temp << '\n';
|
||||
}
|
||||
impl()->setEthernetInterface2(eth);
|
||||
|
||||
// get mac address
|
||||
if (ret != FAIL) {
|
||||
temp = sls::InterfaceNameToMac(eth).str();
|
||||
if (temp == "00:00:00:00:00:00") {
|
||||
throw RuntimeError(
|
||||
"failed to get 2nd mac adddress to listen to");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else {
|
||||
sls::strcpy_safe(retvals[1], temp.c_str());
|
||||
FILE_LOG(logINFO)
|
||||
<< "Receiver MAC Address 2: " << retvals[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the number of udp interfaces (changes number of threads and many
|
||||
// others)
|
||||
if (myDetectorType == JUNGFRAU &&
|
||||
impl()->setNumberofUDPInterfaces(numInterfaces) == FAIL) {
|
||||
throw RuntimeError("Failed to set number of interfaces");
|
||||
}
|
||||
return socket.sendResult(ret, retvals, sizeof(retvals), mess);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_timer(Interface &socket) {
|
||||
auto index = socket.Receive<int64_t>();
|
||||
auto value = socket.Receive<int64_t>();
|
||||
@ -1324,4 +1232,92 @@ int slsReceiverTCPIPInterface::set_read_n_lines(Interface &socket) {
|
||||
validate(arg, retval, "set read n lines", DEC);
|
||||
FILE_LOG(logDEBUG1) << "read n lines retval:" << retval;
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_udp_ip(Interface &socket) {
|
||||
auto arg = socket.Receive<sls::IpAddr>();
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logINFO) << "Received UDP IP: " << arg;
|
||||
// getting eth
|
||||
std::string eth = sls::IpToInterfaceName(arg.str());
|
||||
if (eth == "none") {
|
||||
throw RuntimeError("Failed to get udp ethernet interface from IP " + arg.str());
|
||||
}
|
||||
if (eth.find('.') != std::string::npos) {
|
||||
eth = "";
|
||||
FILE_LOG(logERROR) << "Failed to get udp ethernet interface from IP " << arg << ". Got " << eth;
|
||||
}
|
||||
impl()->setEthernetInterface(eth);
|
||||
if (myDetectorType == EIGER) {
|
||||
impl()->setEthernetInterface2(eth);
|
||||
}
|
||||
// get mac address
|
||||
auto retval = sls::InterfaceNameToMac(eth);
|
||||
if (retval == 0) {
|
||||
throw RuntimeError("Failed to get udp mac adddress to listen to\n");
|
||||
}
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_udp_ip2(Interface &socket) {
|
||||
auto arg = socket.Receive<sls::IpAddr>();
|
||||
VerifyIdle(socket);
|
||||
if (myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError("UDP Destination IP2 not implemented for this detector");
|
||||
}
|
||||
FILE_LOG(logINFO) << "Received UDP IP2: " << arg;
|
||||
// getting eth
|
||||
std::string eth = sls::IpToInterfaceName(arg.str());
|
||||
if (eth == "none") {
|
||||
throw RuntimeError("Failed to get udp ethernet interface2 from IP " + arg.str());
|
||||
}
|
||||
if (eth.find('.') != std::string::npos) {
|
||||
eth = "";
|
||||
FILE_LOG(logERROR) << "Failed to get udp ethernet interface2 from IP " << arg << ". Got " << eth;
|
||||
}
|
||||
impl()->setEthernetInterface2(eth);
|
||||
|
||||
// get mac address
|
||||
auto retval = sls::InterfaceNameToMac(eth);
|
||||
if (retval == 0) {
|
||||
throw RuntimeError("Failed to get udp mac adddress2 to listen to\n");
|
||||
}
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address2: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_udp_port(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting UDP Port:" << arg;
|
||||
impl()->setUDPPortNumber(arg);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_udp_port2(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
VerifyIdle(socket);
|
||||
if (myDetectorType != JUNGFRAU && myDetectorType != EIGER) {
|
||||
throw RuntimeError("UDP Destination Port2 not implemented for this detector");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "Setting UDP Port:" << arg;
|
||||
impl()->setUDPPortNumber2(arg);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_num_interfaces(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
arg = (arg > 1 ? 2 : 1);
|
||||
VerifyIdle(socket);
|
||||
if (myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError("Number of interfaces not implemented for this detector");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "Setting Number of UDP Interfaces:" << arg;
|
||||
if (impl()->setNumberofUDPInterfaces(arg) == FAIL) {
|
||||
throw RuntimeError("Failed to set number of interfaces");
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
@ -41,7 +41,6 @@ enum detFuncs{
|
||||
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
|
||||
F_SET_PORT, /**< Changes communication port of the server */
|
||||
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
||||
F_CONFIGURE_MAC, /**< Configures MAC */
|
||||
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
|
||||
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
|
||||
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
||||
@ -92,6 +91,31 @@ enum detFuncs{
|
||||
F_GET_INTERRUPT_SUBFRAME,
|
||||
F_SET_READ_N_LINES,
|
||||
F_GET_READ_N_LINES,
|
||||
F_SET_POSITION,
|
||||
F_SET_SOURCE_UDP_MAC,
|
||||
F_GET_SOURCE_UDP_MAC,
|
||||
F_SET_SOURCE_UDP_MAC2,
|
||||
F_GET_SOURCE_UDP_MAC2,
|
||||
F_SET_SOURCE_UDP_IP,
|
||||
F_GET_SOURCE_UDP_IP,
|
||||
F_SET_SOURCE_UDP_IP2,
|
||||
F_GET_SOURCE_UDP_IP2,
|
||||
F_SET_DEST_UDP_MAC,
|
||||
F_GET_DEST_UDP_MAC,
|
||||
F_SET_DEST_UDP_MAC2,
|
||||
F_GET_DEST_UDP_MAC2,
|
||||
F_SET_DEST_UDP_IP,
|
||||
F_GET_DEST_UDP_IP,
|
||||
F_SET_DEST_UDP_IP2,
|
||||
F_GET_DEST_UDP_IP2,
|
||||
F_SET_DEST_UDP_PORT,
|
||||
F_GET_DEST_UDP_PORT,
|
||||
F_SET_DEST_UDP_PORT2,
|
||||
F_GET_DEST_UDP_PORT2,
|
||||
F_SET_NUM_INTERFACES,
|
||||
F_GET_NUM_INTERFACES,
|
||||
F_SET_INTERFACE_SEL,
|
||||
F_GET_INTERFACE_SEL,
|
||||
F_SET_PARALLEL_MODE,
|
||||
F_GET_PARALLEL_MODE,
|
||||
F_SET_OVERFLOW_MODE,
|
||||
@ -113,7 +137,6 @@ enum detFuncs{
|
||||
F_GET_RECEIVER_TYPE, /**< return receiver type */
|
||||
F_SEND_RECEIVER_DETHOSTNAME, /**< set detector hostname to receiver */
|
||||
F_RECEIVER_SET_ROI, /**< Sets receiver ROI */
|
||||
F_SETUP_RECEIVER_UDP, /**< sets the receiver udp connection and returns receiver mac address */
|
||||
F_SET_RECEIVER_TIMER, /**< set/get timer value */
|
||||
F_SET_RECEIVER_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
||||
F_RECEIVER_STREAMING_FREQUENCY, /**< sets the frequency of receiver sending frames to gui */
|
||||
@ -159,6 +182,11 @@ enum detFuncs{
|
||||
F_RECEIVER_DBIT_OFFSET, /** < set/get reciever digital bit offset */
|
||||
F_SET_RECEIVER_QUAD,
|
||||
F_SET_RECEIVER_READ_N_LINES,
|
||||
F_SET_RECEIVER_UDP_IP,
|
||||
F_SET_RECEIVER_UDP_IP2,
|
||||
F_SET_RECEIVER_UDP_PORT,
|
||||
F_SET_RECEIVER_UDP_PORT2,
|
||||
F_SET_RECEIVER_NUM_INTERFACES,
|
||||
NUM_REC_FUNCTIONS
|
||||
};
|
||||
|
||||
@ -196,7 +224,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP";
|
||||
case F_SET_PORT: return "F_SET_PORT";
|
||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
@ -247,6 +274,31 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
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 F_SET_POSITION: return "F_SET_POSITION";
|
||||
case F_SET_SOURCE_UDP_MAC: return "F_SET_SOURCE_UDP_MAC";
|
||||
case F_GET_SOURCE_UDP_MAC: return "F_GET_SOURCE_UDP_MAC";
|
||||
case F_SET_SOURCE_UDP_MAC2: return "F_SET_SOURCE_UDP_MAC2";
|
||||
case F_GET_SOURCE_UDP_MAC2: return "F_GET_SOURCE_UDP_MAC2";
|
||||
case F_SET_SOURCE_UDP_IP: return "F_SET_SOURCE_UDP_IP";
|
||||
case F_GET_SOURCE_UDP_IP: return "F_GET_SOURCE_UDP_IP";
|
||||
case F_SET_SOURCE_UDP_IP2: return "F_SET_SOURCE_UDP_IP2";
|
||||
case F_GET_SOURCE_UDP_IP2: return "F_GET_SOURCE_UDP_IP2";
|
||||
case F_SET_DEST_UDP_MAC: return "F_SET_DEST_UDP_MAC";
|
||||
case F_GET_DEST_UDP_MAC: return "F_GET_DEST_UDP_MAC";
|
||||
case F_SET_DEST_UDP_MAC2: return "F_SET_DEST_UDP_MAC2";
|
||||
case F_GET_DEST_UDP_MAC2: return "F_GET_DEST_UDP_MAC2";
|
||||
case F_SET_DEST_UDP_IP: return "F_SET_DEST_UDP_IP";
|
||||
case F_GET_DEST_UDP_IP: return "F_GET_DEST_UDP_IP";
|
||||
case F_SET_DEST_UDP_IP2: return "F_SET_DEST_UDP_IP2";
|
||||
case F_GET_DEST_UDP_IP2: return "F_GET_DEST_UDP_IP2";
|
||||
case F_SET_DEST_UDP_PORT: return "F_SET_DEST_UDP_PORT";
|
||||
case F_GET_DEST_UDP_PORT: return "F_GET_DEST_UDP_PORT";
|
||||
case F_SET_DEST_UDP_PORT2: return "F_SET_DEST_UDP_PORT2";
|
||||
case F_GET_DEST_UDP_PORT2: return "F_GET_DEST_UDP_PORT2";
|
||||
case F_SET_NUM_INTERFACES: return "F_SET_NUM_INTERFACES";
|
||||
case F_GET_NUM_INTERFACES: return "F_GET_NUM_INTERFACES";
|
||||
case F_SET_INTERFACE_SEL: return "F_SET_INTERFACE_SEL";
|
||||
case F_GET_INTERFACE_SEL: return "F_GET_INTERFACE_SEL";
|
||||
case F_SET_PARALLEL_MODE: return "F_SET_PARALLEL_MODE";
|
||||
case F_GET_PARALLEL_MODE: return "F_GET_PARALLEL_MODE";
|
||||
case F_SET_OVERFLOW_MODE: return "F_SET_OVERFLOW_MODE";
|
||||
@ -268,7 +320,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_SETUP_RECEIVER_UDP: return "F_SETUP_RECEIVER_UDP";
|
||||
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
||||
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
||||
case F_RECEIVER_STREAMING_FREQUENCY: return "F_RECEIVER_STREAMING_FREQUENCY";
|
||||
@ -314,6 +365,11 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_RECEIVER_DBIT_OFFSET: return "F_RECEIVER_DBIT_OFFSET";
|
||||
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 F_SET_RECEIVER_UDP_IP: return "F_SET_RECEIVER_UDP_IP";
|
||||
case F_SET_RECEIVER_UDP_IP2: return "F_SET_RECEIVER_UDP_IP2";
|
||||
case F_SET_RECEIVER_UDP_PORT: return "F_SET_RECEIVER_UDP_PORT";
|
||||
case F_SET_RECEIVER_UDP_PORT2: return "F_SET_RECEIVER_UDP_PORT2";
|
||||
case F_SET_RECEIVER_NUM_INTERFACES: return "F_SET_RECEIVER_NUM_INTERFACES";
|
||||
|
||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
|
@ -4,9 +4,9 @@
|
||||
#define APIRECEIVER 0x190722
|
||||
#define APIGUI 0x190723
|
||||
#define APIMOENCH 0x190820
|
||||
#define APICTB 0x190902
|
||||
#define APIGOTTHARD 0x190902
|
||||
#define APIJUNGFRAU 0x190902
|
||||
#define APIEIGER 0x190902
|
||||
#define APIGOTTHARD2 0x190927
|
||||
#define APIJUNGFRAU 0x190927
|
||||
#define APIGOTTHARD 0x190927
|
||||
#define APIMYTHEN3 0x190930
|
||||
#define APIEIGER 0x190926
|
||||
#define APIGOTTHARD2 0x190927
|
||||
#define APICTB 0x190927
|
||||
|
Loading…
x
Reference in New Issue
Block a user