mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
Dev/reg bit change no validate (#970)
- do not validate write reg, setbit and clearbit by default anymore - --validate will force validation on the bitmask or entire reg - remove return value for write reg (across server to client, but thankfully not in the Detector class) - extend validation into writereg, setbit and clearbit for Eiger (always special) - need to check python (TODO) - missed the rx_zmqip implementations in detector.h and python bindings
This commit is contained in:
parent
a44ba4dc35
commit
2dc0963c56
@ -8,7 +8,7 @@ class Register:
|
|||||||
return self._detector.readRegister(key)
|
return self._detector.readRegister(key)
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
self._detector.writeRegister(key, value)
|
self._detector.writeRegister(key, value, False)
|
||||||
|
|
||||||
class Adc_register:
|
class Adc_register:
|
||||||
def __init__(self, detector):
|
def __init__(self, detector):
|
||||||
|
@ -1940,17 +1940,19 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"writeRegister",
|
"writeRegister",
|
||||||
(void (Detector::*)(uint32_t, uint32_t, sls::Positions)) &
|
(void (Detector::*)(uint32_t, uint32_t, bool, sls::Positions)) &
|
||||||
Detector::writeRegister,
|
Detector::writeRegister,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
|
||||||
CppDetectorApi.def("setBit",
|
CppDetectorApi.def(
|
||||||
(void (Detector::*)(uint32_t, int, sls::Positions)) &
|
"setBit",
|
||||||
Detector::setBit,
|
(void (Detector::*)(uint32_t, int, bool, sls::Positions)) &
|
||||||
py::arg(), py::arg(), py::arg() = Positions{});
|
Detector::setBit,
|
||||||
CppDetectorApi.def("clearBit",
|
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
|
||||||
(void (Detector::*)(uint32_t, int, sls::Positions)) &
|
CppDetectorApi.def(
|
||||||
Detector::clearBit,
|
"clearBit",
|
||||||
py::arg(), py::arg(), py::arg() = Positions{});
|
(void (Detector::*)(uint32_t, int, bool, sls::Positions)) &
|
||||||
|
Detector::clearBit,
|
||||||
|
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"getBit",
|
"getBit",
|
||||||
(Result<int>(Detector::*)(uint32_t, int, sls::Positions)) &
|
(Result<int>(Detector::*)(uint32_t, int, sls::Positions)) &
|
||||||
|
Binary file not shown.
@ -1251,7 +1251,8 @@ int Feb_Control_Disable16bitConversion(int disable) {
|
|||||||
regval &= ~bitmask;
|
regval &= ~bitmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Feb_Control_WriteRegister_BitMask(DAQ_REG_HRDWRE, regval, bitmask)) {
|
if (!Feb_Control_WriteRegister_BitMask(DAQ_REG_HRDWRE, regval, bitmask,
|
||||||
|
1)) {
|
||||||
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
|
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
|
||||||
(disable ? "disable" : "enable")));
|
(disable ? "disable" : "enable")));
|
||||||
return 0;
|
return 0;
|
||||||
@ -1637,7 +1638,7 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
|
|||||||
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Feb_Control_WriteRegister(righOffset, regval)) {
|
if (!Feb_Control_WriteRegister(righOffset, regval, 1)) {
|
||||||
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
|
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1666,8 +1667,10 @@ int Feb_Control_GetReadNRows() {
|
|||||||
return regVal;
|
return regVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data, int validate) {
|
||||||
return Feb_Control_WriteRegister_BitMask(offset, data, BIT32_MSK);
|
if (!Feb_Control_WriteRegister_BitMask(offset, data, BIT32_MSK, validate))
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
||||||
@ -1675,7 +1678,7 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
|
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
|
||||||
uint32_t bitmask) {
|
uint32_t bitmask, int validate) {
|
||||||
uint32_t actualOffset = offset;
|
uint32_t actualOffset = offset;
|
||||||
char side[2][10] = {"right", "left"};
|
char side[2][10] = {"right", "left"};
|
||||||
unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress};
|
unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress};
|
||||||
@ -1720,21 +1723,24 @@ int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
|
|||||||
writeVal, side[iloop], actualOffset));
|
writeVal, side[iloop], actualOffset));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
writeVal &= bitmask;
|
|
||||||
|
|
||||||
uint32_t readVal = 0;
|
if (validate) {
|
||||||
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
|
|
||||||
&readVal)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
readVal &= bitmask;
|
|
||||||
|
|
||||||
if (writeVal != readVal) {
|
uint32_t readVal = 0;
|
||||||
LOG(logERROR,
|
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
|
||||||
("Could not write %s addr 0x%x register. Wrote "
|
&readVal)) {
|
||||||
"0x%x, read 0x%x (mask:0x%x)\n",
|
return 0;
|
||||||
side[iloop], actualOffset, writeVal, readVal, bitmask));
|
}
|
||||||
return 0;
|
readVal &= bitmask;
|
||||||
|
writeVal &= bitmask;
|
||||||
|
if (writeVal != readVal) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Could not write %s addr 0x%x register. Wrote "
|
||||||
|
"0x%x, read 0x%x (mask:0x%x)\n",
|
||||||
|
side[iloop], actualOffset, writeVal, readVal,
|
||||||
|
bitmask));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,10 @@ 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);
|
||||||
int Feb_Control_GetReadNRows();
|
int Feb_Control_GetReadNRows();
|
||||||
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data, int validate);
|
||||||
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
||||||
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
|
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
|
||||||
uint32_t bitmask);
|
uint32_t bitmask, int validate);
|
||||||
int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval,
|
int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval,
|
||||||
uint32_t bitmask);
|
uint32_t bitmask);
|
||||||
// pulsing
|
// pulsing
|
||||||
|
Binary file not shown.
@ -883,12 +883,12 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* advanced read/write reg */
|
/* advanced read/write reg */
|
||||||
int writeRegister(uint32_t offset, uint32_t data) {
|
int writeRegister(uint32_t offset, uint32_t data, int validate) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#else
|
#else
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_WriteRegister(offset, data)) {
|
if (!Feb_Control_WriteRegister(offset, data, validate)) {
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -911,7 +911,7 @@ int readRegister(uint32_t offset, uint32_t *retval) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int setBit(const uint32_t addr, const int nBit) {
|
int setBit(const uint32_t addr, const int nBit, int validate) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
uint32_t regval = 0;
|
uint32_t regval = 0;
|
||||||
if (readRegister(addr, ®val) == FAIL) {
|
if (readRegister(addr, ®val) == FAIL) {
|
||||||
@ -921,7 +921,7 @@ int setBit(const uint32_t addr, const int nBit) {
|
|||||||
uint32_t val = regval | bitmask;
|
uint32_t val = regval | bitmask;
|
||||||
|
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_WriteRegister_BitMask(addr, val, bitmask)) {
|
if (!Feb_Control_WriteRegister_BitMask(addr, val, bitmask, validate)) {
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -930,7 +930,7 @@ int setBit(const uint32_t addr, const int nBit) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clearBit(const uint32_t addr, const int nBit) {
|
int clearBit(const uint32_t addr, const int nBit, int validate) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
uint32_t regval = 0;
|
uint32_t regval = 0;
|
||||||
if (readRegister(addr, ®val) == FAIL) {
|
if (readRegister(addr, ®val) == FAIL) {
|
||||||
@ -940,7 +940,7 @@ int clearBit(const uint32_t addr, const int nBit) {
|
|||||||
uint32_t val = regval & ~bitmask;
|
uint32_t val = regval & ~bitmask;
|
||||||
|
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_WriteRegister_BitMask(addr, val, bitmask)) {
|
if (!Feb_Control_WriteRegister_BitMask(addr, val, bitmask, validate)) {
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -527,12 +527,12 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t writeRegister16And32(uint32_t offset, uint32_t data) {
|
void writeRegister16And32(uint32_t offset, uint32_t data) {
|
||||||
if (((offset << MEM_MAP_SHIFT) == CONTROL_REG) ||
|
if (((offset << MEM_MAP_SHIFT) == CONTROL_REG) ||
|
||||||
((offset << MEM_MAP_SHIFT) == FIFO_DATA_REG)) {
|
((offset << MEM_MAP_SHIFT) == FIFO_DATA_REG)) {
|
||||||
return writeRegister16(offset, data);
|
writeRegister16(offset, data);
|
||||||
} else
|
} else
|
||||||
return writeRegister(offset, data);
|
writeRegister(offset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t readRegister16And32(uint32_t offset) {
|
uint32_t readRegister16And32(uint32_t offset) {
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -81,7 +81,7 @@ u_int32_t readRegister(u_int32_t offset);
|
|||||||
* @param offset address offset
|
* @param offset address offset
|
||||||
* @param data 32 bit data
|
* @param data 32 bit data
|
||||||
*/
|
*/
|
||||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
|
void writeRegister(u_int32_t offset, u_int32_t data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read from a 16 bit register (literal register value provided by client)
|
* Read from a 16 bit register (literal register value provided by client)
|
||||||
@ -95,7 +95,7 @@ u_int32_t readRegister16(u_int32_t offset);
|
|||||||
* @param offset address offset
|
* @param offset address offset
|
||||||
* @param data 16 bit data
|
* @param data 16 bit data
|
||||||
*/
|
*/
|
||||||
u_int32_t writeRegister16(u_int32_t offset, u_int32_t data);
|
void writeRegister16(u_int32_t offset, u_int32_t data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get base address for memory copy
|
* Get base address for memory copy
|
||||||
|
@ -78,7 +78,7 @@ u_int32_t readRegister(u_int32_t offset);
|
|||||||
* @param offset address offset
|
* @param offset address offset
|
||||||
* @param data 32 bit data
|
* @param data 32 bit data
|
||||||
*/
|
*/
|
||||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
|
void writeRegister(u_int32_t offset, u_int32_t data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map FPGA
|
* Map FPGA
|
||||||
|
@ -172,14 +172,13 @@ void resetToHardwareSettings();
|
|||||||
|
|
||||||
// advanced read/write reg
|
// advanced read/write reg
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int writeRegister(uint32_t offset, uint32_t data);
|
int writeRegister(uint32_t offset, uint32_t data, int validate);
|
||||||
int readRegister(uint32_t offset, uint32_t *retval);
|
int readRegister(uint32_t offset, uint32_t *retval);
|
||||||
int setBit(const uint32_t addr, int nBit);
|
int setBit(const uint32_t addr, const int nBit, int validate);
|
||||||
int clearBit(const uint32_t addr, int nBit);
|
int clearBit(const uint32_t addr, const int nBit, int validate);
|
||||||
int getBit(const uint32_t addr, const int nBit, int *retval);
|
int getBit(const uint32_t addr, const int nBit, int *retval);
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
uint32_t writeRegister16And32(uint32_t offset,
|
void writeRegister16And32(uint32_t offset, uint32_t data);
|
||||||
uint32_t data); // FIXME its not there in ctb
|
|
||||||
uint32_t readRegister16And32(uint32_t offset);
|
uint32_t readRegister16And32(uint32_t offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ u_int32_t readRegister(u_int32_t offset) {
|
|||||||
return bus_r(offset << MEM_MAP_SHIFT);
|
return bus_r(offset << MEM_MAP_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
void writeRegister(u_int32_t offset, u_int32_t data) {
|
||||||
// if electron mode bit touched
|
// if electron mode bit touched
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int electronCollectionModeChange = 0;
|
int electronCollectionModeChange = 0;
|
||||||
@ -100,16 +100,14 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
|||||||
configureChip();
|
configureChip();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return readRegister(offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t readRegister16(u_int32_t offset) {
|
u_int32_t readRegister16(u_int32_t offset) {
|
||||||
return (u_int32_t)bus_r16(offset << MEM_MAP_SHIFT);
|
return (u_int32_t)bus_r16(offset << MEM_MAP_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t writeRegister16(u_int32_t offset, u_int32_t data) {
|
void writeRegister16(u_int32_t offset, u_int32_t data) {
|
||||||
bus_w16(offset << MEM_MAP_SHIFT, (u_int16_t)data);
|
bus_w16(offset << MEM_MAP_SHIFT, (u_int16_t)data);
|
||||||
return readRegister16(offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mapCSP0(void) {
|
int mapCSP0(void) {
|
||||||
|
@ -82,10 +82,7 @@ void setU64BitReg(uint64_t value, int aLSB, int aMSB) {
|
|||||||
|
|
||||||
u_int32_t readRegister(u_int32_t offset) { return bus_r(offset); }
|
u_int32_t readRegister(u_int32_t offset) { return bus_r(offset); }
|
||||||
|
|
||||||
u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
void writeRegister(u_int32_t offset, u_int32_t data) { bus_w(offset, data); }
|
||||||
bus_w(offset, data);
|
|
||||||
return readRegister(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mapCSP0(void) {
|
int mapCSP0(void) {
|
||||||
u_int32_t csps[2] = {CSP0, CSP1};
|
u_int32_t csps[2] = {CSP0, CSP1};
|
||||||
|
@ -1649,40 +1649,35 @@ int get_adc(int file_des) {
|
|||||||
int write_register(int file_des) {
|
int write_register(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
uint32_t args[2] = {-1, -1};
|
uint32_t args[3] = {-1, -1, -1};
|
||||||
uint32_t retval = -1;
|
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
uint32_t addr = args[0];
|
uint32_t addr = args[0];
|
||||||
uint32_t val = args[1];
|
uint32_t val = args[1];
|
||||||
LOG(logDEBUG1, ("Writing to register 0x%x, data 0x%x\n", addr, val));
|
uint32_t validate = args[2];
|
||||||
|
LOG(logDEBUG1, ("Writing to register 0x%x, data 0x%x, validate:%d\n", addr,
|
||||||
|
val, validate));
|
||||||
|
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
#ifdef GOTTHARDD
|
#if EIGERD
|
||||||
retval = writeRegister16And32(addr, val);
|
if (writeRegister(addr, val, validate) == FAIL) {
|
||||||
#elif EIGERD
|
|
||||||
if (writeRegister(addr, val) == FAIL) {
|
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not write to register 0x%x.\n", addr);
|
sprintf(mess, "Could not write to register 0x%x.\n", addr);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
|
||||||
if (readRegister(addr, &retval) == FAIL) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(
|
|
||||||
mess,
|
|
||||||
"Could not read register 0x%x or inconsistent values. Try "
|
|
||||||
"to read +0x100 for only left and +0x200 for only right.\n",
|
|
||||||
addr);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
retval = writeRegister(addr, val);
|
#ifdef GOTTHARDD
|
||||||
|
writeRegister16And32(addr, val);
|
||||||
|
uint32_t retval = readRegister16And32(addr);
|
||||||
|
#else
|
||||||
|
writeRegister(addr, val);
|
||||||
|
uint32_t retval = readRegister(addr);
|
||||||
#endif
|
#endif
|
||||||
|
LOG(logDEBUG1, ("Write register retval (0x%x): 0x%x\n", addr, retval));
|
||||||
// validate
|
// validate
|
||||||
if (ret == OK && retval != val) {
|
if (validate && ret == OK && retval != val) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(
|
sprintf(
|
||||||
mess,
|
mess,
|
||||||
@ -1690,9 +1685,9 @@ int write_register(int file_des) {
|
|||||||
addr, val, retval);
|
addr, val, retval);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Write register (0x%x): 0x%x\n", retval));
|
#endif
|
||||||
}
|
}
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_register(int file_des) {
|
int read_register(int file_des) {
|
||||||
@ -1707,9 +1702,7 @@ int read_register(int file_des) {
|
|||||||
LOG(logDEBUG1, ("Reading from register 0x%x\n", addr));
|
LOG(logDEBUG1, ("Reading from register 0x%x\n", addr));
|
||||||
|
|
||||||
// get
|
// get
|
||||||
#ifdef GOTTHARDD
|
#if EIGERD
|
||||||
retval = readRegister16And32(addr);
|
|
||||||
#elif EIGERD
|
|
||||||
if (readRegister(addr, &retval) == FAIL) {
|
if (readRegister(addr, &retval) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
@ -1718,6 +1711,8 @@ int read_register(int file_des) {
|
|||||||
addr);
|
addr);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
|
#elif GOTTHARDD
|
||||||
|
retval = readRegister16And32(addr);
|
||||||
#else
|
#else
|
||||||
retval = readRegister(addr);
|
retval = readRegister(addr);
|
||||||
#endif
|
#endif
|
||||||
@ -10594,13 +10589,15 @@ int get_frontend_firmware_version(int file_des) {
|
|||||||
int set_bit(int file_des) {
|
int set_bit(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
uint32_t args[2] = {-1, -1};
|
uint32_t args[3] = {-1, -1, -1};
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
uint32_t addr = args[0];
|
uint32_t addr = args[0];
|
||||||
int nBit = (int)args[1];
|
int nBit = (int)args[1];
|
||||||
LOG(logDEBUG1, ("Setting bit %d of reg 0x%x\n", nBit, addr));
|
uint32_t validate = args[2];
|
||||||
|
LOG(logDEBUG1,
|
||||||
|
("Setting bit %d of reg 0x%x, validate:%d\n", nBit, addr, validate));
|
||||||
|
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
@ -10613,20 +10610,23 @@ int set_bit(int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
ret = setBit(addr, nBit);
|
ret = setBit(addr, nBit, validate);
|
||||||
if (ret == FAIL) {
|
|
||||||
#else
|
#else
|
||||||
uint32_t bitmask = (1 << nBit);
|
uint32_t bitmask = (1 << nBit);
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
uint32_t val = readRegister16And32(addr) | bitmask;
|
uint32_t val = readRegister16And32(addr) | bitmask;
|
||||||
uint32_t retval = writeRegister16And32(addr, val);
|
writeRegister16And32(addr, val);
|
||||||
|
uint32_t retval = readRegister16And32(addr) | bitmask;
|
||||||
#else
|
#else
|
||||||
uint32_t val = readRegister(addr) | bitmask;
|
uint32_t val = readRegister(addr) | bitmask;
|
||||||
uint32_t retval = writeRegister(addr, val);
|
writeRegister(addr, val);
|
||||||
|
uint32_t retval = readRegister(addr) | bitmask;
|
||||||
#endif
|
#endif
|
||||||
if (!(retval & bitmask)) {
|
if (validate && (!(retval & bitmask))) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (ret == FAIL) {
|
||||||
sprintf(mess, "Could not set bit %d.\n", nBit);
|
sprintf(mess, "Could not set bit %d.\n", nBit);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
@ -10638,13 +10638,15 @@ int set_bit(int file_des) {
|
|||||||
int clear_bit(int file_des) {
|
int clear_bit(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
uint32_t args[2] = {-1, -1};
|
uint32_t args[3] = {-1, -1, -1};
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
uint32_t addr = args[0];
|
uint32_t addr = args[0];
|
||||||
int nBit = (int)args[1];
|
int nBit = (int)args[1];
|
||||||
LOG(logDEBUG1, ("Clearing bit %d of reg 0x%x\n", nBit, addr));
|
uint32_t validate = args[2];
|
||||||
|
LOG(logDEBUG1,
|
||||||
|
("Clearing bit %d of reg 0x%x, validate:%d\n", nBit, addr, validate));
|
||||||
|
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
@ -10657,20 +10659,23 @@ int clear_bit(int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
ret = clearBit(addr, nBit);
|
ret = clearBit(addr, nBit, validate);
|
||||||
if (ret == FAIL) {
|
|
||||||
#else
|
#else
|
||||||
uint32_t bitmask = (1 << nBit);
|
uint32_t bitmask = (1 << nBit);
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
uint32_t val = readRegister16And32(addr) & ~bitmask;
|
uint32_t val = readRegister16And32(addr) & ~bitmask;
|
||||||
uint32_t retval = writeRegister16And32(addr, val);
|
writeRegister16And32(addr, val);
|
||||||
|
uint32_t retval = readRegister16And32(addr) & ~bitmask;
|
||||||
#else
|
#else
|
||||||
uint32_t val = readRegister(addr) & ~bitmask;
|
uint32_t val = readRegister(addr) & ~bitmask;
|
||||||
uint32_t retval = writeRegister(addr, val);
|
writeRegister(addr, val);
|
||||||
|
uint32_t retval = readRegister(addr) & ~bitmask;
|
||||||
#endif
|
#endif
|
||||||
if (retval & bitmask) {
|
if (validate && (retval & bitmask)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (ret == FAIL) {
|
||||||
sprintf(mess, "Could not clear bit %d.\n", nBit);
|
sprintf(mess, "Could not clear bit %d.\n", nBit);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -21,8 +21,8 @@ type_values = {
|
|||||||
"special::currentSourceFix": ["fix", "nofix"],
|
"special::currentSourceFix": ["fix", "nofix"],
|
||||||
"special::currentSourceLow": ["normal", "low"],
|
"special::currentSourceLow": ["normal", "low"],
|
||||||
"special::path": [],
|
"special::path": [],
|
||||||
"special::pedestal_parameters" : ["", "0"]
|
"special::pedestal_parameters" : ["", "0"],
|
||||||
|
"special::validate": ["--validate"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -330,6 +330,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -342,6 +345,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1814,6 +1820,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1826,6 +1835,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ${IS_GET} -eq 0 ]]; then
|
if [[ ${IS_GET} -eq 0 ]]; then
|
||||||
if [[ "${cword}" == "2" ]]; then
|
if [[ "${cword}" == "2" ]]; then
|
||||||
@ -2211,6 +2223,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -266,6 +269,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1738,6 +1744,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1750,6 +1759,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ${IS_GET} -eq 0 ]]; then
|
if [[ ${IS_GET} -eq 0 ]]; then
|
||||||
if [[ "${cword}" == "2" ]]; then
|
if [[ "${cword}" == "2" ]]; then
|
||||||
@ -2135,6 +2147,9 @@ fi
|
|||||||
if [[ "${cword}" == "3" ]]; then
|
if [[ "${cword}" == "3" ]]; then
|
||||||
FCN_RETURN=""
|
FCN_RETURN=""
|
||||||
fi
|
fi
|
||||||
|
if [[ "${cword}" == "4" ]]; then
|
||||||
|
FCN_RETURN="--validate"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -4173,7 +4173,7 @@ update:
|
|||||||
output: [ '"successful"' ]
|
output: [ '"successful"' ]
|
||||||
|
|
||||||
reg:
|
reg:
|
||||||
help: "[address] [32 bit value]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called while calling blocking acquire().\n\t[Eiger] +0x100 for only left, +0x200 for only right."
|
help: "[address] [32 bit value][(optional)--validate]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called while calling blocking acquire().\n\t\t Use --validate to force validation when writing to it.\n\t[Eiger] +0x100 for only left, +0x200 for only right."
|
||||||
actions:
|
actions:
|
||||||
GET:
|
GET:
|
||||||
argc: 1
|
argc: 1
|
||||||
@ -4184,13 +4184,23 @@ reg:
|
|||||||
cast_input: [ true ]
|
cast_input: [ true ]
|
||||||
output: [ OutStringHex(t) ]
|
output: [ OutStringHex(t) ]
|
||||||
PUT:
|
PUT:
|
||||||
argc: 2
|
|
||||||
require_det_id: true
|
require_det_id: true
|
||||||
function: writeRegister
|
function: writeRegister
|
||||||
input: [ 'args[0]', 'args[1]' ]
|
output: [ '"["', 'args[0]', '", "', 'args[1]', '"]"' ]
|
||||||
input_types: [ uint32_t, uint32_t ]
|
args:
|
||||||
cast_input: [ true, true ]
|
- argc: 2
|
||||||
output: [ ToString(args) ]
|
input: [ 'args[0]', 'args[1]', '"0"' ]
|
||||||
|
input_types: [ uint32_t, uint32_t, bool ]
|
||||||
|
arg_types: [ uint32_t, uint32_t ]
|
||||||
|
cast_input: [ true, true, true ]
|
||||||
|
- argc: 3
|
||||||
|
arg_types: [ uint32_t, uint32_t, special::validate ]
|
||||||
|
exceptions:
|
||||||
|
- condition: 'args[2] != "--validate"'
|
||||||
|
message: '"Could not scan third argument. Did you mean --validate?"'
|
||||||
|
input: [ 'args[0]', 'args[1]', '"1"' ]
|
||||||
|
input_types: [ uint32_t, uint32_t, bool ]
|
||||||
|
cast_input: [ true, true, true ]
|
||||||
|
|
||||||
adcreg:
|
adcreg:
|
||||||
help: "[address] [value]\n\t[Jungfrau][Moench][Ctb][Gotthard] Writes to an adc register in hex. Advanced user Function!"
|
help: "[address] [value]\n\t[Jungfrau][Moench][Ctb][Gotthard] Writes to an adc register in hex. Advanced user Function!"
|
||||||
@ -4223,27 +4233,40 @@ Setbit:
|
|||||||
template: true
|
template: true
|
||||||
actions:
|
actions:
|
||||||
PUT:
|
PUT:
|
||||||
argc: 2
|
|
||||||
exceptions:
|
|
||||||
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
|
|
||||||
message: '"Bit number out of range: " + args[1]'
|
|
||||||
require_det_id: true
|
require_det_id: true
|
||||||
function: setBit
|
function: setBit
|
||||||
input: [ 'args[0]', 'args[1]' ]
|
output: [ '"["', 'args[0]', '", "', 'args[1]', '"]"' ]
|
||||||
input_types: [ uint32_t, int ]
|
args:
|
||||||
cast_input: [ true, true ]
|
- argc: 2
|
||||||
output: [ ToString(args) ]
|
exceptions:
|
||||||
|
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
|
||||||
|
message: '"Bit number out of range: " + args[1]'
|
||||||
|
input: [ 'args[0]', 'args[1]', '"0"' ]
|
||||||
|
input_types: [ uint32_t, int, bool ]
|
||||||
|
arg_types: [ uint32_t, int ]
|
||||||
|
cast_input: [ true, true, true ]
|
||||||
|
- argc: 3
|
||||||
|
arg_types: [ uint32_t, int, special::validate ]
|
||||||
|
exceptions:
|
||||||
|
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
|
||||||
|
message: '"Bit number out of range: " + args[1]'
|
||||||
|
- condition: 'args[2] != "--validate"'
|
||||||
|
message: '"Could not scan third argument. Did you mean --validate?"'
|
||||||
|
input: [ 'args[0]', 'args[1]', '"1"' ]
|
||||||
|
input_types: [ uint32_t, int, bool ]
|
||||||
|
cast_input: [ true, true, true ]
|
||||||
|
|
||||||
|
|
||||||
setbit:
|
setbit:
|
||||||
inherit_actions: Setbit
|
inherit_actions: Setbit
|
||||||
help: "[reg address in hex] [bit index]\n\tSets bit in address."
|
help: "[reg address in hex] [bit index]\n\tSets bit in address.\n\tUse --validate to force validation."
|
||||||
actions:
|
actions:
|
||||||
PUT:
|
PUT:
|
||||||
function: setBit
|
function: setBit
|
||||||
|
|
||||||
clearbit:
|
clearbit:
|
||||||
inherit_actions: Setbit
|
inherit_actions: Setbit
|
||||||
help: "[reg address in hex] [bit index]\n\tClears bit in address."
|
help: "[reg address in hex] [bit index]\n\tClears bit in address.\n\tUse --validate to force validation."
|
||||||
actions:
|
actions:
|
||||||
PUT:
|
PUT:
|
||||||
function: clearBit
|
function: clearBit
|
||||||
|
@ -1104,6 +1104,7 @@ clearbit:
|
|||||||
cast_input:
|
cast_input:
|
||||||
- true
|
- true
|
||||||
- true
|
- true
|
||||||
|
- true
|
||||||
check_det_id: false
|
check_det_id: false
|
||||||
convert_det_id: true
|
convert_det_id: true
|
||||||
exceptions:
|
exceptions:
|
||||||
@ -1113,16 +1114,56 @@ clearbit:
|
|||||||
input:
|
input:
|
||||||
- args[0]
|
- args[0]
|
||||||
- args[1]
|
- args[1]
|
||||||
|
- '"0"'
|
||||||
input_types:
|
input_types:
|
||||||
- uint32_t
|
- uint32_t
|
||||||
- int
|
- int
|
||||||
|
- bool
|
||||||
output:
|
output:
|
||||||
- ToString(args)
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
|
require_det_id: true
|
||||||
|
store_result_in_t: false
|
||||||
|
- arg_types:
|
||||||
|
- uint32_t
|
||||||
|
- int
|
||||||
|
- special::validate
|
||||||
|
argc: 3
|
||||||
|
cast_input:
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
check_det_id: false
|
||||||
|
convert_det_id: true
|
||||||
|
exceptions:
|
||||||
|
- condition: StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31
|
||||||
|
message: '"Bit number out of range: " + args[1]'
|
||||||
|
- condition: args[2] != "--validate"
|
||||||
|
message: '"Could not scan third argument. Did you mean --validate?"'
|
||||||
|
function: clearBit
|
||||||
|
input:
|
||||||
|
- args[0]
|
||||||
|
- args[1]
|
||||||
|
- '"1"'
|
||||||
|
input_types:
|
||||||
|
- uint32_t
|
||||||
|
- int
|
||||||
|
- bool
|
||||||
|
output:
|
||||||
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
require_det_id: true
|
require_det_id: true
|
||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: clearbit
|
command_name: clearbit
|
||||||
function_alias: clearbit
|
function_alias: clearbit
|
||||||
help: "[reg address in hex] [bit index]\n\tClears bit in address."
|
help: "[reg address in hex] [bit index]\n\tClears bit in address.\n\tUse --validate\
|
||||||
|
\ to force validation."
|
||||||
infer_action: true
|
infer_action: true
|
||||||
template: true
|
template: true
|
||||||
clearbusy:
|
clearbusy:
|
||||||
@ -7973,25 +8014,64 @@ reg:
|
|||||||
cast_input:
|
cast_input:
|
||||||
- true
|
- true
|
||||||
- true
|
- true
|
||||||
|
- true
|
||||||
check_det_id: false
|
check_det_id: false
|
||||||
convert_det_id: true
|
convert_det_id: true
|
||||||
function: writeRegister
|
function: writeRegister
|
||||||
input:
|
input:
|
||||||
- args[0]
|
- args[0]
|
||||||
- args[1]
|
- args[1]
|
||||||
|
- '"0"'
|
||||||
input_types:
|
input_types:
|
||||||
- uint32_t
|
- uint32_t
|
||||||
- uint32_t
|
- uint32_t
|
||||||
|
- bool
|
||||||
output:
|
output:
|
||||||
- ToString(args)
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
|
require_det_id: true
|
||||||
|
store_result_in_t: false
|
||||||
|
- arg_types:
|
||||||
|
- uint32_t
|
||||||
|
- uint32_t
|
||||||
|
- special::validate
|
||||||
|
argc: 3
|
||||||
|
cast_input:
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
check_det_id: false
|
||||||
|
convert_det_id: true
|
||||||
|
exceptions:
|
||||||
|
- condition: args[2] != "--validate"
|
||||||
|
message: '"Could not scan third argument. Did you mean --validate?"'
|
||||||
|
function: writeRegister
|
||||||
|
input:
|
||||||
|
- args[0]
|
||||||
|
- args[1]
|
||||||
|
- '"1"'
|
||||||
|
input_types:
|
||||||
|
- uint32_t
|
||||||
|
- uint32_t
|
||||||
|
- bool
|
||||||
|
output:
|
||||||
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
require_det_id: true
|
require_det_id: true
|
||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: reg
|
command_name: reg
|
||||||
function_alias: reg
|
function_alias: reg
|
||||||
help: "[address] [32 bit value]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit\
|
help: "[address] [32 bit value][(optional)--validate]\n\t[Mythen3][Gotthard2] Reads/writes\
|
||||||
\ register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called\
|
\ to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence,\
|
||||||
\ while calling blocking acquire().\n\t[Eiger] +0x100 for only left, +0x200 for\
|
\ can be called while calling blocking acquire().\n\t\t Use --validate to force\
|
||||||
\ only right."
|
\ validation when writing to it.\n\t[Eiger] +0x100 for only left, +0x200 for only\
|
||||||
|
\ right."
|
||||||
infer_action: true
|
infer_action: true
|
||||||
resetdacs:
|
resetdacs:
|
||||||
actions:
|
actions:
|
||||||
@ -9646,6 +9726,7 @@ setbit:
|
|||||||
cast_input:
|
cast_input:
|
||||||
- true
|
- true
|
||||||
- true
|
- true
|
||||||
|
- true
|
||||||
check_det_id: false
|
check_det_id: false
|
||||||
convert_det_id: true
|
convert_det_id: true
|
||||||
exceptions:
|
exceptions:
|
||||||
@ -9655,16 +9736,56 @@ setbit:
|
|||||||
input:
|
input:
|
||||||
- args[0]
|
- args[0]
|
||||||
- args[1]
|
- args[1]
|
||||||
|
- '"0"'
|
||||||
input_types:
|
input_types:
|
||||||
- uint32_t
|
- uint32_t
|
||||||
- int
|
- int
|
||||||
|
- bool
|
||||||
output:
|
output:
|
||||||
- ToString(args)
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
|
require_det_id: true
|
||||||
|
store_result_in_t: false
|
||||||
|
- arg_types:
|
||||||
|
- uint32_t
|
||||||
|
- int
|
||||||
|
- special::validate
|
||||||
|
argc: 3
|
||||||
|
cast_input:
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
- true
|
||||||
|
check_det_id: false
|
||||||
|
convert_det_id: true
|
||||||
|
exceptions:
|
||||||
|
- condition: StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31
|
||||||
|
message: '"Bit number out of range: " + args[1]'
|
||||||
|
- condition: args[2] != "--validate"
|
||||||
|
message: '"Could not scan third argument. Did you mean --validate?"'
|
||||||
|
function: setBit
|
||||||
|
input:
|
||||||
|
- args[0]
|
||||||
|
- args[1]
|
||||||
|
- '"1"'
|
||||||
|
input_types:
|
||||||
|
- uint32_t
|
||||||
|
- int
|
||||||
|
- bool
|
||||||
|
output:
|
||||||
|
- '"["'
|
||||||
|
- args[0]
|
||||||
|
- '", "'
|
||||||
|
- args[1]
|
||||||
|
- '"]"'
|
||||||
require_det_id: true
|
require_det_id: true
|
||||||
store_result_in_t: false
|
store_result_in_t: false
|
||||||
command_name: setbit
|
command_name: setbit
|
||||||
function_alias: setbit
|
function_alias: setbit
|
||||||
help: "[reg address in hex] [bit index]\n\tSets bit in address."
|
help: "[reg address in hex] [bit index]\n\tSets bit in address.\n\tUse --validate\
|
||||||
|
\ to force validation."
|
||||||
infer_action: true
|
infer_action: true
|
||||||
template: true
|
template: true
|
||||||
settings:
|
settings:
|
||||||
|
@ -2034,13 +2034,16 @@ class Detector {
|
|||||||
* Goes to stop server. Hence, can be called while calling blocking
|
* Goes to stop server. Hence, can be called while calling blocking
|
||||||
* acquire(). \n [Eiger] Address is +0x100 for only left, +0x200 for only
|
* acquire(). \n [Eiger] Address is +0x100 for only left, +0x200 for only
|
||||||
* right. */
|
* right. */
|
||||||
void writeRegister(uint32_t addr, uint32_t val, Positions pos = {});
|
void writeRegister(uint32_t addr, uint32_t val, bool validate = false,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** Advanced user Function! */
|
/** Advanced user Function! */
|
||||||
void setBit(uint32_t addr, int bitnr, Positions pos = {});
|
void setBit(uint32_t addr, int bitnr, bool validate = false,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** Advanced user Function! */
|
/** Advanced user Function! */
|
||||||
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
|
void clearBit(uint32_t addr, int bitnr, bool validate = false,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** Advanced user Function! */
|
/** Advanced user Function! */
|
||||||
Result<int> getBit(uint32_t addr, int bitnr, Positions pos = {});
|
Result<int> getBit(uint32_t addr, int bitnr, Positions pos = {});
|
||||||
|
@ -1482,14 +1482,15 @@ std::string Caller::clearbit(int action) {
|
|||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: clearbit" << std::endl;
|
os << "Command: clearbit" << std::endl;
|
||||||
os << R"V0G0N([reg address in hex] [bit index]
|
os << R"V0G0N([reg address in hex] [bit index]
|
||||||
Clears bit in address. )V0G0N"
|
Clears bit in address.
|
||||||
|
Use --validate to force validation. )V0G0N"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if action and arguments are valid
|
// check if action and arguments are valid
|
||||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||||
if (1 && args.size() != 2) {
|
if (1 && args.size() != 2 && args.size() != 3) {
|
||||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1504,6 +1505,29 @@ std::string Caller::clearbit(int action) {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw RuntimeError("Could not convert argument 1 to int");
|
throw RuntimeError("Could not convert argument 1 to int");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("0");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
try {
|
||||||
|
StringTo<uint32_t>(args[0]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 0 to uint32_t");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<int>(args[1]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 1 to int");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("1");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1522,8 +1546,24 @@ std::string Caller::clearbit(int action) {
|
|||||||
}
|
}
|
||||||
auto arg0 = StringTo<uint32_t>(args[0]);
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
auto arg1 = StringTo<int>(args[1]);
|
auto arg1 = StringTo<int>(args[1]);
|
||||||
det->clearBit(arg0, arg1, std::vector<int>{det_id});
|
auto arg2 = StringTo<bool>("0");
|
||||||
os << ToString(args) << '\n';
|
det->clearBit(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
if (StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31) {
|
||||||
|
throw RuntimeError("Bit number out of range: " + args[1]);
|
||||||
|
}
|
||||||
|
if (args[2] != "--validate") {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Could not scan third argument. Did you mean --validate?");
|
||||||
|
}
|
||||||
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
|
auto arg1 = StringTo<int>(args[1]);
|
||||||
|
auto arg2 = StringTo<bool>("1");
|
||||||
|
det->clearBit(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10307,9 +10347,10 @@ std::string Caller::reg(int action) {
|
|||||||
// print help
|
// print help
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: reg" << std::endl;
|
os << "Command: reg" << std::endl;
|
||||||
os << R"V0G0N([address] [32 bit value]
|
os << R"V0G0N([address] [32 bit value][(optional)--validate]
|
||||||
[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!
|
[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!
|
||||||
Goes to stop server. Hence, can be called while calling blocking acquire().
|
Goes to stop server. Hence, can be called while calling blocking acquire().
|
||||||
|
Use --validate to force validation when writing to it.
|
||||||
[Eiger] +0x100 for only left, +0x200 for only right. )V0G0N"
|
[Eiger] +0x100 for only left, +0x200 for only right. )V0G0N"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
@ -10332,7 +10373,7 @@ std::string Caller::reg(int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||||
if (1 && args.size() != 2) {
|
if (1 && args.size() != 2 && args.size() != 3) {
|
||||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10347,6 +10388,29 @@ std::string Caller::reg(int action) {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw RuntimeError("Could not convert argument 1 to uint32_t");
|
throw RuntimeError("Could not convert argument 1 to uint32_t");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("0");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
try {
|
||||||
|
StringTo<uint32_t>(args[0]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 0 to uint32_t");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<uint32_t>(args[1]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 1 to uint32_t");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("1");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -10370,8 +10434,21 @@ std::string Caller::reg(int action) {
|
|||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
auto arg0 = StringTo<uint32_t>(args[0]);
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
auto arg1 = StringTo<uint32_t>(args[1]);
|
auto arg1 = StringTo<uint32_t>(args[1]);
|
||||||
det->writeRegister(arg0, arg1, std::vector<int>{det_id});
|
auto arg2 = StringTo<bool>("0");
|
||||||
os << ToString(args) << '\n';
|
det->writeRegister(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
if (args[2] != "--validate") {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Could not scan third argument. Did you mean --validate?");
|
||||||
|
}
|
||||||
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
|
auto arg1 = StringTo<uint32_t>(args[1]);
|
||||||
|
auto arg2 = StringTo<bool>("1");
|
||||||
|
det->writeRegister(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12601,14 +12678,15 @@ std::string Caller::setbit(int action) {
|
|||||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||||
os << "Command: setbit" << std::endl;
|
os << "Command: setbit" << std::endl;
|
||||||
os << R"V0G0N([reg address in hex] [bit index]
|
os << R"V0G0N([reg address in hex] [bit index]
|
||||||
Sets bit in address. )V0G0N"
|
Sets bit in address.
|
||||||
|
Use --validate to force validation. )V0G0N"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if action and arguments are valid
|
// check if action and arguments are valid
|
||||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||||
if (1 && args.size() != 2) {
|
if (1 && args.size() != 2 && args.size() != 3) {
|
||||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12623,6 +12701,29 @@ std::string Caller::setbit(int action) {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw RuntimeError("Could not convert argument 1 to int");
|
throw RuntimeError("Could not convert argument 1 to int");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("0");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
try {
|
||||||
|
StringTo<uint32_t>(args[0]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 0 to uint32_t");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<int>(args[1]);
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 1 to int");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
StringTo<bool>("1");
|
||||||
|
} catch (...) {
|
||||||
|
throw RuntimeError("Could not convert argument 2 to bool");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -12641,8 +12742,24 @@ std::string Caller::setbit(int action) {
|
|||||||
}
|
}
|
||||||
auto arg0 = StringTo<uint32_t>(args[0]);
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
auto arg1 = StringTo<int>(args[1]);
|
auto arg1 = StringTo<int>(args[1]);
|
||||||
det->setBit(arg0, arg1, std::vector<int>{det_id});
|
auto arg2 = StringTo<bool>("0");
|
||||||
os << ToString(args) << '\n';
|
det->setBit(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
if (StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31) {
|
||||||
|
throw RuntimeError("Bit number out of range: " + args[1]);
|
||||||
|
}
|
||||||
|
if (args[2] != "--validate") {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Could not scan third argument. Did you mean --validate?");
|
||||||
|
}
|
||||||
|
auto arg0 = StringTo<uint32_t>(args[0]);
|
||||||
|
auto arg1 = StringTo<int>(args[1]);
|
||||||
|
auto arg2 = StringTo<bool>("1");
|
||||||
|
det->setBit(arg0, arg1, arg2, std::vector<int>{det_id});
|
||||||
|
os << "[" << args[0] << ", " << args[1] << "]" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2673,16 +2673,18 @@ Result<uint32_t> Detector::readRegister(uint32_t addr, Positions pos) const {
|
|||||||
return pimpl->Parallel(&Module::readRegister, pos, addr);
|
return pimpl->Parallel(&Module::readRegister, pos, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::writeRegister(uint32_t addr, uint32_t val, Positions pos) {
|
void Detector::writeRegister(uint32_t addr, uint32_t val, bool validate,
|
||||||
pimpl->Parallel(&Module::writeRegister, pos, addr, val);
|
Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::writeRegister, pos, addr, val, validate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setBit(uint32_t addr, int bitnr, Positions pos) {
|
void Detector::setBit(uint32_t addr, int bitnr, bool validate, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setBit, pos, addr, bitnr);
|
pimpl->Parallel(&Module::setBit, pos, addr, bitnr, validate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::clearBit(uint32_t addr, int bitnr, Positions pos) {
|
void Detector::clearBit(uint32_t addr, int bitnr, bool validate,
|
||||||
pimpl->Parallel(&Module::clearBit, pos, addr, bitnr);
|
Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::clearBit, pos, addr, bitnr, validate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getBit(uint32_t addr, int bitnr, Positions pos) {
|
Result<int> Detector::getBit(uint32_t addr, int bitnr, Positions pos) {
|
||||||
|
@ -2812,18 +2812,20 @@ uint32_t Module::readRegister(uint32_t addr) const {
|
|||||||
return sendToDetectorStop<uint32_t>(F_READ_REGISTER, addr);
|
return sendToDetectorStop<uint32_t>(F_READ_REGISTER, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Module::writeRegister(uint32_t addr, uint32_t val) {
|
void Module::writeRegister(uint32_t addr, uint32_t val, bool validate) {
|
||||||
uint32_t args[]{addr, val};
|
uint32_t args[]{addr, val, static_cast<uint32_t>(validate)};
|
||||||
return sendToDetectorStop<uint32_t>(F_WRITE_REGISTER, args);
|
return sendToDetectorStop(F_WRITE_REGISTER, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setBit(uint32_t addr, int n) {
|
void Module::setBit(uint32_t addr, int n, bool validate) {
|
||||||
uint32_t args[2] = {addr, static_cast<uint32_t>(n)};
|
uint32_t args[] = {addr, static_cast<uint32_t>(n),
|
||||||
|
static_cast<uint32_t>(validate)};
|
||||||
sendToDetectorStop(F_SET_BIT, args, nullptr);
|
sendToDetectorStop(F_SET_BIT, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::clearBit(uint32_t addr, int n) {
|
void Module::clearBit(uint32_t addr, int n, bool validate) {
|
||||||
uint32_t args[2] = {addr, static_cast<uint32_t>(n)};
|
uint32_t args[] = {addr, static_cast<uint32_t>(n),
|
||||||
|
static_cast<uint32_t>(validate)};
|
||||||
sendToDetectorStop(F_CLEAR_BIT, args, nullptr);
|
sendToDetectorStop(F_CLEAR_BIT, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,9 +589,9 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
bool getUpdateMode() const;
|
bool getUpdateMode() const;
|
||||||
void setUpdateMode(const bool updatemode);
|
void setUpdateMode(const bool updatemode);
|
||||||
uint32_t readRegister(uint32_t addr) const;
|
uint32_t readRegister(uint32_t addr) const;
|
||||||
uint32_t writeRegister(uint32_t addr, uint32_t val);
|
void writeRegister(uint32_t addr, uint32_t val, bool validate);
|
||||||
void setBit(uint32_t addr, int n);
|
void setBit(uint32_t addr, int n, bool validate);
|
||||||
void clearBit(uint32_t addr, int n);
|
void clearBit(uint32_t addr, int n, bool validate);
|
||||||
int getBit(uint32_t addr, int n);
|
int getBit(uint32_t addr, int n);
|
||||||
void executeFirmwareTest();
|
void executeFirmwareTest();
|
||||||
void executeBusTest();
|
void executeBusTest();
|
||||||
|
@ -404,6 +404,10 @@ int InferAction::clearbit() {
|
|||||||
return slsDetectorDefs::PUT_ACTION;
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||||
@ -2490,6 +2494,10 @@ int InferAction::reg() {
|
|||||||
return slsDetectorDefs::PUT_ACTION;
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||||
@ -3143,6 +3151,10 @@ int InferAction::setbit() {
|
|||||||
return slsDetectorDefs::PUT_ACTION;
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.size() == 3) {
|
||||||
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||||
|
@ -3245,6 +3245,13 @@ TEST_CASE("CALLER::reg", "[.cmdcall]") {
|
|||||||
uint32_t addr = 0x64;
|
uint32_t addr = 0x64;
|
||||||
std::string saddr = ToStringHex(addr);
|
std::string saddr = ToStringHex(addr);
|
||||||
auto prev_val = det.readRegister(addr);
|
auto prev_val = det.readRegister(addr);
|
||||||
|
{
|
||||||
|
std::ostringstream oss1, oss2;
|
||||||
|
caller.call("reg", {saddr, "0x6", "--validate"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "reg [" + saddr + ", 0x6]\n");
|
||||||
|
caller.call("reg", {saddr}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "reg 0x6\n");
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
caller.call("reg", {saddr, "0x5"}, -1, PUT, oss1);
|
caller.call("reg", {saddr, "0x5"}, -1, PUT, oss1);
|
||||||
@ -3253,7 +3260,7 @@ TEST_CASE("CALLER::reg", "[.cmdcall]") {
|
|||||||
REQUIRE(oss2.str() == "reg 0x5\n");
|
REQUIRE(oss2.str() == "reg 0x5\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.writeRegister(addr, prev_val[i], {i});
|
det.writeRegister(addr, prev_val[i], false, {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cannot check for eiger virtual server
|
// cannot check for eiger virtual server
|
||||||
@ -3289,15 +3296,17 @@ TEST_CASE("CALLER::setbit", "[.cmdcall]") {
|
|||||||
std::string saddr = ToStringHex(addr);
|
std::string saddr = ToStringHex(addr);
|
||||||
auto prev_val = det.readRegister(addr);
|
auto prev_val = det.readRegister(addr);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
caller.call("reg", {saddr, "0x0"}, -1, PUT);
|
caller.call("reg", {saddr, "0x0"}, -1, PUT);
|
||||||
caller.call("setbit", {saddr, "1"}, -1, PUT, oss1);
|
caller.call("setbit", {saddr, "1"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "setbit [" + saddr + ", 1]\n");
|
REQUIRE(oss1.str() == "setbit [" + saddr + ", 1]\n");
|
||||||
caller.call("reg", {saddr}, -1, GET, oss2);
|
caller.call("setbit", {saddr, "2", "--validate"}, -1, PUT, oss2);
|
||||||
REQUIRE(oss2.str() == "reg 0x2\n");
|
REQUIRE(oss2.str() == "setbit [" + saddr + ", 2]\n");
|
||||||
|
caller.call("reg", {saddr}, -1, GET, oss3);
|
||||||
|
REQUIRE(oss3.str() == "reg 0x6\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.writeRegister(addr, prev_val[i], {i});
|
det.writeRegister(addr, prev_val[i], false, {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3311,15 +3320,17 @@ TEST_CASE("CALLER::clearbit", "[.cmdcall]") {
|
|||||||
std::string saddr = ToStringHex(addr);
|
std::string saddr = ToStringHex(addr);
|
||||||
auto prev_val = det.readRegister(addr);
|
auto prev_val = det.readRegister(addr);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
caller.call("reg", {saddr, "0x3"}, -1, PUT);
|
caller.call("reg", {saddr, "0x7"}, -1, PUT);
|
||||||
caller.call("clearbit", {saddr, "1"}, -1, PUT, oss1);
|
caller.call("clearbit", {saddr, "1"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "clearbit [" + saddr + ", 1]\n");
|
REQUIRE(oss1.str() == "clearbit [" + saddr + ", 1]\n");
|
||||||
caller.call("reg", {saddr}, -1, GET, oss2);
|
caller.call("clearbit", {saddr, "2", "--validate"}, -1, PUT, oss2);
|
||||||
REQUIRE(oss2.str() == "reg 0x1\n");
|
REQUIRE(oss2.str() == "clearbit [" + saddr + ", 2]\n");
|
||||||
|
caller.call("reg", {saddr}, -1, GET, oss3);
|
||||||
|
REQUIRE(oss3.str() == "reg 0x1\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.writeRegister(addr, prev_val[i], {i});
|
det.writeRegister(addr, prev_val[i], false, {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3339,7 +3350,7 @@ TEST_CASE("CALLER::getbit", "[.cmdcall]") {
|
|||||||
REQUIRE(oss1.str() == "getbit 1\n");
|
REQUIRE(oss1.str() == "getbit 1\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.writeRegister(addr, prev_val[i], {i});
|
det.writeRegister(addr, prev_val[i], false, {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cannot check for eiger virtual server
|
// cannot check for eiger virtual server
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
#define RELEASE "developer"
|
#define RELEASE "developer"
|
||||||
#define APILIB "developer 0x230224"
|
#define APILIB "developer 0x230224"
|
||||||
#define APIRECEIVER "developer 0x230224"
|
#define APIRECEIVER "developer 0x230224"
|
||||||
#define APICTB "developer 0x240910"
|
#define APICTB "developer 0x240918"
|
||||||
#define APIGOTTHARD "developer 0x240910"
|
#define APIGOTTHARD "developer 0x240918"
|
||||||
#define APIGOTTHARD2 "developer 0x240910"
|
#define APIGOTTHARD2 "developer 0x240918"
|
||||||
#define APIJUNGFRAU "developer 0x240910"
|
#define APIJUNGFRAU "developer 0x240918"
|
||||||
#define APIMYTHEN3 "developer 0x240910"
|
#define APIMYTHEN3 "developer 0x240918"
|
||||||
#define APIMOENCH "developer 0x240910"
|
#define APIMOENCH "developer 0x240918"
|
||||||
#define APIXILINXCTB "developer 0x240910"
|
#define APIXILINXCTB "developer 0x240918"
|
||||||
#define APIEIGER "developer 0x240910"
|
#define APIEIGER "developer 0x240918"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user