read back of csr

This commit is contained in:
Erik Frojdh 2021-03-26 17:46:11 +01:00
parent a2007b78e7
commit 7c4f9ee044
12 changed files with 52 additions and 7 deletions

View File

@ -49,13 +49,13 @@ args = parser.parse_args()
servers = [
"eigerDetectorServer",
"jungfrauDetectorServer",
# "eigerDetectorServer",
# "jungfrauDetectorServer",
"mythen3DetectorServer",
"gotthard2DetectorServer",
"gotthardDetectorServer",
"ctbDetectorServer",
"moenchDetectorServer",
# "gotthard2DetectorServer",
# "gotthardDetectorServer",
# "ctbDetectorServer",
# "moenchDetectorServer",
]

View File

@ -1136,6 +1136,10 @@ void init_det(py::module &m) {
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getMaster,
py::arg() = Positions{})
.def("getChipStatusRegister",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getChipStatusRegister,
py::arg() = Positions{})
.def("getNumberOfAnalogSamples",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getNumberOfAnalogSamples,

View File

@ -31,6 +31,10 @@ int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }
extern enum TLogLevel trimmingPrint ;
int getChipStatusRegister(){
return chipStatusRegister;
}
patternParameters *setChipStatusRegister(int csr) {
int iaddr=0;
int nbits=18;

View File

@ -57,6 +57,7 @@ enum {Cac225, Cac_450};
#define default_gain
int setBit(int ibit, int patword);
int clearBit(int ibit, int patword);
int getChipStatusRegister();
patternParameters *setChipStatusRegister(int csr);
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits);
patternParameters *setInterpolation(int mask);

View File

@ -25,6 +25,10 @@
#include "blackfin.h"
#endif
#if defined(MYTHEN3D)
#include "mythen3.h"
#endif
#include <stdio.h> // FILE
#include <stdlib.h>
#include <sys/types.h>

View File

@ -246,4 +246,5 @@ int is_virtual(int);
int get_pattern(int);
int load_default_pattern(int);
int get_all_threshold_energy(int);
int get_master(int);
int get_master(int);
int get_csr();

View File

@ -369,6 +369,7 @@ void function_table() {
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
flist[F_GET_ALL_THRESHOLD_ENERGY] = &get_all_threshold_energy;
flist[F_GET_MASTER] = &get_master;
flist[F_GET_CSR] = &get_csr;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -8388,3 +8389,19 @@ int get_master(int file_des){
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int get_csr(int file_des){
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting csr\n"));
#ifndef MYTHEN3D
functionNotImplemented();
#else
retval = getChipStatusRegister();
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}

View File

@ -1308,6 +1308,10 @@ class Detector {
Result<bool> getMaster(Positions pos = {}) const;
//TODO! check if we really want to expose this !!!!!
Result<int> getChipStatusRegister(Positions pos = {}) const;
///@{
/** @name CTB / Moench Specific */

View File

@ -1615,6 +1615,10 @@ Result<bool> Detector::getMaster(Positions pos) const{
return pimpl->Parallel(&Module::isMaster, pos);
}
Result<int> Detector::getChipStatusRegister(Positions pos) const{
return pimpl->Parallel(&Module::getChipStatusRegister, pos);
}
// CTB/ Moench Specific

View File

@ -1998,6 +1998,10 @@ bool Module::isMaster() const{
return sendToDetector<int>(F_GET_MASTER);
}
int Module::getChipStatusRegister() const{
return sendToDetector<int>(F_GET_CSR);
}
// CTB / Moench Specific
int Module::getNumberOfAnalogSamples() const {
return sendToDetector<int>(F_GET_NUM_ANALOG_SAMPLES);

View File

@ -426,6 +426,7 @@ class Module : public virtual slsDetectorDefs {
void setGateDelay(int gateIndex, int64_t value);
std::array<time::ns, 3> getGateDelayForAllGates() const;
bool isMaster() const;
int getChipStatusRegister() const;
/**************************************************
* *

View File

@ -221,6 +221,7 @@ enum detFuncs {
F_LOAD_DEFAULT_PATTERN,
F_GET_ALL_THRESHOLD_ENERGY,
F_GET_MASTER,
F_GET_CSR,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this