G2: reconfigure chip (#927)

* changed common.c readADCFromFile to make it more general and move temperature calculation for Eiger out of this function and inside whereever it is called.
* g2 and m2: gethighvoltage was just a variable set in server, it is now moved to a get inside DAC5671 implementation (but not reading a measured value, instead what is set from a file), high voltage variable used inside DAC5671 for virtual servers
* g2: switching off hv (ifrom non zero to zero value) will wait for 10s; powering on chip reconfigures chip; powering off chip unconfigures chip; powering off chip also includes check if hv = 0, if not throw exception; chip configuration checked before acquring; at start up: hv switched off and chip powered on, so does not wait 10s to switch off hv;
* included test to check powering off chip when hv is on should throw an exception
* g2:  check if chip configured before acquiring

* nios: read hv value set from file and virtual still goes into DAC5671 for conversions to and fro dac to V, change common readadc to readparameter to generalize, make sethighvoltage into a get and set to catch errors in get as well, g2: if not at startup, remmeber hv value before setting it and after check if value was being switched off (from a non zero value) and wait 10s if it was (10s wait only for switching off from non zero and not at startup)
This commit is contained in:
2024-08-02 12:46:39 +02:00
committed by GitHub
parent ce7f01bdc4
commit c13049f144
21 changed files with 300 additions and 86 deletions

View File

@ -727,8 +727,8 @@ int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix) {
return OK;
}
int readADCFromFile(char *fname, int *value) {
LOG(logDEBUG1, ("fname:%s\n", fname));
int readParameterFromFile(char *fname, char *parameterName, int *value) {
LOG(logDEBUG1, ("fname:%s parameter:%s\n", fname, parameterName));
// open file
FILE *fd = fopen(fname, "r");
if (fd == NULL) {
@ -752,20 +752,10 @@ int readADCFromFile(char *fname, int *value) {
*value = -1;
if (sscanf(line, "%d", value) != 1) {
#ifdef XILINX_CHIPTESTBOARDD
LOG(logERROR, ("Could not scan adc from %s\n", line));
#else
LOG(logERROR, ("Could not scan temperature from %s\n", line));
#endif
LOG(logERROR, ("Could not scan %s from %s\n", parameterName, line));
return FAIL;
}
#ifdef EIGERD
*value /= 10;
#elif !defined(XILINX_CHIPTESTBOARDD)
LOG(logINFO, ("Temperature: %.2f °C\n", (double)(*value) / 1000.00));
#endif
fclose(fd);
return OK;
}