diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index c3dc5277e..4941442b6 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index eadf83efb..0ef6c3721 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -2158,8 +2158,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 @@ -2191,6 +2192,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", diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 00714c679..3fa7a1b35 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 39761d91f..50d148b06 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -2052,9 +2052,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 @@ -2085,6 +2085,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)); } diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index f7ce83250..a4215538a 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 72244a4eb..9b53f906f 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -1870,8 +1870,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 @@ -1902,6 +1903,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)); } diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 385d20902..46e044d6d 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index b3cb6fe69..37cb91edb 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -1203,8 +1203,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 @@ -1235,6 +1236,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)); } diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index 42517d6f5..d6530e548 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 8c7f107aa..8d9bc4881 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -2225,9 +2225,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 @@ -2258,6 +2258,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)); } diff --git a/slsDetectorServers/slsDetectorServer/include/arm64.h b/slsDetectorServers/slsDetectorServer/include/arm64.h index eb79100d8..3cf3e5aae 100644 --- a/slsDetectorServers/slsDetectorServer/include/arm64.h +++ b/slsDetectorServers/slsDetectorServer/include/arm64.h @@ -6,8 +6,10 @@ #include 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); diff --git a/slsDetectorServers/slsDetectorServer/src/arm64.c b/slsDetectorServers/slsDetectorServer/src/arm64.c index 034a9856b..14ffa3385 100644 --- a/slsDetectorServers/slsDetectorServer/src/arm64.c +++ b/slsDetectorServers/slsDetectorServer/src/arm64.c @@ -28,6 +28,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))); diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer index c9b913eb0..fac5a1915 100755 Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 04d95fc0b..cffde6ef5 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -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,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; } diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 76e7ea009..6e7cda8ec 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -3,11 +3,11 @@ /** API versions */ #define APILIB "0.0.0 0x250909" #define APIRECEIVER "0.0.0 0x250822" -#define APICTB "0.0.0 0x261028" -#define APIGOTTHARD2 "0.0.0 0x261028" -#define APIMOENCH "0.0.0 0x261028" +#define APICTB "0.0.0 0x261103" +#define APIGOTTHARD2 "0.0.0 0x261103" +#define APIMOENCH "0.0.0 0x261103" #define APIEIGER "0.0.0 0x261027" -#define APIXILINXCTB "0.0.0 0x261028" -#define APIJUNGFRAU "0.0.0 0x261028" -#define APIMYTHEN3 "0.0.0 0x261028" +#define APIXILINXCTB "0.0.0 0x261103" +#define APIJUNGFRAU "0.0.0 0x261103" +#define APIMYTHEN3 "0.0.0 0x261103" #define APIMATTERHORN "0.0.0 0x260529"