diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer deleted file mode 100755 index 364a066f5..000000000 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and /dev/null differ diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv10.1.0 b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv10.1.0 new file mode 100755 index 000000000..a96f5ec68 Binary files /dev/null and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv10.1.0 differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index 7d65e52cd..8893cf0c9 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -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", diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.1.0 b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.1.0 index 0f9b4d701..6342bf02b 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.1.0 and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.1.0 differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 199e26fab..36fc371bb 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -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)); } diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv10.1.0 b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv10.1.0 new file mode 100755 index 000000000..4fd0a4679 Binary files /dev/null and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv10.1.0 differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 09db13a8d..d5db0c81c 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -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)); } diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.1.0 b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.1.0 index 6d4ac74fd..491166701 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.1.0 and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.1.0 differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index 4e1601d01..a21f34c20 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -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)); } diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.1.0 b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.1.0 index 7b5c48f3e..a2058c933 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.1.0 and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.1.0 differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 0d0b6570c..19b3fba00 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -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)); } diff --git a/slsDetectorServers/slsDetectorServer/include/arm64.h b/slsDetectorServers/slsDetectorServer/include/arm64.h index 6614bfe65..3cf3e5aae 100644 --- a/slsDetectorServers/slsDetectorServer/include/arm64.h +++ b/slsDetectorServers/slsDetectorServer/include/arm64.h @@ -6,7 +6,11 @@ #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); u_int32_t readRegister(u_int32_t offset); diff --git a/slsDetectorServers/slsDetectorServer/src/arm64.c b/slsDetectorServers/slsDetectorServer/src/arm64.c index 0c1cbc67f..d18a56958 100644 --- a/slsDetectorServers/slsDetectorServer/src/arm64.c +++ b/slsDetectorServers/slsDetectorServer/src/arm64.c @@ -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))); diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer deleted file mode 100755 index 70a982232..000000000 Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and /dev/null differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv10.1.0 b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv10.1.0 new file mode 100755 index 000000000..8fb157dbe Binary files /dev/null and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv10.1.0 differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 817c19584..2ee32c9db 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -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; } diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 62315c168..e6c7db911 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -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"