mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-11-18 17:24:04 +01:00
1010/fix udp headerwriting (#1660)
* force writing of udp header aligned and in order, fixed xilinx ctb crash on p rx_hostname * force writing of udp header aligned and in order for all detectors * move udp header writing to bus_w * binaries in --------- Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
This commit is contained in:
1 parent
5229269cf7
commit
d3567a60f1
17 files changed
+86
-20
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -1840,8 +1840,9 @@ int configureMAC() {
|
||||
|
||||
// start addr
|
||||
uint32_t addr = RXR_ENDPOINT_START_REG;
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -1873,6 +1874,13 @@ int configureMAC() {
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w(addr + i * 2, words[i]);
|
||||
}
|
||||
|
||||
cleanFifos(); // FIXME: resetPerpheral() for ctb?
|
||||
resetPeripheral();
|
||||
LOG(logINFO, ("Waiting for %d s for mac to be up\n",
|
||||
|
||||
Binary file not shown.
@@ -1976,9 +1976,9 @@ void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
||||
iRxEntry += RXR_ENDPOINTS_MAX;
|
||||
}
|
||||
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||
// get struct memory
|
||||
udp_header *udp =
|
||||
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -2009,6 +2009,14 @@ void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
||||
// total length is redefined in firmware
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w(addr + i * sizeof(uint32_t), words[i]);
|
||||
}
|
||||
|
||||
if (iRxEntry < numUdpDestinations) {
|
||||
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
@@ -1785,8 +1785,9 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
||||
: RXR_ENDPOINT_OUTER_START_REG);
|
||||
// calculate rxr endpoint offset
|
||||
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -1817,6 +1818,14 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
||||
// total length is redefined in firmware
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w(addr + i * 2, words[i]);
|
||||
}
|
||||
|
||||
if (iRxEntry < numUdpDestinations) {
|
||||
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1129,8 +1129,9 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
||||
: RXR_ENDPOINT_OUTER_START_REG);
|
||||
// calculate rxr endpoint offset
|
||||
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -1161,6 +1162,14 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
|
||||
// total length is redefined in firmware
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w(addr + i * 2, words[i]);
|
||||
}
|
||||
|
||||
if (iRxEntry < numUdpDestinations) {
|
||||
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -2009,9 +2009,9 @@ int configureMAC() {
|
||||
uint32_t addr = BASE_UDP_RAM;
|
||||
// calculate rxr endpoint offset
|
||||
addr += (iRxEntry * RXR_ENDPOINT_OFST); // TODO: is there round robin
|
||||
// get struct memory
|
||||
udp_header *udp =
|
||||
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -2042,6 +2042,14 @@ int configureMAC() {
|
||||
// total length is redefined in firmware
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w(addr + i * sizeof(uint32_t), words[i]);
|
||||
}
|
||||
|
||||
if (iRxEntry < numUdpDestinations) {
|
||||
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
void bus_w(u_int32_t offset, u_int32_t data);
|
||||
void bus_w_csp1(u_int32_t offset, u_int32_t data);
|
||||
void bus_w_csp2(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
u_int32_t bus_r_csp1(u_int32_t offset);
|
||||
u_int32_t bus_r_csp2(u_int32_t offset);
|
||||
uint64_t getU64BitReg(int aLSB, int aMSB);
|
||||
void setU64BitReg(uint64_t value, int aLSB, int aMSB);
|
||||
u_int32_t readRegister(u_int32_t offset);
|
||||
|
||||
@@ -25,6 +25,18 @@ void bus_w(u_int32_t offset, u_int32_t data) {
|
||||
*ptr1 = data;
|
||||
}
|
||||
|
||||
void bus_w_csp1(u_int32_t offset, u_int32_t data) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1 = (u_int32_t *)(csp1base + offset / (sizeof(u_int32_t)));
|
||||
*ptr1 = data;
|
||||
}
|
||||
|
||||
u_int32_t bus_r_csp1(u_int32_t offset) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1 = (u_int32_t *)(csp1base + offset / (sizeof(u_int32_t)));
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
u_int32_t bus_r(u_int32_t offset) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1 = (u_int32_t *)(csp0base + offset / (sizeof(u_int32_t)));
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -1444,8 +1444,9 @@ int configureMAC() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header *)(Arm_getUDPBaseAddress());
|
||||
// build udp header
|
||||
udp_header header;
|
||||
udp_header *udp = &header;
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@@ -1477,6 +1478,13 @@ int configureMAC() {
|
||||
|
||||
calcChecksum(udp);
|
||||
|
||||
// force FPGA writes to be aligned and in order
|
||||
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
|
||||
memcpy(words, udp, sizeof(udp_header));
|
||||
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
|
||||
bus_w_csp1(i * sizeof(uint32_t), words[i]);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/** API versions */
|
||||
#define APILIB "10.1.0 0x260806"
|
||||
#define APIRECEIVER "10.1.0 0x260806"
|
||||
#define APICTB "10.1.0 0x261028"
|
||||
#define APIGOTTHARD2 "10.1.0 0x261028"
|
||||
#define APIMOENCH "10.1.0 0x261028"
|
||||
#define APICTB "10.1.0 0x261104"
|
||||
#define APIGOTTHARD2 "10.1.0 0x261104"
|
||||
#define APIMOENCH "10.1.0 0x261104"
|
||||
#define APIEIGER "10.1.0 0x261028"
|
||||
#define APIXILINXCTB "10.1.0 0x261028"
|
||||
#define APIJUNGFRAU "10.1.0 0x261028"
|
||||
#define APIMYTHEN3 "10.1.0 0x261028"
|
||||
#define APIXILINXCTB "10.1.0 0x261104"
|
||||
#define APIJUNGFRAU "10.1.0 0x261104"
|
||||
#define APIMYTHEN3 "10.1.0 0x261104"
|
||||
Reference in new issue
Block a user