mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
parent
46bb9bc2d7
commit
e7879ee365
@ -100,6 +100,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- jungfrau reset core and usleep removed (fix for 6.1.1 is now fixed in firmware)
|
- jungfrau reset core and usleep removed (fix for 6.1.1 is now fixed in firmware)
|
||||||
- g2 change clkdivs 2 3 4 to defaults for burst and cw mode.
|
- g2 change clkdivs 2 3 4 to defaults for burst and cw mode.
|
||||||
- ctb and moench: allowing 1g non blocking acquire to send data
|
- ctb and moench: allowing 1g non blocking acquire to send data
|
||||||
|
- m3 and g2 rr
|
||||||
- m3 and g2 temp
|
- m3 and g2 temp
|
||||||
- gain plot zooming fixed (disabled, acc. to main plot)
|
- gain plot zooming fixed (disabled, acc. to main plot)
|
||||||
- ctb, moench, jungfrau (pll reset at start fixed, before no defines)
|
- ctb, moench, jungfrau (pll reset at start fixed, before no defines)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -204,9 +204,9 @@
|
|||||||
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||||
|
|
||||||
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||||
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000001F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||||
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||||
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000001F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||||
|
|
||||||
/* Module Coordinates Register */
|
/* Module Coordinates Register */
|
||||||
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||||
|
Binary file not shown.
@ -27,6 +27,7 @@ extern int debugflag;
|
|||||||
extern int updateFlag;
|
extern int updateFlag;
|
||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
|
extern int numUdpDestinations;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
extern int ignoreConfigFileFlag;
|
extern int ignoreConfigFileFlag;
|
||||||
|
|
||||||
@ -1851,6 +1852,36 @@ int getNumberofUDPInterfaces() {
|
|||||||
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GBE_ENBL_MSK) ? 2 : 1);
|
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GBE_ENBL_MSK) ? 2 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getNumberofDestinations(int *retval) {
|
||||||
|
*retval = (((bus_r(PKT_CONFIG_REG) & PKT_CONFIG_NRXR_MAX_MSK) >>
|
||||||
|
PKT_CONFIG_NRXR_MAX_OFST) +
|
||||||
|
1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setNumberofDestinations(int value) {
|
||||||
|
LOG(logINFO, ("Setting number of entries to %d\n", value));
|
||||||
|
--value;
|
||||||
|
bus_w(PKT_CONFIG_REG, bus_r(PKT_CONFIG_REG) & ~PKT_CONFIG_NRXR_MAX_MSK);
|
||||||
|
bus_w(PKT_CONFIG_REG,
|
||||||
|
bus_r(PKT_CONFIG_REG) |
|
||||||
|
((value << PKT_CONFIG_NRXR_MAX_OFST) & PKT_CONFIG_NRXR_MAX_MSK));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFirstUDPDestination() {
|
||||||
|
return ((bus_r(PKT_CONFIG_REG) & PKT_CONFIG_RXR_START_ID_MSK) >>
|
||||||
|
PKT_CONFIG_RXR_START_ID_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFirstUDPDestination(int value) {
|
||||||
|
LOG(logINFO, ("Setting first entry to %d\n", value));
|
||||||
|
bus_w(PKT_CONFIG_REG, bus_r(PKT_CONFIG_REG) & ~PKT_CONFIG_RXR_START_ID_MSK);
|
||||||
|
bus_w(PKT_CONFIG_REG,
|
||||||
|
bus_r(PKT_CONFIG_REG) | ((value << PKT_CONFIG_RXR_START_ID_OFST) &
|
||||||
|
PKT_CONFIG_RXR_START_ID_MSK));
|
||||||
|
}
|
||||||
|
|
||||||
void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
||||||
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
|
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
|
||||||
uint32_t sourceip, uint32_t sourceport) {
|
uint32_t sourceip, uint32_t sourceport) {
|
||||||
@ -1895,6 +1926,9 @@ void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
|||||||
// total length is redefined in firmware
|
// total length is redefined in firmware
|
||||||
|
|
||||||
calcChecksum(udp);
|
calcChecksum(udp);
|
||||||
|
if (iRxEntry < numUdpDestinations) {
|
||||||
|
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcChecksum(udp_header *udp) {
|
void calcChecksum(udp_header *udp) {
|
||||||
@ -1925,26 +1959,28 @@ void calcChecksum(udp_header *udp) {
|
|||||||
sum = (sum & 0xffff) + (sum >> 16); // Fold 32-bit sum to 16 bits
|
sum = (sum & 0xffff) + (sum >> 16); // Fold 32-bit sum to 16 bits
|
||||||
long int checksum = sum & 0xffff;
|
long int checksum = sum & 0xffff;
|
||||||
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
||||||
LOG(logINFO, ("\tIP checksum is 0x%lx\n", checksum));
|
|
||||||
udp->ip_checksum = checksum;
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int configureMAC() {
|
int configureMAC() {
|
||||||
|
|
||||||
uint32_t srcip = udpDetails[0].srcip;
|
|
||||||
uint32_t srcip2 = udpDetails[0].srcip2;
|
|
||||||
uint32_t dstip = udpDetails[0].dstip;
|
|
||||||
uint32_t dstip2 = udpDetails[0].dstip2;
|
|
||||||
uint64_t srcmac = udpDetails[0].srcmac;
|
|
||||||
uint64_t srcmac2 = udpDetails[0].srcmac2;
|
|
||||||
uint64_t dstmac = udpDetails[0].dstmac;
|
|
||||||
uint64_t dstmac2 = udpDetails[0].dstmac2;
|
|
||||||
int srcport = udpDetails[0].srcport;
|
|
||||||
int srcport2 = udpDetails[0].srcport2;
|
|
||||||
int dstport = udpDetails[0].dstport;
|
|
||||||
int dstport2 = udpDetails[0].dstport2;
|
|
||||||
|
|
||||||
LOG(logINFOBLUE, ("Configuring MAC\n"));
|
LOG(logINFOBLUE, ("Configuring MAC\n"));
|
||||||
|
|
||||||
|
LOG(logINFO, ("Number of entries: %d\n\n", numUdpDestinations));
|
||||||
|
for (int iRxEntry = 0; iRxEntry != MAX_UDP_DESTINATION; ++iRxEntry) {
|
||||||
|
uint32_t srcip = udpDetails[iRxEntry].srcip;
|
||||||
|
uint32_t srcip2 = udpDetails[iRxEntry].srcip2;
|
||||||
|
uint32_t dstip = udpDetails[iRxEntry].dstip;
|
||||||
|
uint32_t dstip2 = udpDetails[iRxEntry].dstip2;
|
||||||
|
uint64_t srcmac = udpDetails[iRxEntry].srcmac;
|
||||||
|
uint64_t srcmac2 = udpDetails[iRxEntry].srcmac2;
|
||||||
|
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
|
||||||
|
uint64_t dstmac2 = udpDetails[iRxEntry].dstmac2;
|
||||||
|
int srcport = udpDetails[iRxEntry].srcport;
|
||||||
|
int srcport2 = udpDetails[iRxEntry].srcport2;
|
||||||
|
int dstport = udpDetails[iRxEntry].dstport;
|
||||||
|
int dstport2 = udpDetails[iRxEntry].dstport2;
|
||||||
|
|
||||||
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
|
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
|
||||||
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
|
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
|
||||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
|
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
|
||||||
@ -1958,6 +1994,10 @@ int configureMAC() {
|
|||||||
getIpAddressinString(src_ip2, srcip2);
|
getIpAddressinString(src_ip2, srcip2);
|
||||||
getIpAddressinString(dst_ip2, dstip2);
|
getIpAddressinString(dst_ip2, dstip2);
|
||||||
|
|
||||||
|
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
||||||
|
if (iRxEntry < numUdpDestinations) {
|
||||||
|
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
|
||||||
|
|
||||||
LOG(logINFO, ("\tData Interface \n"));
|
LOG(logINFO, ("\tData Interface \n"));
|
||||||
LOG(logINFO, ("\tSource IP : %s\n"
|
LOG(logINFO, ("\tSource IP : %s\n"
|
||||||
"\tSource MAC : %s\n"
|
"\tSource MAC : %s\n"
|
||||||
@ -1967,10 +2007,7 @@ int configureMAC() {
|
|||||||
"\tDest Port : %d\n\n",
|
"\tDest Port : %d\n\n",
|
||||||
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
||||||
|
|
||||||
int lll = getVetoStream();
|
if (getVetoStream()) {
|
||||||
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
|
||||||
|
|
||||||
if (lll) {
|
|
||||||
LOG(logINFOGREEN, ("\tVeto (lll) : enabled\n\n"));
|
LOG(logINFOGREEN, ("\tVeto (lll) : enabled\n\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFORED, ("\tVeto (lll) : disabled\n\n"));
|
LOG(logINFORED, ("\tVeto (lll) : disabled\n\n"));
|
||||||
@ -1980,38 +2017,40 @@ int configureMAC() {
|
|||||||
} else {
|
} else {
|
||||||
LOG(logINFORED, ("\tVeto (10GbE): disabled\n"));
|
LOG(logINFORED, ("\tVeto (10GbE): disabled\n"));
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSource IP2 : %s\n"
|
LOG(logINFO,
|
||||||
|
("\tSource IP2 : %s\n"
|
||||||
"\tSource MAC2 : %s\n"
|
"\tSource MAC2 : %s\n"
|
||||||
"\tSource Port2: %d\n"
|
"\tSource Port2: %d\n"
|
||||||
"\tDest IP2 : %s\n"
|
"\tDest IP2 : %s\n"
|
||||||
"\tDest MAC2 : %s\n"
|
"\tDest MAC2 : %s\n"
|
||||||
"\tDest Port2 : %d\n\n",
|
"\tDest Port2 : %d\n\n",
|
||||||
src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
|
src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
if (setUDPDestinationDetails(0, 0, dst_ip, dstport) == FAIL) {
|
if (setUDPDestinationDetails(iRxEntry, 0, dst_ip, dstport) == FAIL) {
|
||||||
LOG(logERROR, ("could not set udp destination IP and port\n"));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
if (i10gbe && setUDPDestinationDetails(0, 1, dst_ip2, dstport2) == FAIL) {
|
|
||||||
LOG(logERROR, ("could not set udp destination IP and port for "
|
LOG(logERROR, ("could not set udp destination IP and port for "
|
||||||
"interface 2\n"));
|
"data interface [entry:%d] \n",
|
||||||
|
iRxEntry));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (i10gbe &&
|
||||||
|
setUDPDestinationDetails(iRxEntry, 1, dst_ip2, dstport2) == FAIL) {
|
||||||
|
LOG(logERROR, ("could not set udp destination IP and port for "
|
||||||
|
"veto interface [entry:%d] \n",
|
||||||
|
iRxEntry));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
|
||||||
#endif
|
#endif
|
||||||
// default one rxr entry (others not yet implemented in client yet)
|
|
||||||
int iRxEntry = 0;
|
|
||||||
|
|
||||||
// data
|
// data
|
||||||
setupHeader(iRxEntry, 0, dstip, dstmac, dstport, srcmac, srcip, srcport);
|
setupHeader(iRxEntry, 0, dstip, dstmac, dstport, srcmac, srcip,
|
||||||
|
srcport);
|
||||||
|
|
||||||
// veto
|
// veto
|
||||||
if (i10gbe) {
|
if (i10gbe) {
|
||||||
setupHeader(iRxEntry, 1, dstip2, dstmac2, dstport2, srcmac2, srcip2,
|
setupHeader(iRxEntry, 1, dstip2, dstmac2, dstport2, srcmac2, srcip2,
|
||||||
srcport2);
|
srcport2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cleanFifos();
|
cleanFifos();
|
||||||
resetCore();
|
resetCore();
|
||||||
// alignDeserializer();
|
// alignDeserializer();
|
||||||
@ -3193,6 +3232,7 @@ void *start_timer(void *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int firstDest = getFirstUDPDestination();
|
||||||
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
||||||
|
|
||||||
int numRepeats = getNumTriggers();
|
int numRepeats = getNumTriggers();
|
||||||
@ -3249,6 +3289,7 @@ void *start_timer(void *arg) {
|
|||||||
*((uint16_t *)(vetoData + i)) = i;
|
*((uint16_t *)(vetoData + i)) = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iRxEntry = firstDest;
|
||||||
// loop over number of repeats
|
// loop over number of repeats
|
||||||
for (int repeatNr = 0; repeatNr != numRepeats; ++repeatNr) {
|
for (int repeatNr = 0; repeatNr != numRepeats; ++repeatNr) {
|
||||||
|
|
||||||
@ -3284,7 +3325,7 @@ void *start_timer(void *arg) {
|
|||||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||||
datasize);
|
datasize);
|
||||||
// send 1 packet = 1 frame
|
// send 1 packet = 1 frame
|
||||||
sendUDPPacket(0, 0, packetData, packetsize);
|
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
|
||||||
|
|
||||||
// second interface (veto)
|
// second interface (veto)
|
||||||
char packetData2[vetopacketsize];
|
char packetData2[vetopacketsize];
|
||||||
@ -3298,11 +3339,12 @@ void *start_timer(void *arg) {
|
|||||||
memcpy(packetData2 + sizeof(veto_header), vetoData,
|
memcpy(packetData2 + sizeof(veto_header), vetoData,
|
||||||
vetodatasize);
|
vetodatasize);
|
||||||
// send 1 packet = 1 frame
|
// send 1 packet = 1 frame
|
||||||
sendUDPPacket(0, 1, packetData2, vetopacketsize);
|
sendUDPPacket(iRxEntry, 1, packetData2, vetopacketsize);
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Sent frame %s: %d (bursts/ triggers: %d) [%lld]\n",
|
LOG(logINFO,
|
||||||
|
("Sent frame %s: %d (bursts/ triggers: %d) [%lld] to E%d\n",
|
||||||
(i10gbe ? "(+veto)" : ""), frameNr, repeatNr,
|
(i10gbe ? "(+veto)" : ""), frameNr, repeatNr,
|
||||||
(long long unsigned int)virtual_currentFrameNumber));
|
(long long unsigned int)virtual_currentFrameNumber, iRxEntry));
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
@ -3314,6 +3356,10 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++virtual_currentFrameNumber;
|
++virtual_currentFrameNumber;
|
||||||
|
++iRxEntry;
|
||||||
|
if (iRxEntry == numUdpDestinations) {
|
||||||
|
iRxEntry = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
clock_gettime(CLOCK_REALTIME, &rend);
|
clock_gettime(CLOCK_REALTIME, &rend);
|
||||||
int64_t timeNs = ((rend.tv_sec - rbegin.tv_sec) * 1E9 +
|
int64_t timeNs = ((rend.tv_sec - rbegin.tv_sec) * 1E9 +
|
||||||
|
Binary file not shown.
@ -1676,7 +1676,9 @@ void *start_timer(void *arg) {
|
|||||||
char imageData[imageSize];
|
char imageData[imageSize];
|
||||||
memset(imageData, 0, imageSize);
|
memset(imageData, 0, imageSize);
|
||||||
if (adcConfigured == -1) {
|
if (adcConfigured == -1) {
|
||||||
*((uint32_t *)(imageData)) = 0xCACACACA;
|
// split dereferencing for rhel7 warnings
|
||||||
|
uint32_t *start = (uint32_t *)imageData;
|
||||||
|
*start = 0xCACACACA;
|
||||||
}
|
}
|
||||||
for (int i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
for (int i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
||||||
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
||||||
@ -1703,7 +1705,9 @@ void *start_timer(void *arg) {
|
|||||||
char packetData[packetSize];
|
char packetData[packetSize];
|
||||||
memset(packetData, 0, packetSize);
|
memset(packetData, 0, packetSize);
|
||||||
// set header
|
// set header
|
||||||
*((uint16_t *)(packetData)) = virtual_currentFrameNumber;
|
// split dereferencing for rhel7 warnings
|
||||||
|
uint16_t *fnum = (uint16_t *)packetData;
|
||||||
|
*fnum = virtual_currentFrameNumber;
|
||||||
++virtual_currentFrameNumber;
|
++virtual_currentFrameNumber;
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -523,4 +523,7 @@
|
|||||||
#define DEADTIME_EARLY_EXP_FIN_ERR_OFST (4)
|
#define DEADTIME_EARLY_EXP_FIN_ERR_OFST (4)
|
||||||
#define DEADTIME_EARLY_EXP_FIN_ERR_MSK (0x00000001 << DEADTIME_EARLY_EXP_FIN_ERR_OFST)
|
#define DEADTIME_EARLY_EXP_FIN_ERR_MSK (0x00000001 << DEADTIME_EARLY_EXP_FIN_ERR_OFST)
|
||||||
|
|
||||||
|
/* UDP datagram registers --------------------------------------------------*/
|
||||||
|
#define RXR_ENDPOINT_OFST (16 * REG_OFFSET)
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
Binary file not shown.
@ -28,6 +28,7 @@ extern int debugflag;
|
|||||||
extern int updateFlag;
|
extern int updateFlag;
|
||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
|
extern int numUdpDestinations;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
// Global variable from communication_funcs.c
|
// Global variable from communication_funcs.c
|
||||||
@ -1904,23 +1905,57 @@ int getExtSignal(int signalIndex) {
|
|||||||
|
|
||||||
int getNumberofUDPInterfaces() { return 1; }
|
int getNumberofUDPInterfaces() { return 1; }
|
||||||
|
|
||||||
|
int getNumberofDestinations(int *retval) {
|
||||||
|
*retval = (((bus_r(PKT_CONFIG_REG) & PKT_CONFIG_NRXR_MAX_MSK) >>
|
||||||
|
PKT_CONFIG_NRXR_MAX_OFST) +
|
||||||
|
1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setNumberofDestinations(int value) {
|
||||||
|
LOG(logINFO, ("Setting number of entries to %d\n", value));
|
||||||
|
--value;
|
||||||
|
bus_w(PKT_CONFIG_REG, bus_r(PKT_CONFIG_REG) & ~PKT_CONFIG_NRXR_MAX_MSK);
|
||||||
|
bus_w(PKT_CONFIG_REG,
|
||||||
|
bus_r(PKT_CONFIG_REG) |
|
||||||
|
((value << PKT_CONFIG_NRXR_MAX_OFST) & PKT_CONFIG_NRXR_MAX_MSK));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFirstUDPDestination() {
|
||||||
|
return ((bus_r(PKT_CONFIG_REG) & PKT_CONFIG_RXR_START_ID_MSK) >>
|
||||||
|
PKT_CONFIG_RXR_START_ID_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFirstUDPDestination(int value) {
|
||||||
|
LOG(logINFO, ("Setting first entry to %d\n", value));
|
||||||
|
bus_w(PKT_CONFIG_REG, bus_r(PKT_CONFIG_REG) & ~PKT_CONFIG_RXR_START_ID_MSK);
|
||||||
|
bus_w(PKT_CONFIG_REG,
|
||||||
|
bus_r(PKT_CONFIG_REG) | ((value << PKT_CONFIG_RXR_START_ID_OFST) &
|
||||||
|
PKT_CONFIG_RXR_START_ID_MSK));
|
||||||
|
}
|
||||||
|
|
||||||
int configureMAC() {
|
int configureMAC() {
|
||||||
|
|
||||||
uint32_t srcip = udpDetails[0].srcip;
|
|
||||||
uint32_t dstip = udpDetails[0].dstip;
|
|
||||||
uint64_t srcmac = udpDetails[0].srcmac;
|
|
||||||
uint64_t dstmac = udpDetails[0].dstmac;
|
|
||||||
int srcport = udpDetails[0].srcport;
|
|
||||||
int dstport = udpDetails[0].dstport;
|
|
||||||
|
|
||||||
LOG(logINFOBLUE, ("Configuring MAC\n"));
|
LOG(logINFOBLUE, ("Configuring MAC\n"));
|
||||||
|
LOG(logINFO, ("Number of entries: %d\n\n", numUdpDestinations));
|
||||||
|
for (int iRxEntry = 0; iRxEntry != MAX_UDP_DESTINATION; ++iRxEntry) {
|
||||||
|
|
||||||
|
uint32_t srcip = udpDetails[iRxEntry].srcip;
|
||||||
|
uint32_t dstip = udpDetails[iRxEntry].dstip;
|
||||||
|
uint64_t srcmac = udpDetails[iRxEntry].srcmac;
|
||||||
|
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
|
||||||
|
int srcport = udpDetails[iRxEntry].srcport;
|
||||||
|
int dstport = udpDetails[iRxEntry].dstport;
|
||||||
|
|
||||||
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
|
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
|
||||||
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
|
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
|
||||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
|
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, srcmac);
|
||||||
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
|
getMacAddressinString(dst_mac, MAC_ADDRESS_SIZE, dstmac);
|
||||||
getIpAddressinString(src_ip, srcip);
|
getIpAddressinString(src_ip, srcip);
|
||||||
getIpAddressinString(dst_ip, dstip);
|
getIpAddressinString(dst_ip, dstip);
|
||||||
|
if (iRxEntry < numUdpDestinations) {
|
||||||
|
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
|
||||||
LOG(logINFO, ("\tSource IP : %s\n"
|
LOG(logINFO, ("\tSource IP : %s\n"
|
||||||
"\tSource MAC : %s\n"
|
"\tSource MAC : %s\n"
|
||||||
"\tSource Port : %d\n"
|
"\tSource Port : %d\n"
|
||||||
@ -1928,10 +1963,12 @@ int configureMAC() {
|
|||||||
"\tDest MAC : %s\n"
|
"\tDest MAC : %s\n"
|
||||||
"\tDest Port : %d\n",
|
"\tDest Port : %d\n",
|
||||||
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
if (setUDPDestinationDetails(0, 0, dst_ip, dstport) == FAIL) {
|
if (setUDPDestinationDetails(iRxEntry, 0, dst_ip, dstport) == FAIL) {
|
||||||
LOG(logERROR, ("could not set udp destination IP and port\n"));
|
LOG(logERROR, ("could not set udp destination IP and port for "
|
||||||
|
"data interface [entry:%d] \n",
|
||||||
|
iRxEntry));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1939,8 +1976,7 @@ int configureMAC() {
|
|||||||
// start addr
|
// start addr
|
||||||
uint32_t addr = BASE_UDP_RAM;
|
uint32_t addr = BASE_UDP_RAM;
|
||||||
// calculate rxr endpoint offset
|
// calculate rxr endpoint offset
|
||||||
// addr += (iRxEntry * RXR_ENDPOINT_OFST);//TODO: is there round robin
|
addr += (iRxEntry * RXR_ENDPOINT_OFST); // TODO: is there round robin
|
||||||
// already implemented?
|
|
||||||
// get struct memory
|
// get struct memory
|
||||||
udp_header *udp =
|
udp_header *udp =
|
||||||
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
|
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
|
||||||
@ -1974,6 +2010,10 @@ int configureMAC() {
|
|||||||
// total length is redefined in firmware
|
// total length is redefined in firmware
|
||||||
|
|
||||||
calcChecksum(udp);
|
calcChecksum(udp);
|
||||||
|
if (iRxEntry < numUdpDestinations) {
|
||||||
|
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO?
|
// TODO?
|
||||||
cleanFifos();
|
cleanFifos();
|
||||||
@ -2010,7 +2050,6 @@ void calcChecksum(udp_header *udp) {
|
|||||||
sum = (sum & 0xffff) + (sum >> 16); // Fold 32-bit sum to 16 bits
|
sum = (sum & 0xffff) + (sum >> 16); // Fold 32-bit sum to 16 bits
|
||||||
long int checksum = sum & 0xffff;
|
long int checksum = sum & 0xffff;
|
||||||
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
||||||
LOG(logINFO, ("\tIP checksum is 0x%lx\n", checksum));
|
|
||||||
udp->ip_checksum = checksum;
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2460,6 +2499,8 @@ void *start_timer(void *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int firstDest = getFirstUDPDestination();
|
||||||
|
|
||||||
const int64_t periodNs = getPeriod();
|
const int64_t periodNs = getPeriod();
|
||||||
const int numFrames = (getNumFrames() * getNumTriggers());
|
const int numFrames = (getNumFrames() * getNumTriggers());
|
||||||
const int64_t expUs = getGatePeriod() / 1000;
|
const int64_t expUs = getGatePeriod() / 1000;
|
||||||
@ -2520,6 +2561,7 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
|
int iRxEntry = firstDest;
|
||||||
// loop over number of frames
|
// loop over number of frames
|
||||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||||
|
|
||||||
@ -2553,10 +2595,11 @@ void *start_timer(void *arg) {
|
|||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
imageData + srcOffset, dataSize);
|
imageData + srcOffset, dataSize);
|
||||||
srcOffset += dataSize;
|
srcOffset += dataSize;
|
||||||
sendUDPPacket(0, 0, packetData, packetSize);
|
sendUDPPacket(iRxEntry, 0, packetData, packetSize);
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
|
LOG(logINFO,
|
||||||
(long long unsigned int)virtual_currentFrameNumber));
|
("Sent frame: %d [%lld] to E%d\n", frameNr,
|
||||||
|
(long long unsigned int)virtual_currentFrameNumber, iRxEntry));
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs =
|
int64_t timeNs =
|
||||||
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
|
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
|
||||||
@ -2568,6 +2611,10 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++virtual_currentFrameNumber;
|
++virtual_currentFrameNumber;
|
||||||
|
++iRxEntry;
|
||||||
|
if (iRxEntry == numUdpDestinations) {
|
||||||
|
iRxEntry = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeUDPSocket(0);
|
closeUDPSocket(0);
|
||||||
|
@ -435,13 +435,16 @@ void setNumberofUDPInterfaces(int val);
|
|||||||
#endif
|
#endif
|
||||||
int getNumberofUDPInterfaces();
|
int getNumberofUDPInterfaces();
|
||||||
|
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D) || \
|
||||||
|
defined(GOTTHARD2D)
|
||||||
int getNumberofDestinations(int *retval);
|
int getNumberofDestinations(int *retval);
|
||||||
int setNumberofDestinations(int value);
|
int setNumberofDestinations(int value);
|
||||||
#endif
|
#endif
|
||||||
#ifdef JUNGFRAUD
|
#if defined(JUNGFRAUD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int getFirstUDPDestination();
|
int getFirstUDPDestination();
|
||||||
void setFirstUDPDestination(int value);
|
void setFirstUDPDestination(int value);
|
||||||
|
#endif
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
void selectPrimaryInterface(int val);
|
void selectPrimaryInterface(int val);
|
||||||
int getPrimaryInterface();
|
int getPrimaryInterface();
|
||||||
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
||||||
|
@ -58,7 +58,6 @@ int ignoreConfigFileFlag = 0;
|
|||||||
|
|
||||||
udpStruct udpDetails[MAX_UDP_DESTINATION];
|
udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
int numUdpDestinations = 1;
|
int numUdpDestinations = 1;
|
||||||
int firstUDPDestination = 0;
|
|
||||||
|
|
||||||
int configured = FAIL;
|
int configured = FAIL;
|
||||||
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
||||||
@ -9047,7 +9046,8 @@ int get_dest_udp_list(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logDEBUG1, ("Getting udp destination list for entry %d\n", arg));
|
LOG(logDEBUG1, ("Getting udp destination list for entry %d\n", arg));
|
||||||
|
|
||||||
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
#if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(MYTHEN3D) && \
|
||||||
|
!defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
if (arg >= MAX_UDP_DESTINATION) {
|
if (arg >= MAX_UDP_DESTINATION) {
|
||||||
@ -9114,7 +9114,8 @@ int set_dest_udp_list(int file_des) {
|
|||||||
getMacAddressinString(mac, MAC_ADDRESS_SIZE, args64[0]);
|
getMacAddressinString(mac, MAC_ADDRESS_SIZE, args64[0]);
|
||||||
getMacAddressinString(mac2, MAC_ADDRESS_SIZE, args64[1]);
|
getMacAddressinString(mac2, MAC_ADDRESS_SIZE, args64[1]);
|
||||||
|
|
||||||
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
#if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(MYTHEN3D) && \
|
||||||
|
!defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -9133,7 +9134,7 @@ int set_dest_udp_list(int file_des) {
|
|||||||
MAX_UDP_DESTINATION - 1);
|
MAX_UDP_DESTINATION - 1);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
#ifdef EIGERD
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
else if (args[4] != 0 || args64[1] != 0) {
|
else if (args[4] != 0 || args64[1] != 0) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not set udp destination. ip2 and mac2 not "
|
strcpy(mess, "Could not set udp destination. ip2 and mac2 not "
|
||||||
@ -9213,14 +9214,11 @@ int set_dest_udp_list(int file_des) {
|
|||||||
numdest = 1;
|
numdest = 1;
|
||||||
}
|
}
|
||||||
// set number of destinations
|
// set number of destinations
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
|
||||||
if (setNumberofDestinations(numdest) == FAIL) {
|
if (setNumberofDestinations(numdest) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not set number of udp destinations.\n");
|
strcpy(mess, "Could not set number of udp destinations.\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
numUdpDestinations = numdest;
|
numUdpDestinations = numdest;
|
||||||
LOG(logINFOBLUE, ("Number of UDP Destinations: %d\n",
|
LOG(logINFOBLUE, ("Number of UDP Destinations: %d\n",
|
||||||
numUdpDestinations));
|
numUdpDestinations));
|
||||||
@ -9238,12 +9236,12 @@ int get_num_dest_list(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(EIGERD)
|
#if !defined(JUNGFRAUD) && !defined(EIGERD) && !defined(MYTHEN3D) && \
|
||||||
|
!defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
retval = numUdpDestinations;
|
retval = numUdpDestinations;
|
||||||
LOG(logDEBUG1, ("numUdpDestinations retval: 0x%x\n", retval));
|
LOG(logDEBUG1, ("numUdpDestinations retval: 0x%x\n", retval));
|
||||||
|
|
||||||
int retval1 = 0;
|
int retval1 = 0;
|
||||||
if (getNumberofDestinations(&retval1) == FAIL || retval1 != retval) {
|
if (getNumberofDestinations(&retval1) == FAIL || retval1 != retval) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -9253,8 +9251,8 @@ int get_num_dest_list(int file_des) {
|
|||||||
retval1, retval);
|
retval1, retval);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9269,7 +9267,8 @@ int clear_all_udp_dst(int file_des) {
|
|||||||
// minimum 1 destination in fpga
|
// minimum 1 destination in fpga
|
||||||
int numdest = 1;
|
int numdest = 1;
|
||||||
// set number of destinations
|
// set number of destinations
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D) || \
|
||||||
|
defined(GOTTHARD2D)
|
||||||
if (setNumberofDestinations(numdest) == FAIL) {
|
if (setNumberofDestinations(numdest) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not clear udp destinations to 1 entry.\n");
|
strcpy(mess, "Could not clear udp destinations to 1 entry.\n");
|
||||||
@ -9296,20 +9295,12 @@ int get_udp_first_dest(int file_des) {
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
#ifndef JUNGFRAUD
|
#if !defined(JUNGFRAUD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
retval = firstUDPDestination;
|
retval = getFirstUDPDestination();
|
||||||
if (getFirstUDPDestination() != retval) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not get first desintation. (server reads %d, fpga reads "
|
|
||||||
"%d).\n",
|
|
||||||
getFirstUDPDestination(), retval);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
LOG(logDEBUG1, ("first udp destination retval: 0x%x\n", retval));
|
LOG(logDEBUG1, ("first udp destination retval: 0x%x\n", retval));
|
||||||
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9322,7 +9313,7 @@ int set_udp_first_dest(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logDEBUG1, ("Setting first udp destination to %d\n", arg));
|
LOG(logDEBUG1, ("Setting first udp destination to %d\n", arg));
|
||||||
|
|
||||||
#ifndef JUNGFRAUD
|
#if !defined(JUNGFRAUD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -9338,10 +9329,6 @@ int set_udp_first_dest(int file_des) {
|
|||||||
int retval = getFirstUDPDestination();
|
int retval = getFirstUDPDestination();
|
||||||
validate(&ret, mess, arg, retval, "set udp first destination",
|
validate(&ret, mess, arg, retval, "set udp first destination",
|
||||||
DEC);
|
DEC);
|
||||||
if (ret == OK) {
|
|
||||||
firstUDPDestination = arg;
|
|
||||||
// configure_mac();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -718,15 +718,17 @@ class Detector {
|
|||||||
|
|
||||||
void setDestinationUDPList(const UdpDestination, const int module_id);
|
void setDestinationUDPList(const UdpDestination, const int module_id);
|
||||||
|
|
||||||
/** [Jungfrau][Eiger] */
|
/** [Jungfrau][Eiger][Mythen3][Gotthard2] */
|
||||||
Result<int> getNumberofUDPDestinations(Positions pos = {}) const;
|
Result<int> getNumberofUDPDestinations(Positions pos = {}) const;
|
||||||
|
|
||||||
void clearUDPDestinations(Positions pos = {});
|
void clearUDPDestinations(Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau][Mythen3][Gotthard2] */
|
||||||
Result<int> getFirstUDPDestination(Positions pos = {}) const;
|
Result<int> getFirstUDPDestination(Positions pos = {}) const;
|
||||||
|
|
||||||
/**[Jungfrau] Options 0-31 (or number of udp destinations) */
|
/**[Jungfrau][Gotthard2] Options 0-31 (or number of udp destinations)\n
|
||||||
|
* [Mythen3] Options 0-63 (or number of udp destinations)
|
||||||
|
*/
|
||||||
void setFirstUDPDestination(const int value, Positions pos = {});
|
void setFirstUDPDestination(const int value, Positions pos = {});
|
||||||
|
|
||||||
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
|
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
|
||||||
|
@ -1519,9 +1519,10 @@ std::string CmdProxy::UDPDestinationList(int action) {
|
|||||||
"\n\t[mac=xx:xx:xx:xx:xx:xx] "
|
"\n\t[mac=xx:xx:xx:xx:xx:xx] "
|
||||||
"[(optional)mac2=xx:xx:xx:xx:xx:xx]\n\t[port=value] "
|
"[(optional)mac2=xx:xx:xx:xx:xx:xx]\n\t[port=value] "
|
||||||
"[(optional)port2=value\n\tThe order of ip, mac and port does "
|
"[(optional)port2=value\n\tThe order of ip, mac and port does "
|
||||||
"not matter. entry_value can be >0 only for Eiger and Jungfrau "
|
"not matter. entry_value can be >0 only for "
|
||||||
"where round robin is implemented. If 'auto' used, then ip is "
|
"[Eiger][Jungfrau][Mythen3][Gotthard2] where round robin is "
|
||||||
"set to ip of rx_hostname."
|
"implemented. If 'auto' used, then ip is set to ip of "
|
||||||
|
"rx_hostname."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
|
@ -1600,9 +1600,9 @@ class CmdProxy {
|
|||||||
|
|
||||||
GET_COMMAND(
|
GET_COMMAND(
|
||||||
udp_numdst, getNumberofUDPDestinations,
|
udp_numdst, getNumberofUDPDestinations,
|
||||||
"\n\t[Jungfrau][Eiger] One can enter upto 32 "
|
"\n\t[Jungfrau][Eiger][Mythen3][Gotthard2] One can enter upto 32 (64 "
|
||||||
"destinations that the detector will stream images "
|
"for Mythen3) destinations that the detector will stream images out in "
|
||||||
"out in a round robin fashion. This is get only command. Default: 1");
|
"a round robin fashion. This is get only command. Default: 1");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations,
|
EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations,
|
||||||
"\n\tClears udp destination details on the detector.");
|
"\n\tClears udp destination details on the detector.");
|
||||||
@ -1610,11 +1610,11 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
|
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[0 - 31 (or number of udp destinations)]\n\t[Jungfrau] One can set "
|
"\n[0 - 31 (or number of udp "
|
||||||
"which is the first "
|
"destinations)]\n\t[Jungfrau][Gotthard2]\n[0-63]\n\t[Mythen3]\n\n\t "
|
||||||
"destination that the detector will stream images "
|
"One can set which is the first destination that the detector will "
|
||||||
"out from in a round robin fashion. The entry must not have been "
|
"stream images out from in a round robin fashion. The entry must not "
|
||||||
"empty. Default: 0");
|
"have been empty. Default: 0");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
||||||
|
@ -2394,7 +2394,8 @@ TEST_CASE("udp_dstlist", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::EIGER) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::EIGER ||
|
||||||
|
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("udp_dstlist", {}, 0, GET, std::cout, 0));
|
REQUIRE_NOTHROW(proxy.Call("udp_dstlist", {}, 0, GET, std::cout, 0));
|
||||||
REQUIRE_THROWS(proxy.Call(
|
REQUIRE_THROWS(proxy.Call(
|
||||||
"udp_dstlist", {"ip=0.0.0.0", "mac=00:00:00:00:00:00", "port=1233"},
|
"udp_dstlist", {"ip=0.0.0.0", "mac=00:00:00:00:00:00", "port=1233"},
|
||||||
@ -2408,7 +2409,8 @@ TEST_CASE("udp_numdst", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::EIGER) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::EIGER ||
|
||||||
|
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("udp_numdst", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("udp_numdst", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("udp_numdst", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("udp_numdst", {}, -1, GET));
|
||||||
@ -2427,7 +2429,8 @@ TEST_CASE("udp_firstdst", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3 ||
|
||||||
|
det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val = det.getFirstUDPDestination();
|
auto prev_val = det.getFirstUDPDestination();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
@ -448,9 +448,9 @@ void Listener::CopyPacket(char *dst, char *src, uint32_t dataSize,
|
|||||||
|
|
||||||
// copy packet data
|
// copy packet data
|
||||||
switch (generalData->detType) {
|
switch (generalData->detType) {
|
||||||
// for gotthard, 1st packet: 4 bytes fnum, CACA
|
// for gotthard,
|
||||||
// + CACA, 639*2 bytes data 2nd packet: 4
|
// 1st packet: 4 bytes fnum, CACA + CACA, 639*2 bytes data
|
||||||
// bytes fnum, previous 1*2 bytes data + 640*2 bytes data !!
|
// 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
if (!pnum)
|
if (!pnum)
|
||||||
memcpy(dst, &src[detHeaderSize + 4], dataSize - 2);
|
memcpy(dst, &src[detHeaderSize + 4], dataSize - 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user