tengiga enable

This commit is contained in:
maliakal_d 2020-07-17 18:34:23 +02:00
parent b7cb341ee3
commit a76ed6d8db
10 changed files with 36 additions and 11 deletions

View File

@ -1614,7 +1614,6 @@ int enableTenGigabitEthernet(int val) {
} else { } else {
bus_w(addr, bus_r(addr) & (~CONFIG_GB10_SND_UDP_MSK)); bus_w(addr, bus_r(addr) & (~CONFIG_GB10_SND_UDP_MSK));
} }
// configuremac called from client
} }
return ((bus_r(addr) & CONFIG_GB10_SND_UDP_MSK) >> return ((bus_r(addr) & CONFIG_GB10_SND_UDP_MSK) >>
CONFIG_GB10_SND_UDP_OFST); CONFIG_GB10_SND_UDP_OFST);

View File

@ -1528,7 +1528,6 @@ int enableTenGigabitEthernet(int val) {
send_to_ten_gig = 1; send_to_ten_gig = 1;
else else
send_to_ten_gig = 0; send_to_ten_gig = 0;
// configuremac called from client
} }
return send_to_ten_gig; return send_to_ten_gig;
} }

View File

@ -427,6 +427,8 @@ void setupDetector() {
setGateDelay(i, DEFAULT_GATE_DELAY); setGateDelay(i, DEFAULT_GATE_DELAY);
} }
setInitialExtSignals(); setInitialExtSignals();
// 10G UDP
enableTenGigabitEthernet(1);
// check module type attached if not in debug mode // check module type attached if not in debug mode
{ {
@ -1493,6 +1495,26 @@ int setDetectorPosition(int pos[]) {
int *getDetectorPosition() { return detPos; } int *getDetectorPosition() { return detPos; }
int enableTenGigabitEthernet(int val) {
uint32_t addr = PKT_CONFIG_REG;
// set
if (val != -1) {
LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0));
// 1g
if (val == 0) {
bus_w(addr, bus_r(addr) | PKT_CONFIG_1G_INTERFACE_MSK);
}
// 10g
else {
bus_w(addr, bus_r(addr) & (~PKT_CONFIG_1G_INTERFACE_MSK));
}
}
int oneG = ((bus_r(addr) & PKT_CONFIG_1G_INTERFACE_MSK) >>
PKT_CONFIG_1G_INTERFACE_OFST);
return oneG ? 0 : 1;
}
/* pattern */ /* pattern */
void startPattern() { void startPattern() {

View File

@ -377,7 +377,8 @@ int getInterruptSubframe();
int setReadNLines(int value); int setReadNLines(int value);
int getReadNLines(); int getReadNLines();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) #if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
defined(MYTHEN3D)
int enableTenGigabitEthernet(int val); int enableTenGigabitEthernet(int val);
#endif #endif

View File

@ -2855,14 +2855,14 @@ int enable_ten_giga(int file_des) {
return printSocketReadError(); return printSocketReadError();
LOG(logINFOBLUE, ("Setting 10GbE: %d\n", arg)); LOG(logINFOBLUE, ("Setting 10GbE: %d\n", arg));
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(MYTHEN3D) || \ #if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(GOTTHARD2D)
defined(GOTTHARD2D)
functionNotImplemented(); functionNotImplemented();
#else #else
// set & get // set & get
if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) { if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg >= 0 && enableTenGigabitEthernet(GET_FLAG) != arg) { if (arg >= 0 && enableTenGigabitEthernet(GET_FLAG) != arg) {
enableTenGigabitEthernet(arg); enableTenGigabitEthernet(arg);
#ifdef EIGERD
uint64_t hardwaremac = getDetectorMAC(); uint64_t hardwaremac = getDetectorMAC();
if (udpDetails.srcmac != hardwaremac) { if (udpDetails.srcmac != hardwaremac) {
LOG(logINFOBLUE, ("Updating udp source mac\n")); LOG(logINFOBLUE, ("Updating udp source mac\n"));
@ -2873,6 +2873,7 @@ int enable_ten_giga(int file_des) {
LOG(logINFOBLUE, ("Updating udp source ip\n")); LOG(logINFOBLUE, ("Updating udp source ip\n"));
udpDetails.srcip = hardwareip; udpDetails.srcip = hardwareip;
} }
#endif
configure_mac(); configure_mac();
} }
retval = enableTenGigabitEthernet(GET_FLAG); retval = enableTenGigabitEthernet(GET_FLAG);

View File

@ -511,10 +511,10 @@ class Detector {
Result<std::string> printRxConfiguration(Positions pos = {}) const; Result<std::string> printRxConfiguration(Positions pos = {}) const;
/** [Eiger][CTB][Moench] */ /** [Eiger][CTB][Moench][Mythen3] */
Result<bool> getTenGiga(Positions pos = {}) const; Result<bool> getTenGiga(Positions pos = {}) const;
/** [Eiger][CTB][Moench] */ /** [Eiger][CTB][Moench][Mythen3] */
void setTenGiga(bool value, Positions pos = {}); void setTenGiga(bool value, Positions pos = {});
/** [Eiger, Jungfrau] */ /** [Eiger, Jungfrau] */

View File

@ -1648,7 +1648,7 @@ class CmdProxy {
"\n\tPrints the receiver configuration."); "\n\tPrints the receiver configuration.");
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, StringTo<int>, INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, StringTo<int>,
"[0, 1]\n\t[Eiger][Ctb][Moench] 10GbE Enable."); "[0, 1]\n\t[Eiger][Ctb][Moench][Mythen3] 10GbE Enable.");
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl, INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl,
setTenGigaFlowControl, StringTo<int>, setTenGigaFlowControl, StringTo<int>,

View File

@ -1565,7 +1565,7 @@ TEST_CASE("tengiga", "[.cmd][.new]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::CHIPTESTBOARD || if (det_type == defs::EIGER || det_type == defs::CHIPTESTBOARD ||
det_type == defs::MOENCH) { det_type == defs::MOENCH || det_type == defs::MYTHEN3) {
auto tengiga = det.getTenGiga(); auto tengiga = det.getTenGiga();
det.setTenGiga(false); det.setTenGiga(false);

View File

@ -430,7 +430,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
} }
impl()->setTimingMode(arg.timMode); impl()->setTimingMode(arg.timMode);
if (myDetectorType == EIGER || myDetectorType == MOENCH || if (myDetectorType == EIGER || myDetectorType == MOENCH ||
myDetectorType == CHIPTESTBOARD) { myDetectorType == CHIPTESTBOARD || myDetectorType == MYTHEN3) {
try { try {
impl()->setTenGigaEnable(arg.tenGiga); impl()->setTenGigaEnable(arg.tenGiga);
} catch (const RuntimeError &e) { } catch (const RuntimeError &e) {
@ -987,7 +987,7 @@ int ClientInterface::get_overwrite(Interface &socket) {
int ClientInterface::enable_tengiga(Interface &socket) { int ClientInterface::enable_tengiga(Interface &socket) {
auto val = socket.Receive<int>(); auto val = socket.Receive<int>();
if (myDetectorType != EIGER && myDetectorType != CHIPTESTBOARD && if (myDetectorType != EIGER && myDetectorType != CHIPTESTBOARD &&
myDetectorType != MOENCH) myDetectorType != MOENCH && myDetectorType != MYTHEN3)
functionNotImplemented(); functionNotImplemented();
if (val >= 0) { if (val >= 0) {

View File

@ -1662,6 +1662,9 @@ void Implementation::setTenGigaEnable(const bool b) {
case EIGER: case EIGER:
generalData->SetTenGigaEnable(b, dynamicRange); generalData->SetTenGigaEnable(b, dynamicRange);
break; break;
case MYTHEN3:
generalData->SetDynamicRange(dynamicRange, b);
break;
case MOENCH: case MOENCH:
case CHIPTESTBOARD: case CHIPTESTBOARD:
ctbAnalogDataBytes = generalData->setImageSize( ctbAnalogDataBytes = generalData->setImageSize(