mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-05-14 07:15:37 +02:00
wip. client and xilinx todo
This commit is contained in:
@@ -11,7 +11,7 @@ install(TARGETS slsProjectCSettings
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
add_subdirectory(ctbDetectorServer)
|
||||
add_subdirectory(xilinx_ctbDetectorServer)
|
||||
#add_subdirectory(xilinx_ctbDetectorServer)
|
||||
add_subdirectory(eigerDetectorServer)
|
||||
add_subdirectory(jungfrauDetectorServer)
|
||||
add_subdirectory(mythen3DetectorServer)
|
||||
|
||||
@@ -1284,7 +1284,7 @@ int validateDACValue(enum DACINDEX ind, int voltage, char *mess) {
|
||||
return OK;
|
||||
}
|
||||
// power dacs
|
||||
if (validatePowerDACVoltage(ind, voltage, mess) == FAIL)
|
||||
if (validatePower(ind, voltage, mess) == FAIL)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
@@ -1512,7 +1512,7 @@ int getVchipToSet(enum DACINDEX ind, int pwr_val, int *retval_vchip,
|
||||
if (ipwr == (int)ind) {
|
||||
val = pwr_val;
|
||||
} else {
|
||||
if (getPower(ind, &val, mess) == FAIL)
|
||||
if ((getDAC, ind, true, &val, mess) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
if (val > max)
|
||||
@@ -1665,8 +1665,8 @@ int isPowerRailEnabled(enum DACINDEX ind, bool *retval, char *mess) {
|
||||
if (getPowerIndexFromDACIndex(ind, &pwrIndex, mess) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
int mask = 0;
|
||||
if (getPowerRailMask(ind, &mask, mess) == FAIL)
|
||||
uint32_t mask = 0;
|
||||
if (getPowerRailMask(pwrIndex, &mask, mess) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
*retval = (bus_r(POWER_REG) & mask) != 0;
|
||||
|
||||
@@ -497,7 +497,7 @@ void setupDetector() {
|
||||
}
|
||||
|
||||
// power on chip
|
||||
initError = powerChip(1, initErrorMessage);
|
||||
initError = powerChip(true, initErrorMessage);
|
||||
if (initError == FAIL)
|
||||
return;
|
||||
|
||||
@@ -2352,7 +2352,7 @@ int checkDetectorType(char *mess) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int powerChip(int on, char *mess) {
|
||||
int powerChip(bool on, char *mess) {
|
||||
if (on) {
|
||||
LOG(logINFO, ("Powering chip: on\n"));
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK);
|
||||
|
||||
@@ -153,7 +153,7 @@ int *getDetectorPosition();
|
||||
|
||||
// very detector specific
|
||||
int checkDetectorType(char *mess);
|
||||
int powerChip(int on, char *mess);
|
||||
int powerChip(bool on, char *mess);
|
||||
int getPowerChip();
|
||||
int isChipConfigured();
|
||||
int configureChip(char *mess);
|
||||
|
||||
@@ -1368,9 +1368,8 @@ int processDACEnums(enum dacIndex ind, int val, bool mV) {
|
||||
if (!mV) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set power. Can get Vchip only in mV and not dac "
|
||||
"units.\n",
|
||||
ind);
|
||||
"Could not get vchip. Can get Vchip only in mV and not dac "
|
||||
"units.\n");
|
||||
LOG(logERROR, (mess));
|
||||
return retval;
|
||||
}
|
||||
@@ -1406,6 +1405,7 @@ int processDACEnums(enum dacIndex ind, int val, bool mV) {
|
||||
LOG(logERROR, (mess));
|
||||
return retval;
|
||||
}
|
||||
[[fallthrough]];
|
||||
// actual dacs
|
||||
default:
|
||||
serverDacIndex = getDACIndex(ind);
|
||||
@@ -4034,7 +4034,11 @@ int power_chip(int file_des) {
|
||||
sprintf(mess, "Power chip %d should be 0 or 1\n", arg);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
ret = powerChip(arg, mess);
|
||||
#ifdef GOTTHARD2D
|
||||
powerChip(arg, mess);
|
||||
#else
|
||||
powerChip(arg);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (ret == OK) {
|
||||
@@ -11376,24 +11380,26 @@ int spi_write(int file_des) {
|
||||
int get_power(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
int retval = -1;
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// index
|
||||
int arg = -1;
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
LOG(logDEBUG1, ("Getting power rail enable for power %d\n", arg));
|
||||
|
||||
enum dacIndex serverDacIndex = getDACIndex(dacIndex(arg));
|
||||
enum DACINDEX serverDacIndex = getDACIndex((enum dacIndex)arg);
|
||||
if (ret == FAIL) {
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
ret = isPowerRailEnabled(serverDacIndex, &retval, mess);
|
||||
bool b_retval = false;
|
||||
ret = isPowerRailEnabled(serverDacIndex, &b_retval, mess);
|
||||
retval = (int)b_retval;
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
@@ -11422,9 +11428,9 @@ int set_power(int file_des) {
|
||||
|
||||
if (Server_VerifyLock() == OK) {
|
||||
|
||||
enum dacIndex serverDacIndices[count] = {0};
|
||||
enum DACINDEX serverDacIndices[count] = {};
|
||||
for (int iPower = 0; iPower != count; ++iPower) {
|
||||
enum dacIndex ind = (dacIndex)args[iPower];
|
||||
enum dacIndex ind = (enum dacIndex)args[iPower];
|
||||
serverDacIndices[iPower] = getDACIndex(ind);
|
||||
if (ret == FAIL) {
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
|
||||
Reference in New Issue
Block a user