mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
jungfrau feature change: outer is default and connects to bottom, inner is secondary but connects to top
This commit is contained in:
parent
7e43472b7b
commit
a0f697ce71
Binary file not shown.
@ -1005,16 +1005,16 @@ int getNumberofUDPInterfaces() {
|
||||
void selectPrimaryInterface(int val) {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
// inner (user input: 1)
|
||||
if (val == 1) {
|
||||
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 1 (Inner)\n"));
|
||||
bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK);
|
||||
}
|
||||
// outer (user input: 2)
|
||||
else {
|
||||
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 2 (Outer)\n"));
|
||||
// inner (user input: 0)
|
||||
if (val == 0) {
|
||||
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 0 (Outer)\n"));
|
||||
bus_w(addr, bus_r(addr) &~ CONFIG_INNR_PRIMRY_INTRFCE_MSK);
|
||||
}
|
||||
// outer (user input: 1)
|
||||
else {
|
||||
FILE_LOG(logINFOBLUE, ("Setting Secondary Interface: 1 (Inner)\n"));
|
||||
bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK);
|
||||
}
|
||||
}
|
||||
|
||||
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport) {
|
||||
@ -1104,7 +1104,7 @@ int configureMAC(int numInterfaces, int selInterface,
|
||||
FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
|
||||
FILE_LOG(logINFO, ("\tInterface : %d\n\n", selInterface));
|
||||
|
||||
FILE_LOG(logINFO, ("\tInner\n"));
|
||||
FILE_LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": ""));
|
||||
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));
|
||||
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
@ -1130,7 +1130,7 @@ int configureMAC(int numInterfaces, int selInterface,
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
|
||||
|
||||
uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1;
|
||||
FILE_LOG(logINFO, ("\tOuter\n"));
|
||||
FILE_LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": "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));
|
||||
FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||
@ -1157,10 +1157,22 @@ int configureMAC(int numInterfaces, int selInterface,
|
||||
|
||||
// default one rxr entry (others not yet implemented in client yet)
|
||||
int iRxEntry = 0;
|
||||
// top
|
||||
setupHeader(iRxEntry, INNER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
// bottom
|
||||
setupHeader(iRxEntry, OUTER, destip2, destmac2, udpport2, sourcemac2, sourceip2, sourceport2);
|
||||
|
||||
if (numInterfaces == 2) {
|
||||
// bottom
|
||||
setupHeader(iRxEntry, OUTER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
// top
|
||||
setupHeader(iRxEntry, INNER, destip2, destmac2, udpport2, sourcemac2, sourceip2, sourceport2);
|
||||
}
|
||||
// single interface
|
||||
else {
|
||||
// default
|
||||
if (selInterface == 0) {
|
||||
setupHeader(iRxEntry, OUTER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
} else {
|
||||
setupHeader(iRxEntry, INNER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||
}
|
||||
}
|
||||
|
||||
setNumberofUDPInterfaces(numInterfaces);
|
||||
selectPrimaryInterface(selInterface);
|
||||
|
@ -338,7 +338,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->detectorIP2 = DEFAULT_DET_MAC2;
|
||||
|
||||
shm()->numUDPInterfaces = 1;
|
||||
shm()->selectedUDPInterface = 1;
|
||||
shm()->selectedUDPInterface = 0;
|
||||
shm()->rxOnlineFlag = OFFLINE_FLAG;
|
||||
shm()->tenGigaEnable = 0;
|
||||
shm()->flippedData[X] = 0;
|
||||
@ -2092,7 +2092,7 @@ int slsDetector::selectUDPInterface(int n) {
|
||||
if (shm()->myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError("Cannot select an interface for this detector");
|
||||
}
|
||||
shm()->selectedUDPInterface = (n > 1 ? 2 : 1);
|
||||
shm()->selectedUDPInterface = (n == 0 ? 0 : 1);
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
FILE_LOG(logDEBUG1) << "Receiver hostname not set yet";
|
||||
} else if (setUDPConnection() == FAIL) {
|
||||
@ -2349,7 +2349,7 @@ int64_t slsDetector::getReceiverRealUDPSocketBufferSize() {
|
||||
|
||||
int slsDetector::setUDPConnection() {
|
||||
int ret = FAIL;
|
||||
char args[6][MAX_STR_LENGTH]{};
|
||||
char args[5][MAX_STR_LENGTH]{};
|
||||
char retvals[2][MAX_STR_LENGTH]{};
|
||||
FILE_LOG(logDEBUG1) << "Setting UDP Connection";
|
||||
|
||||
@ -2366,9 +2366,8 @@ int slsDetector::setUDPConnection() {
|
||||
shm()->rxUDPIP = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
}
|
||||
// jungfrau 2 interfaces or (1 interface and 2nd interface), copy udpip if
|
||||
// udpip2 empty
|
||||
if (shm()->numUDPInterfaces == 2 || shm()->selectedUDPInterface == 2) {
|
||||
// jungfrau 2 interfaces, copy udpip if udpip2 empty
|
||||
if (shm()->numUDPInterfaces == 2) {
|
||||
if (shm()->rxUDPIP2 == 0) {
|
||||
shm()->rxUDPIP2 = shm()->rxUDPIP;
|
||||
}
|
||||
@ -2376,15 +2375,12 @@ int slsDetector::setUDPConnection() {
|
||||
|
||||
// copy arguments to args[][]
|
||||
snprintf(args[0], sizeof(args[0]), "%d", shm()->numUDPInterfaces);
|
||||
snprintf(args[1], sizeof(args[1]), "%d", shm()->selectedUDPInterface);
|
||||
sls::strcpy_safe(args[2], getReceiverUDPIP().str());
|
||||
sls::strcpy_safe(args[3], getReceiverUDPIP2().str());
|
||||
snprintf(args[4], sizeof(args[4]), "%d", shm()->rxUDPPort);
|
||||
snprintf(args[5], sizeof(args[5]), "%d", shm()->rxUDPPort2);
|
||||
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 Selected Interface: "
|
||||
<< shm()->selectedUDPInterface;
|
||||
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;
|
||||
|
@ -1581,7 +1581,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpip2 [ip]</b> sets/gets the ip address of the second receiver UDP interface where the data from the bottom 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)
|
||||
- <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;
|
||||
@ -1595,7 +1595,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_udpmac2 [mac]</b> sets/gets the mac address of the second receiver UDP interface where the data from the bottom half module of the detector will be streamed to. Normally used for single detectors (Can be multi-detector). JUNGFRAU only.\c Returns \c (string)
|
||||
- <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;
|
||||
@ -1609,7 +1609,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++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. Used for EIGERand JUNGFRAU only. \c Returns \c (int)
|
||||
- <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;
|
||||
@ -1637,35 +1637,35 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>detectormac2 [mac]</b> sets/gets the mac address of the second half of the detector UDP interface from where the bottom half module of the detector will stream data. Use single-detector command. Normally unused. JUNGFRAU only. \c Returns \c (string)
|
||||
- <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 bottom half of the detector will stream data. Use single-detector command. Keep in same subnet as rx_udpip (if rx_udpip specified). \c Returns \c (string)
|
||||
- <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 second half of the detector UDP interface from where the bottom 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)
|
||||
- <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, 2. JUNGFRAU only. \c Returns \c (int)
|
||||
- <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 the 1st (inner) or the 2nd (outer) interface to use to stream data out of the detector. Options: 1, 2. Effective only when \c numinterfaces is 1. JUNGFRAU only. \c Returns \c (int)
|
||||
- <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;
|
||||
@ -3063,9 +3063,9 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
||||
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 and Jungfrau, it is the second 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, 2. JUNGFRAU only. " << std::endl;
|
||||
os << "selinterface n \n sets the 1st (inner) or the 2nd (outer) interface to use to stream data out of the detector. Options: 1, 2. Effective only when numinterfaces is 1. JUNGFRAU only. " << 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;
|
||||
@ -3103,9 +3103,9 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
||||
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 and Jungfrau, it is the second 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, 2. JUNGFRAU only. " << std::endl;
|
||||
os << "selinterface \n gets the interface selected to use to stream data out of the detector. Options: 1, 2. Effective only when numinterfaces is 1. JUNGFRAU only. " << 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;
|
||||
|
@ -731,7 +731,7 @@ int slsReceiverTCPIPInterface::set_roi() {
|
||||
int slsReceiverTCPIPInterface::setup_udp(){
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
char args[6][MAX_STR_LENGTH] = {{""}, {""}, {""}, {""}, {""}, {""}};
|
||||
char args[][MAX_STR_LENGTH] = {{""}, {""}, {""}, {""}, {""}};
|
||||
char retvals[2][MAX_STR_LENGTH] = {{""}, {""}};
|
||||
|
||||
// get args, return if socket crashed, ret is fail if receiver is not null
|
||||
@ -746,18 +746,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
|
||||
//setup interfaces count
|
||||
int numInterfaces = atoi(args[0]) > 1 ? 2 : 1;
|
||||
int selInterface = atoi(args[1]) > 1 ? 2 : 1;
|
||||
|
||||
char* ip1 = args[2];
|
||||
char* ip2 = args[3];
|
||||
uint32_t port1 = atoi(args[4]);
|
||||
uint32_t port2 = atoi(args[5]);
|
||||
|
||||
// using the 2nd interface only
|
||||
if (myDetectorType == JUNGFRAU && numInterfaces == 1 && selInterface == 2) {
|
||||
ip1 = ip2;
|
||||
port1 = port2;
|
||||
}
|
||||
char* ip1 = args[1];
|
||||
char* ip2 = args[2];
|
||||
uint32_t port1 = atoi(args[3]);
|
||||
uint32_t port2 = atoi(args[4]);
|
||||
|
||||
// 1st interface
|
||||
receiver->setUDPPortNumber(port1);
|
||||
@ -794,15 +786,8 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
strcpy(mess,"failed to get mac adddress to listen to\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else {
|
||||
// using the 2nd interface only
|
||||
if (myDetectorType == JUNGFRAU && numInterfaces == 1 && selInterface == 2) {
|
||||
strcpy(retvals[1],temp.c_str());
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address: " << retvals[1];
|
||||
}
|
||||
else {
|
||||
strcpy(retvals[0],temp.c_str());
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address: " << retvals[0];
|
||||
}
|
||||
strcpy(retvals[0],temp.c_str());
|
||||
FILE_LOG(logINFO) << "Receiver MAC Address: " << retvals[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,5 +7,5 @@
|
||||
#define APIGUI 0x190405
|
||||
#define APIEIGER 0x190516
|
||||
#define APICTB 0x190514
|
||||
#define APIJUNGFRAU 0x190527
|
||||
|
||||
#define APIJUNGFRAU 0x190528
|
||||
|
Loading…
x
Reference in New Issue
Block a user