force writing of udp header aligned and in order, fixed xilinx ctb crash on p rx_hostname

This commit is contained in:
muelle_m1 committed 2026-11-03 17:03:29 +01:00
1 parent 63138c9f04
commit dd50a21b59
1 file changed
+11 -2
@@ -1502,8 +1502,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
@@ -1535,6 +1536,14 @@ int configureMAC() {
calcChecksum(udp);
// force FPGA writes to be aligned and in order
volatile uint32_t *dst = (volatile uint32_t *)Arm_getUDPBaseAddress();
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) {
dst[i] = words[i];
}
return OK;
}