mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 18:40:01 +02:00
2. Patioctrl uint64 t (#766)
* when dbit list is enabled, the size of data in zmq stream is changed to only the digital bits enabled size. now fixed to also include analog size * allowing to set 0xffffffffffffffff to pat io control. prevously was used to do a get. fixed also for pat bit mask and pat mask
This commit is contained in:
parent
6f50707cfb
commit
3f9ec695db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -97,6 +97,7 @@ int enable_ten_giga(int);
|
||||
int validateAndSetAllTrimbits(int arg);
|
||||
int set_all_trimbits(int);
|
||||
int set_pattern_io_control(int);
|
||||
int get_pattern_io_control(int);
|
||||
int set_pattern_word(int);
|
||||
int set_pattern_loop_addresses(int);
|
||||
int set_pattern_loop_cycles(int);
|
||||
|
@ -23,6 +23,8 @@ extern void bus_w(u_int32_t offset, u_int32_t data);
|
||||
extern u_int32_t bus_r(u_int32_t offset);
|
||||
extern int64_t get64BitReg(int aLSB, int aMSB);
|
||||
extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||
extern uint64_t getU64BitReg(int aLSB, int aMSB);
|
||||
extern void setU64BitReg(uint64_t value, int aLSB, int aMSB);
|
||||
|
||||
#ifdef MYTHEN3D
|
||||
#define MAX_LEVELS M3_MAX_PATTERN_LEVELS
|
||||
@ -48,7 +50,7 @@ void initializePatternWord() {
|
||||
#endif
|
||||
|
||||
uint64_t validate_readPatternIOControl() {
|
||||
return get64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
}
|
||||
|
||||
int validate_writePatternIOControl(char *message, uint64_t arg) {
|
||||
@ -59,14 +61,21 @@ int validate_writePatternIOControl(char *message, uint64_t arg) {
|
||||
LOG(logDEBUG1,
|
||||
("Pattern IO Control retval: 0x%llx\n", (long long int)retval));
|
||||
int ret = OK;
|
||||
validate64(&ret, message, arg, retval, "set pattern IO Control", HEX);
|
||||
if (retval != arg) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
message,
|
||||
"Could not set pattern IO Control. Set 0x%llx, but read 0x%llx\n",
|
||||
(long long unsigned int)arg, (long long unsigned int)retval);
|
||||
LOG(logERROR, (message));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void writePatternIOControl(uint64_t word) {
|
||||
LOG(logINFO,
|
||||
("Setting Pattern I/O Control: 0x%llx\n", (long long int)word));
|
||||
set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -710,20 +719,20 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
|
||||
|
||||
void setPatternMask(uint64_t mask) {
|
||||
LOG(logINFO, ("Setting pattern mask to 0x%llx\n", mask));
|
||||
set64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||
setU64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||
}
|
||||
|
||||
uint64_t getPatternMask() {
|
||||
return get64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||
return getU64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||
}
|
||||
|
||||
void setPatternBitMask(uint64_t mask) {
|
||||
LOG(logINFO, ("Setting pattern bit mask to 0x%llx\n", mask));
|
||||
set64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||
setU64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||
}
|
||||
|
||||
uint64_t getPatternBitMask() {
|
||||
return get64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||
return getU64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||
}
|
||||
|
||||
#ifdef MYTHEN3D
|
||||
|
@ -272,6 +272,7 @@ void function_table() {
|
||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||
flist[F_GET_PATTERN_IO_CONTROL] = &get_pattern_io_control;
|
||||
flist[F_SET_PATTERN_WORD] = &set_pattern_word;
|
||||
flist[F_SET_PATTERN_LOOP_ADDRESSES] = &set_pattern_loop_addresses;
|
||||
flist[F_SET_PATTERN_LOOP_CYCLES] = &set_pattern_loop_cycles;
|
||||
@ -3154,7 +3155,6 @@ int set_pattern_io_control(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = -1;
|
||||
uint64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
@ -3163,14 +3163,25 @@ int set_pattern_io_control(int file_des) {
|
||||
#else
|
||||
LOG(logDEBUG1,
|
||||
("Setting Pattern IO Control to 0x%llx\n", (long long int)arg));
|
||||
if (((int64_t)arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
||||
if ((int64_t)arg != GET_FLAG) {
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = validate_writePatternIOControl(mess, arg);
|
||||
}
|
||||
retval = validate_readPatternIOControl();
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
return Server_SendResult(file_des, INT64, NULL, 0);
|
||||
}
|
||||
|
||||
int get_pattern_io_control(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t retval64 = -1;
|
||||
|
||||
#if !defined(CHIPTESTBOARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
LOG(logDEBUG1, ("Getting Pattern IO Control\n"));
|
||||
retval64 = validate_readPatternIOControl();
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, &retval64, sizeof(retval64));
|
||||
}
|
||||
|
||||
int set_pattern_word(int file_des) {
|
||||
@ -3352,7 +3363,13 @@ int set_pattern_mask(int file_des) {
|
||||
uint64_t retval64 = getPatternMask();
|
||||
LOG(logDEBUG1,
|
||||
("Pattern mask: 0x%llx\n", (long long unsigned int)retval64));
|
||||
validate64(&ret, mess, arg, retval64, "set Pattern Mask", HEX);
|
||||
if (retval64 != arg) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess, "Could not pattern mask. Set 0x%llx, but read 0x%llx\n",
|
||||
(long long unsigned int)arg, (long long unsigned int)retval64);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
@ -3395,7 +3412,14 @@ int set_pattern_bit_mask(int file_des) {
|
||||
uint64_t retval64 = getPatternBitMask();
|
||||
LOG(logDEBUG1,
|
||||
("Pattern bit mask: 0x%llx\n", (long long unsigned int)retval64));
|
||||
validate64(&ret, mess, arg, retval64, "set Pattern Bit Mask", HEX);
|
||||
if (retval64 != arg) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not pattern bit mask. Set 0x%llx, but read 0x%llx\n",
|
||||
(long long unsigned int)arg,
|
||||
(long long unsigned int)retval64);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
|
@ -2492,12 +2492,11 @@ Pattern Module::getPattern() {
|
||||
void Module::loadDefaultPattern() { sendToDetector(F_LOAD_DEFAULT_PATTERN); }
|
||||
|
||||
uint64_t Module::getPatternIOControl() const {
|
||||
return sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL,
|
||||
int64_t(GET_FLAG));
|
||||
return sendToDetector<uint64_t>(F_GET_PATTERN_IO_CONTROL);
|
||||
}
|
||||
|
||||
void Module::setPatternIOControl(uint64_t word) {
|
||||
sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL, word);
|
||||
sendToDetector(F_SET_PATTERN_IO_CONTROL, word, nullptr);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternWord(int addr) const {
|
||||
|
@ -280,6 +280,7 @@ enum detFuncs {
|
||||
F_GET_BIT,
|
||||
F_SET_BIT,
|
||||
F_CLEAR_BIT,
|
||||
F_GET_PATTERN_IO_CONTROL,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 512, /**< detector function should not exceed this
|
||||
@ -663,6 +664,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_BIT: return "F_GET_BIT";
|
||||
case F_SET_BIT: return "F_SET_BIT";
|
||||
case F_CLEAR_BIT: return "F_CLEAR_BIT";
|
||||
case F_GET_PATTERN_IO_CONTROL: return "F_GET_PATTERN_IO_CONTROL";
|
||||
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
|
@ -4,10 +4,10 @@
|
||||
#define RELEASE "developer"
|
||||
#define APILIB "developer 0x230224"
|
||||
#define APIRECEIVER "developer 0x230224"
|
||||
#define APIGOTTHARD "developer 0x230525"
|
||||
#define APIGOTTHARD2 "developer 0x230525"
|
||||
#define APIMYTHEN3 "developer 0x230525"
|
||||
#define APIMOENCH "developer 0x230525"
|
||||
#define APIEIGER "developer 0x230525"
|
||||
#define APIJUNGFRAU "developer 0x230525"
|
||||
#define APICTB "developer 0x230605"
|
||||
#define APICTB "developer 0x230615"
|
||||
#define APIGOTTHARD "developer 0x230615"
|
||||
#define APIGOTTHARD2 "developer 0x230615"
|
||||
#define APIJUNGFRAU "developer 0x230615"
|
||||
#define APIMYTHEN3 "developer 0x230615"
|
||||
#define APIMOENCH "developer 0x230615"
|
||||
|
Loading…
x
Reference in New Issue
Block a user