mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
allowing setmaster for eiger
This commit is contained in:
parent
bf1df92303
commit
2b2533f465
@ -40,6 +40,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
|
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
|
||||||
- file write disabled by default
|
- file write disabled by default
|
||||||
- start non blocking acquisition at modular level
|
- start non blocking acquisition at modular level
|
||||||
|
- connect master commands to api (allow set master for eiger)
|
||||||
|
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
|
@ -177,7 +177,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
|
|||||||
ip->ip_header_checksum[1] = ip_checksum & 0xff;
|
ip->ip_header_checksum[1] = ip_checksum & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
int Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
||||||
*top = 0;
|
*top = 0;
|
||||||
*master = 0;
|
*master = 0;
|
||||||
// mapping new memory to read master top module configuration
|
// mapping new memory to read master top module configuration
|
||||||
@ -187,6 +187,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
|||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG(logERROR, ("Module Configuration FAIL\n"));
|
LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||||
|
return FAIL;
|
||||||
} else {
|
} else {
|
||||||
// read data
|
// read data
|
||||||
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
|
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
|
||||||
@ -202,6 +203,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
|||||||
// close file pointer
|
// close file pointer
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
}
|
}
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
||||||
|
@ -15,7 +15,7 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port,
|
|||||||
uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port);
|
uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port);
|
||||||
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
|
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
|
||||||
|
|
||||||
void Beb_GetModuleConfiguration(int *master, int *top, int *normal);
|
int Beb_GetModuleConfiguration(int *master, int *top, int *normal);
|
||||||
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
|
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
|
||||||
|
|
||||||
void Beb_SetTopVariable(int val);
|
void Beb_SetTopVariable(int val);
|
||||||
|
@ -1490,9 +1490,8 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Feb_Control_SetMasterVariable(int val) { Feb_Control_master = val; }
|
|
||||||
|
|
||||||
int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||||
|
|
||||||
uint32_t offset = DAQ_REG_HRDWRE;
|
uint32_t offset = DAQ_REG_HRDWRE;
|
||||||
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
||||||
char *master_names[] = {MASTER_NAMES};
|
char *master_names[] = {MASTER_NAMES};
|
||||||
@ -1529,9 +1528,29 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
|||||||
LOG(logINFOBLUE, ("%s Master flag to %s Feb\n",
|
LOG(logINFOBLUE, ("%s Master flag to %s Feb\n",
|
||||||
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
|
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
|
||||||
master_names[ind]));
|
master_names[ind]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Feb_Control_SetMasterEffects(int master) {
|
||||||
|
int prevMaster = Feb_Control_master;
|
||||||
|
|
||||||
|
Feb_Control_master = master;
|
||||||
|
// change in master for 9m
|
||||||
|
if (prevMaster != Feb_Control_master && !Feb_Control_normal) {
|
||||||
|
if (prevMaster) {
|
||||||
|
Feb_Control_CloseSerialCommunication();
|
||||||
|
}
|
||||||
|
if (Feb_Control_master) {
|
||||||
|
if (!Feb_Control_OpenSerialCommunication()) {
|
||||||
|
LOG(logERROR, ("Could not intitalize feb control serial "
|
||||||
|
"communication\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Feb_Control_SetQuad(int val) {
|
int Feb_Control_SetQuad(int val) {
|
||||||
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
||||||
Feb_Control_quadMode = val;
|
Feb_Control_quadMode = val;
|
||||||
|
@ -86,8 +86,8 @@ int Feb_Control_Get_Counter_Bit();
|
|||||||
int Feb_Control_SetInterruptSubframe(int val);
|
int Feb_Control_SetInterruptSubframe(int val);
|
||||||
int Feb_Control_GetInterruptSubframe();
|
int Feb_Control_GetInterruptSubframe();
|
||||||
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
||||||
void Feb_Control_SetMasterVariable(int val);
|
|
||||||
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
||||||
|
int Feb_Control_SetMasterEffects(int master);
|
||||||
int Feb_Control_SetQuad(int val);
|
int Feb_Control_SetQuad(int val);
|
||||||
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
||||||
int Feb_Control_SetReadNRows(int value);
|
int Feb_Control_SetReadNRows(int value);
|
||||||
|
@ -312,10 +312,10 @@ void initControlServer() {
|
|||||||
if (initError == FAIL) {
|
if (initError == FAIL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getModuleConfiguration();
|
if (updateModuleConfiguration() == FAIL)
|
||||||
|
return;
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
Feb_Control_SetMasterVariable(master);
|
|
||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
Feb_Control_FebControl();
|
Feb_Control_FebControl();
|
||||||
// same addresses for top and bottom
|
// same addresses for top and bottom
|
||||||
@ -354,20 +354,20 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
#ifdef VIRTUAL
|
|
||||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
|
||||||
getModuleConfiguration();
|
|
||||||
sharedMemory_setStop(0);
|
|
||||||
// get top/master in virtual
|
|
||||||
readConfigFile();
|
|
||||||
#else
|
|
||||||
// wait a few s (control server is setting top/master from config file)
|
// wait a few s (control server is setting top/master from config file)
|
||||||
usleep(WAIT_STOP_SERVER_START);
|
usleep(WAIT_STOP_SERVER_START);
|
||||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
// exit(-1);
|
if (updateModuleConfiguration() == FAIL)
|
||||||
getModuleConfiguration();
|
return;
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sharedMemory_setStop(0);
|
||||||
|
// get top/master in virtual
|
||||||
|
if (readConfigFile() == FAIL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
Feb_Control_SetMasterVariable(master);
|
|
||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
Feb_Control_FebControl();
|
Feb_Control_FebControl();
|
||||||
// same addresses for top and bottom
|
// same addresses for top and bottom
|
||||||
@ -381,10 +381,7 @@ void initStopServer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getModuleConfiguration() {
|
void setVirtualDefaultModuleConfigurations() {
|
||||||
if (initError == FAIL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
#ifdef VIRTUAL_MASTER
|
#ifdef VIRTUAL_MASTER
|
||||||
master = 1;
|
master = 1;
|
||||||
@ -403,15 +400,41 @@ void getModuleConfiguration() {
|
|||||||
#else
|
#else
|
||||||
normal = 1;
|
normal = 1;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int updateModuleConfiguration() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
setVirtualDefaultModuleConfigurations();
|
||||||
#else
|
#else
|
||||||
Beb_GetModuleConfiguration(&master, &top, &normal);
|
if (getModuleConfiguration(&master, &top, &normal) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getModuleConfiguration(int *m, int *t, int *n) {
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
*m = master;
|
||||||
|
*t = top;
|
||||||
|
*n = nomal;
|
||||||
|
#else
|
||||||
|
if (Beb_GetModuleConfiguration(&m, &t, &n) == FAIL) {
|
||||||
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage, ("Could not get module configuration\n"));
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (isControlServer) {
|
if (isControlServer) {
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
|
("Module: %s %s %s\n", (*t ? "TOP" : "BOTTOM"),
|
||||||
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
|
(*m ? "MASTER" : "SLAVE"), (*n ? "NORMAL" : "SPECIAL")));
|
||||||
}
|
}
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
@ -502,7 +525,14 @@ int readConfigFile() {
|
|||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
// validate change
|
// validate change
|
||||||
int actual_top = -1, temp = -1, temp2 = -1;
|
int actual_top = -1, temp = -1, temp2 = -1;
|
||||||
Beb_GetModuleConfiguration(&temp, &actual_top, &temp2);
|
if (Beb_GetModuleConfiguration(&temp, &actual_top, &temp2) ==
|
||||||
|
FAIL) {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not get module configuration. Failed to load "
|
||||||
|
"config file in server. Line:[%s].\n",
|
||||||
|
line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (actual_top != top) {
|
if (actual_top != top) {
|
||||||
sprintf(initErrorMessage, "Could not set top to %d. Read %d\n",
|
sprintf(initErrorMessage, "Could not set top to %d. Read %d\n",
|
||||||
top, actual_top);
|
top, actual_top);
|
||||||
@ -514,48 +544,28 @@ int readConfigFile() {
|
|||||||
|
|
||||||
// master command
|
// master command
|
||||||
else if (!strncmp(line, "master", strlen("master"))) {
|
else if (!strncmp(line, "master", strlen("master"))) {
|
||||||
|
int m = -1;
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
if (sscanf(line, "%s %d", command, &master) != 2) {
|
if (sscanf(line, "%s %d", command, &m) != 2) {
|
||||||
sprintf(initErrorMessage,
|
sprintf(initErrorMessage,
|
||||||
"Could not scan master commands from on-board server "
|
"Could not scan master commands from on-board server "
|
||||||
"config file. Line:[%s].\n",
|
"config file. Line:[%s].\n",
|
||||||
line);
|
line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef VIRTUAL
|
if (m != 0 && m != 1)) {
|
||||||
enum MASTERINDEX ind = (master == 1 ? OW_MASTER : OW_SLAVE);
|
sprintf(initErrorMessage,
|
||||||
if (!Beb_SetMaster(ind)) {
|
"Invalid master argument from on-board server "
|
||||||
|
"config file. Line:[%s].\n",
|
||||||
|
line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (setMaster(m) == FAIL) {
|
||||||
sprintf(initErrorMessage,
|
sprintf(initErrorMessage,
|
||||||
"Could not overwrite master to %d in Beb from on-board "
|
"Could not set master from config file. Line:[%s].\n",
|
||||||
"server "
|
line);
|
||||||
"config file. Line:[%s].\n",
|
|
||||||
master, line);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sharedMemory_lockLocalLink();
|
|
||||||
if (!Feb_Control_SetMaster(ind)) {
|
|
||||||
sprintf(initErrorMessage,
|
|
||||||
"Could not overwrite master to %d in Feb from on-board "
|
|
||||||
"server "
|
|
||||||
"config file. Line:[%s].\n",
|
|
||||||
master, line);
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
// validate change
|
|
||||||
int actual_master = -1, temp = -1, temp2 = -1;
|
|
||||||
Beb_GetModuleConfiguration(&actual_master, &temp, &temp2);
|
|
||||||
if (actual_master != master) {
|
|
||||||
sprintf(initErrorMessage,
|
|
||||||
"Could not set master to %d. Read %d\n", master,
|
|
||||||
actual_master);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sharedMemory_lockLocalLink();
|
|
||||||
Feb_Control_SetMasterVariable(master);
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// other commands
|
// other commands
|
||||||
@ -607,12 +617,18 @@ void resetToHardwareSettings() {
|
|||||||
}
|
}
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
int temp = -1, temp2 = -1;
|
int temp = -1, temp2 = -1;
|
||||||
Beb_GetModuleConfiguration(&temp, &top, &temp2);
|
if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) {
|
||||||
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage, "Could not get module configuration after "
|
||||||
|
"resetting top to hardware settings.\n");
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
return;
|
||||||
|
}
|
||||||
Beb_SetTopVariable(top);
|
Beb_SetTopVariable(top);
|
||||||
}
|
}
|
||||||
// master not set in config file
|
// master not set in config file
|
||||||
if (master == -1) {
|
if (master == -1) {
|
||||||
if (!Beb_SetMaster(TOP_HARDWARE)) {
|
if (!Beb_SetMaster(MASTER_HARDWARE)) {
|
||||||
initError = FAIL;
|
initError = FAIL;
|
||||||
strcpy(initErrorMessage,
|
strcpy(initErrorMessage,
|
||||||
"Could not reset Master flag to Beb hardware settings.\n");
|
"Could not reset Master flag to Beb hardware settings.\n");
|
||||||
@ -620,7 +636,7 @@ void resetToHardwareSettings() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_SetMaster(TOP_HARDWARE)) {
|
if (!Feb_Control_SetMaster(MASTER_HARDWARE)) {
|
||||||
initError = FAIL;
|
initError = FAIL;
|
||||||
strcpy(initErrorMessage,
|
strcpy(initErrorMessage,
|
||||||
"Could not reset Master flag to Feb hardware settings.\n");
|
"Could not reset Master flag to Feb hardware settings.\n");
|
||||||
@ -630,10 +646,14 @@ void resetToHardwareSettings() {
|
|||||||
}
|
}
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
int temp = -1, temp2 = -1;
|
int temp = -1, temp2 = -1;
|
||||||
Beb_GetModuleConfiguration(&master, &temp, &temp2);
|
if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) {
|
||||||
sharedMemory_lockLocalLink();
|
initError = FAIL;
|
||||||
Feb_Control_SetMasterVariable(master);
|
strcpy(initErrorMessage,
|
||||||
sharedMemory_unlockLocalLink();
|
"Could not get module configuration after "
|
||||||
|
"resetting master to hardware settings.\n");
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1450,7 +1470,50 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
int isMaster() { return master; }
|
int setMaster(int m) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
master = m;
|
||||||
|
#else
|
||||||
|
if(!Beb_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE)) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedMemory_lockLocalLink();
|
||||||
|
if (!Feb_Control_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE))) {
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
|
||||||
|
// set master variable
|
||||||
|
if (isMaster(master) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// feb variable and hv comms (9m)
|
||||||
|
sharedMemory_lockLocalLink();
|
||||||
|
if (Feb_Control_SetMasterEffects(master) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isMaster(int *retval) {
|
||||||
|
int m = -1, t = -1, n = -1;
|
||||||
|
if (getModuleConfiguration(&m, &t, &n) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (m != master) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("master value retrieved %d and local value %d do not match\n",
|
||||||
|
master, m));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
*retval = m;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -1238,7 +1238,10 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
int isMaster() { return master; }
|
int isMaster(int *retval) {
|
||||||
|
*retval = master;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
|
@ -1545,9 +1545,11 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
|
|
||||||
int isMaster() {
|
int isMaster(int *retval) {
|
||||||
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
int slave = ((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
||||||
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
||||||
|
*retval = (slave == 0 ? 1 : 0);
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
|
@ -110,7 +110,11 @@ u_int32_t getBoardRevision();
|
|||||||
void initControlServer();
|
void initControlServer();
|
||||||
void initStopServer();
|
void initStopServer();
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
void getModuleConfiguration();
|
int updateModuleConfiguration();
|
||||||
|
int getModuleConfiguration(int *m, int *t, int *n);
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
void setVirtualDefaultModuleConfigurations();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set up detector
|
// set up detector
|
||||||
@ -362,9 +366,13 @@ int getADC(enum ADCINDEX ind);
|
|||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
#ifdef EIGERD
|
||||||
int isMaster();
|
int setMaster(int m);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
||||||
|
int isMaster(int *retval);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
void updatingRegisters();
|
void updatingRegisters();
|
||||||
#endif
|
#endif
|
||||||
|
@ -245,6 +245,7 @@ int get_pattern(int);
|
|||||||
int load_default_pattern(int);
|
int load_default_pattern(int);
|
||||||
int get_all_threshold_energy(int);
|
int get_all_threshold_energy(int);
|
||||||
int get_master(int);
|
int get_master(int);
|
||||||
|
int set_master(int);
|
||||||
int get_csr();
|
int get_csr();
|
||||||
int set_gain_caps(int);
|
int set_gain_caps(int);
|
||||||
int get_gain_caps(int);
|
int get_gain_caps(int);
|
||||||
|
@ -464,6 +464,7 @@ void function_table() {
|
|||||||
flist[F_UPDATE_DETECTOR_SERVER] = &update_detector_server;
|
flist[F_UPDATE_DETECTOR_SERVER] = &update_detector_server;
|
||||||
flist[F_GET_UPDATE_MODE] = &get_update_mode;
|
flist[F_GET_UPDATE_MODE] = &get_update_mode;
|
||||||
flist[F_SET_UPDATE_MODE] = &set_update_mode;
|
flist[F_SET_UPDATE_MODE] = &set_update_mode;
|
||||||
|
flist[F_SET_MASTER]] = &set_master;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -8192,11 +8193,55 @@ int get_master(int file_des) {
|
|||||||
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD)
|
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
retval = isMaster();
|
ret = isMaster(&retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
strcpy(mess, "Could not get master\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int set_master(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int arg = -1;
|
||||||
|
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
LOG(logDEBUG1, ("Setting master: %u\n", (int)arg));
|
||||||
|
|
||||||
|
#ifndef EIGERD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
if ((check_detector_idle("set master") == OK) &&
|
||||||
|
(arg != 0 && arg != 1)) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
ret = setMaster(arg);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
strcpy("Could not set master\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
ret = isMaster(&retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
strcpy(mess, "Could not get master\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
LOG(logDEBUG1, ("master retval: %u\n", retval));
|
||||||
|
validate(&ret, mess, arg, retval, "set master", DEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int get_csr(int file_des) {
|
int get_csr(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
@ -193,6 +193,12 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setFlipRows(bool value, Positions pos = {});
|
void setFlipRows(bool value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Eiger][Mythen3][Gotthard1] via stop server **/
|
||||||
|
Result<bool> getMaster(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Eiger] Set master */
|
||||||
|
void setMaster(bool value, int pos);
|
||||||
|
|
||||||
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
@ -1450,9 +1456,6 @@ class Detector {
|
|||||||
* (internal gating). Gate index: 0-2, -1 for all */
|
* (internal gating). Gate index: 0-2, -1 for all */
|
||||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Eiger][Mythen3][Gotthard1] via stop server **/
|
|
||||||
Result<bool> getMaster(Positions pos = {}) const;
|
|
||||||
|
|
||||||
// TODO! check if we really want to expose this !!!!!
|
// TODO! check if we really want to expose this !!!!!
|
||||||
Result<int> getChipStatusRegister(Positions pos = {}) const;
|
Result<int> getChipStatusRegister(Positions pos = {}) const;
|
||||||
|
|
||||||
|
@ -784,6 +784,7 @@ class CmdProxy {
|
|||||||
{"trimen", &CmdProxy::TrimEnergies},
|
{"trimen", &CmdProxy::TrimEnergies},
|
||||||
{"gappixels", &CmdProxy::GapPixels},
|
{"gappixels", &CmdProxy::GapPixels},
|
||||||
{"fliprows", &CmdProxy::fliprows},
|
{"fliprows", &CmdProxy::fliprows},
|
||||||
|
{"master", &CmdProxy::master},
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
{"acquire", &CmdProxy::Acquire},
|
{"acquire", &CmdProxy::Acquire},
|
||||||
|
@ -298,6 +298,17 @@ void Detector::setFlipRows(bool value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setFlipRows, pos, value);
|
pimpl->Parallel(&Module::setFlipRows, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<bool> Detector::getMaster(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::isMaster, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setMaster(bool master, int pos) {
|
||||||
|
if (pos == -1)) {
|
||||||
|
throw RuntimeError("Master can be set only to a single module");
|
||||||
|
}
|
||||||
|
pimpl->Parallel(&Module::setMaster, {pos}, value);
|
||||||
|
}
|
||||||
|
|
||||||
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
||||||
}
|
}
|
||||||
@ -1808,10 +1819,6 @@ Detector::getGateDelayForAllGates(Positions pos) const {
|
|||||||
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
|
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getMaster(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::isMaster, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<int> Detector::getChipStatusRegister(Positions pos) const {
|
Result<int> Detector::getChipStatusRegister(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getChipStatusRegister, pos);
|
return pimpl->Parallel(&Module::getChipStatusRegister, pos);
|
||||||
}
|
}
|
||||||
|
@ -509,6 +509,12 @@ void Module::setFlipRows(bool value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
||||||
|
|
||||||
|
void Module::setMaster(const bool master) {
|
||||||
|
sendToDetector(F_SET_MASTER, static_cast<int>(master), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
bool Module::isVirtualDetectorServer() const {
|
bool Module::isVirtualDetectorServer() const {
|
||||||
return sendToDetector<int>(F_IS_VIRTUAL);
|
return sendToDetector<int>(F_IS_VIRTUAL);
|
||||||
}
|
}
|
||||||
@ -2197,8 +2203,6 @@ std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
|
|||||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
|
||||||
|
|
||||||
int Module::getChipStatusRegister() const {
|
int Module::getChipStatusRegister() const {
|
||||||
return sendToDetector<int>(F_GET_CSR);
|
return sendToDetector<int>(F_GET_CSR);
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,9 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int setTrimEn(const std::vector<int> &energies = {});
|
int setTrimEn(const std::vector<int> &energies = {});
|
||||||
bool getFlipRows() const;
|
bool getFlipRows() const;
|
||||||
void setFlipRows(bool value);
|
void setFlipRows(bool value);
|
||||||
|
bool isMaster() const;
|
||||||
|
void setMaster(const bool master);
|
||||||
|
|
||||||
bool isVirtualDetectorServer() const;
|
bool isVirtualDetectorServer() const;
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
@ -184,6 +187,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setDBITPipeline(int value);
|
void setDBITPipeline(int value);
|
||||||
int getReadNRows() const;
|
int getReadNRows() const;
|
||||||
void setReadNRows(const int value);
|
void setReadNRows(const int value);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition *
|
* Acquisition *
|
||||||
@ -456,7 +460,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int64_t getGateDelay(int gateIndex) const;
|
int64_t getGateDelay(int gateIndex) const;
|
||||||
void setGateDelay(int gateIndex, int64_t value);
|
void setGateDelay(int gateIndex, int64_t value);
|
||||||
std::array<time::ns, 3> getGateDelayForAllGates() const;
|
std::array<time::ns, 3> getGateDelayForAllGates() const;
|
||||||
bool isMaster() const;
|
|
||||||
int getChipStatusRegister() const;
|
int getChipStatusRegister() const;
|
||||||
void setGainCaps(int caps);
|
void setGainCaps(int caps);
|
||||||
int getGainCaps();
|
int getGainCaps();
|
||||||
|
@ -258,6 +258,7 @@ enum detFuncs {
|
|||||||
F_UPDATE_DETECTOR_SERVER,
|
F_UPDATE_DETECTOR_SERVER,
|
||||||
F_GET_UPDATE_MODE,
|
F_GET_UPDATE_MODE,
|
||||||
F_SET_UPDATE_MODE,
|
F_SET_UPDATE_MODE,
|
||||||
|
F_SET_MASTER,
|
||||||
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||||
@ -619,6 +620,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_UPDATE_DETECTOR_SERVER: return "F_UPDATE_DETECTOR_SERVER";
|
case F_UPDATE_DETECTOR_SERVER: return "F_UPDATE_DETECTOR_SERVER";
|
||||||
case F_GET_UPDATE_MODE: return "F_GET_UPDATE_MODE";
|
case F_GET_UPDATE_MODE: return "F_GET_UPDATE_MODE";
|
||||||
case F_SET_UPDATE_MODE: return "F_SET_UPDATE_MODE";
|
case F_SET_UPDATE_MODE: return "F_SET_UPDATE_MODE";
|
||||||
|
case F_SET_MASTER: return "F_SET_MASTER";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user