diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 14eca3a6d..ef8523e99 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 df2fb0a1a..fcc8c6247 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -1724,8 +1724,82 @@ int powerChip(int on) { LOG(logINFOBLUE, ("Powering chip: on\n")); bus_w(CHIP_POWER_REG, bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK); - + configureChip(); + + if (getChipVersion() == 11) { + enum timingMode prevTiming = getTiming(); + + // to change dstip of entry 0 to 0 (to not send out anything) + int numInterfaces = getNumberofUDPInterfaces(); + int selInterface = getPrimaryInterface(); + // corner case: round robin, might not start at entry 0 + uint32_t addr_outer = RXR_ENDPOINT_OUTER_START_REG; + udp_header *udp_outer = (udp_header *)(Blackfin_getBaseAddress() + addr_outer / 2); + uint32_t addr_inner = RXR_ENDPOINT_INNER_START_REG; + udp_header *udp_inner = (udp_header *)(Blackfin_getBaseAddress() + addr_inner / 2); + + LOG(logINFO, ("\tSetting timing to auto (temp solution)\n")); + setTiming(AUTO_TIMING); + + // setting dstip of entry 0 to 0 + if (numInterfaces == 2) { + LOG(logINFO, ("\tSetting dest ip (outer) to 0.0.0.0 (temp solution)\n")); + udp_outer->ip_destip_msb = (uint16_t)0; + udp_outer->ip_destip_lsb = (uint16_t)0; + LOG(logINFO, ("\tSetting dest ip (inner) to 0.0.0.0 (temp solution)\n")); + udp_inner->ip_destip_msb = (uint16_t)0; + udp_inner->ip_destip_lsb = (uint16_t)0; + } else{ + if (selInterface == 0) { + LOG(logINFO, ("\tSetting dest ip (outer) to 0.0.0.0 (temp solution)\n")); + udp_outer->ip_destip_msb = (uint16_t)0; + udp_outer->ip_destip_lsb = (uint16_t)0; + } else { + LOG(logINFO, ("\tSetting dest ip (inner) to 0.0.0.0 (temp solution)\n")); + udp_inner->ip_destip_msb = (uint16_t)0; + udp_inner->ip_destip_lsb = (uint16_t)0; + } + } + + + LOG(logINFO, ("\tStarting acq (temp solution)\n")); + bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_START_ACQ_MSK); + bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_START_ACQ_MSK); + + LOG(logINFO, ("\tStopping acq (temp solution)\n")); + bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STOP_ACQ_MSK); + usleep(100); + bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STOP_ACQ_MSK); + + LOG(logINFO, ("\tSetting timing back to %s (temp solution)\n", (prevTiming == AUTO_TIMING? "auto" : "trigger"))); + setTiming(prevTiming); + + // setting ip back + uint32_t ip = udpDetails[0].dstip; + uint32_t ip2 = udpDetails[0].dstip; + char dst_ip[INET_ADDRSTRLEN], dst_ip2[INET_ADDRSTRLEN]; + getIpAddressinString(dst_ip, ip); + getIpAddressinString(dst_ip2, ip2); + if (numInterfaces == 2) { + LOG(logINFO, ("\tSetting dest ip (outer) to %s (temp solution)\n", dst_ip)); + udp_outer->ip_destip_msb = (uint16_t)((ip >> 16) & BIT16_MASK); + udp_outer->ip_destip_lsb = (uint16_t)((ip >> 0) & BIT16_MASK); + LOG(logINFO, ("\tSetting dest ip (inner) to %s (temp solution)\n", dst_ip2)); + udp_inner->ip_destip_msb = (uint16_t)((ip2 >> 16) & BIT16_MASK); + udp_inner->ip_destip_lsb = (uint16_t)((ip2 >> 0) & BIT16_MASK); + } else{ + if (selInterface == 0) { + LOG(logINFO, ("\tSetting dest ip (outer) to %s (temp solution)\n", dst_ip)); + udp_outer->ip_destip_msb = (uint16_t)((ip >> 16) & BIT16_MASK); + udp_outer->ip_destip_lsb = (uint16_t)((ip >> 0) & BIT16_MASK); + } else { + LOG(logINFO, ("\tSetting dest ip (inner) to %s (temp solution)\n", dst_ip)); + udp_inner->ip_destip_msb = (uint16_t)((ip >> 16) & BIT16_MASK); + udp_inner->ip_destip_lsb = (uint16_t)((ip >> 0) & BIT16_MASK); + } + } + } } else { LOG(logINFOBLUE, ("Powering chip: off\n")); bus_w(CHIP_POWER_REG, @@ -1766,6 +1840,7 @@ void configureChip() { // write same register values back to configure chip bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG)); + LOG(logINFOBLUE, ("\tChip configured\n")); chipConfigured = 1; } }