mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 09:00:41 +02:00
M3defaultpattern (#227)
* default pattern for m3 and moench including Python bindings Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
parent
85bc37f04d
commit
a62e068a9a
@ -1278,6 +1278,10 @@ void init_det(py::module &m) {
|
||||
.def("savePattern",
|
||||
(void (Detector::*)(const std::string &)) & Detector::savePattern,
|
||||
py::arg())
|
||||
.def("loadDefaultPattern",
|
||||
(void (Detector::*)(sls::Positions)) &
|
||||
Detector::loadDefaultPattern,
|
||||
py::arg() = Positions{})
|
||||
.def("getPatternIOControl",
|
||||
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getPatternIOControl,
|
||||
|
Binary file not shown.
@ -409,9 +409,9 @@ void setupDetector() {
|
||||
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
|
||||
PLL_RESET_REG, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
PLL_RESET_REG, PLL_RESET_READOUT_MSK,
|
||||
PLL_RESET_SYSTEM_MSK, READOUT_PLL_VCO_FREQ_HZ,
|
||||
SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL);
|
||||
// hv
|
||||
|
Binary file not shown.
@ -550,7 +550,9 @@ void setupDetector() {
|
||||
initError = FAIL;
|
||||
}
|
||||
setPipeline(ADC_CLK, DEFAULT_PIPELINE);
|
||||
loadDefaultPattern(DEFAULT_PATTERN_FILE);
|
||||
if (initError != FAIL) {
|
||||
initError = loadDefaultPattern(DEFAULT_PATTERN_FILE, initErrorMessage);
|
||||
}
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
setFrequency(RUN_CLK, DEFAULT_RUN_CLK);
|
||||
|
@ -103,7 +103,12 @@
|
||||
/* Look at me register, read only */
|
||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL) // Not used in firmware or software, good to play with
|
||||
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define SYSTEM_STATUS_R_PLL_LCKD_OFST (1)
|
||||
#define SYSTEM_STATUS_R_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_R_PLL_LCKD_OFST)
|
||||
#define SYSTEM_STATUS_RDO_PLL_LCKD_OFST (2)
|
||||
#define SYSTEM_STATUS_RDO_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_RDO_PLL_LCKD_OFST)
|
||||
|
||||
/* Config RW regiseter */
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
@ -483,6 +488,14 @@
|
||||
/* ASIC Readout Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
/** ASIC Readout Status register */
|
||||
#define ASIC_RDO_STATUS_REG (0x00 * REG_OFFSET + BASE_ASIC_RDO)
|
||||
|
||||
#define ASIC_RDO_STATUS_BUSY_OFST (1)
|
||||
#define ASIC_RDO_STATUS_BUSY_MSK (0x00000001 << ASIC_RDO_STATUS_BUSY_OFST)
|
||||
|
||||
|
||||
/** ASIC Readout Res Storage Counter register */
|
||||
#define ASIC_RDO_CONFIG_REG (0x01 * REG_OFFSET + BASE_ASIC_RDO)
|
||||
|
||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
|
||||
|
Binary file not shown.
@ -401,10 +401,11 @@ void setupDetector() {
|
||||
#endif
|
||||
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
|
||||
PLL_RESET_REG, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_SetDefines(
|
||||
REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK, SYSTEM_STATUS_REG,
|
||||
SYSTEM_STATUS_RDO_PLL_LCKD_MSK, SYSTEM_STATUS_R_PLL_LCKD_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL);
|
||||
// hv
|
||||
@ -482,7 +483,9 @@ void setupDetector() {
|
||||
}
|
||||
|
||||
powerChip(1);
|
||||
loadDefaultPattern(DEFAULT_PATTERN_FILE);
|
||||
if (initError != FAIL) {
|
||||
initError = loadDefaultPattern(DEFAULT_PATTERN_FILE, initErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
@ -2420,8 +2423,12 @@ int startReadOut() {
|
||||
|
||||
// start readout
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_READOUT_MSK);
|
||||
|
||||
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||
usleep(1);
|
||||
while (bus_r(ASIC_RDO_STATUS_REG) & ASIC_RDO_STATUS_BUSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
LOG(logINFOBLUE, ("Readout done\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,13 @@
|
||||
* @param vcofreq1 vco frequency of pll 1
|
||||
*/
|
||||
void ALTERA_PLL_C10_SetDefines(int regofst, uint32_t baseaddr0,
|
||||
uint32_t baseaddr1, uint32_t resetreg0,
|
||||
uint32_t resetreg1, uint32_t resetmsk0,
|
||||
uint32_t resetmsk1, int vcofreq0, int vcofreq1);
|
||||
uint32_t baseaddr1, uint32_t resetreg,
|
||||
uint32_t resetmsk0, uint32_t resetmsk1,
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg, uint32_t statusmsk0,
|
||||
uint32_t statusmsk1,
|
||||
#endif
|
||||
int vcofreq0, int vcofreq1);
|
||||
|
||||
/**
|
||||
* Get Max Clock Divider
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int loadDefaultPattern(char *patFname);
|
||||
int loadDefaultPattern(char *patFname, char *errMessage);
|
||||
|
||||
int default_writePatternWord(char *line, uint32_t addr, uint64_t word);
|
||||
|
||||
|
@ -243,4 +243,5 @@ int get_bursts_left(int);
|
||||
int start_readout(int);
|
||||
int set_default_dacs(int);
|
||||
int is_virtual(int);
|
||||
int get_pattern(int);
|
||||
int get_pattern(int);
|
||||
int load_default_pattern(int);
|
@ -56,21 +56,35 @@
|
||||
int ALTERA_PLL_C10_Reg_offset = 0x0;
|
||||
const int ALTERA_PLL_C10_NUM = 2;
|
||||
uint32_t ALTERA_PLL_C10_BaseAddress[2] = {0x0, 0x0};
|
||||
uint32_t ALTERA_PLL_C10_Reset_Reg[2] = {0x0, 0x0};
|
||||
uint32_t ALTERA_PLL_C10_Reset_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_C10_Reset_Msk[2] = {0x0, 0x0};
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t ALTERA_PLL_C10_Locked_Status_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_C10_Locked_Status_Msk[2] = {0x0, 0x0};
|
||||
#endif
|
||||
int ALTERA_PLL_C10_VCO_FREQ[2] = {0, 0};
|
||||
|
||||
void ALTERA_PLL_C10_SetDefines(int regofst, uint32_t baseaddr0,
|
||||
uint32_t baseaddr1, uint32_t resetreg0,
|
||||
uint32_t resetreg1, uint32_t resetmsk0,
|
||||
uint32_t resetmsk1, int vcofreq0, int vcofreq1) {
|
||||
uint32_t baseaddr1, uint32_t resetreg,
|
||||
uint32_t resetmsk0, uint32_t resetmsk1,
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg, uint32_t statusmsk0,
|
||||
uint32_t statusmsk1,
|
||||
#endif
|
||||
int vcofreq0, int vcofreq1) {
|
||||
ALTERA_PLL_C10_Reg_offset = regofst;
|
||||
ALTERA_PLL_C10_BaseAddress[0] = baseaddr0;
|
||||
ALTERA_PLL_C10_BaseAddress[1] = baseaddr1;
|
||||
ALTERA_PLL_C10_Reset_Reg[0] = resetreg0;
|
||||
ALTERA_PLL_C10_Reset_Reg[1] = resetreg1;
|
||||
ALTERA_PLL_C10_Reset_Reg = resetreg;
|
||||
ALTERA_PLL_C10_Reset_Msk[0] = resetmsk0;
|
||||
ALTERA_PLL_C10_Reset_Msk[1] = resetmsk1;
|
||||
|
||||
// pll locked status reg and msk only used for m3 now
|
||||
#ifdef MYTHEN3D
|
||||
ALTERA_PLL_C10_Locked_Status_Reg = statusreg;
|
||||
ALTERA_PLL_C10_Locked_Status_Msk[0] = statusmsk0;
|
||||
ALTERA_PLL_C10_Locked_Status_Msk[1] = statusmsk1;
|
||||
#endif
|
||||
ALTERA_PLL_C10_VCO_FREQ[0] = vcofreq0;
|
||||
ALTERA_PLL_C10_VCO_FREQ[1] = vcofreq1;
|
||||
}
|
||||
@ -98,12 +112,24 @@ void ALTERA_PLL_C10_Reconfigure(int pllIndex) {
|
||||
}
|
||||
|
||||
void ALTERA_PLL_C10_ResetPLL(int pllIndex) {
|
||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg;
|
||||
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
||||
LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
||||
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
||||
|
||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||
|
||||
#ifndef VIRTUAL
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg = ALTERA_PLL_C10_Locked_Status_Reg;
|
||||
uint32_t statusmsk = ALTERA_PLL_C10_Locked_Status_Msk[pllIndex];
|
||||
// wait for pll locked bit to go high
|
||||
while (!(bus_r(statusreg) & statusmsk)) {
|
||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||
LOG(logWARNING, ("Still waiting for PLL %d recovery\n", pllIndex));
|
||||
}
|
||||
LOG(logINFO, ("Reset success for PLL %d\n", pllIndex));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ALTERA_PLL_C10_SetPhaseShift(int pllIndex, int clkIndex, int phase,
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <string.h>
|
||||
|
||||
extern char initErrorMessage[MAX_STR_LENGTH];
|
||||
extern int initError;
|
||||
|
||||
#ifndef MYTHEN3D
|
||||
extern uint64_t writePatternIOControl(uint64_t word);
|
||||
@ -19,11 +18,7 @@ extern uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||
extern void setPatternLoop(int level, int *startAddr, int *stopAddr,
|
||||
int *nLoop);
|
||||
|
||||
int loadDefaultPattern(char *patFname) {
|
||||
if (initError == FAIL) {
|
||||
return initError;
|
||||
}
|
||||
|
||||
int loadDefaultPattern(char *patFname, char *errMessage) {
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, patFname) == FAIL) {
|
||||
return FAIL;
|
||||
@ -32,10 +27,8 @@ int loadDefaultPattern(char *patFname) {
|
||||
// open config file
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
sprintf(initErrorMessage, "Could not open pattern file [%s].\n",
|
||||
patFname);
|
||||
initError = FAIL;
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
sprintf(errMessage, "Could not open pattern file [%s].\n", patFname);
|
||||
LOG(logERROR, ("%s\n\n", errMessage));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Reading default pattern file %s\n", patFname));
|
||||
@ -100,7 +93,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s 0x%x 0x%llx", command, &addr, &word) != 3) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patword arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -123,7 +116,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patioctrl arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -144,7 +137,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patlimits arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -177,7 +170,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patloop%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -208,7 +201,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
int numLoops = -1;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patnloop%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -238,7 +231,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
uint32_t addr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patwait%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -273,7 +266,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patwaittime%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -289,13 +282,12 @@ int loadDefaultPattern(char *patFname) {
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
if (strlen(initErrorMessage)) {
|
||||
initError = FAIL;
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
} else {
|
||||
LOG(logINFOBLUE, ("Successfully read default pattern file\n"));
|
||||
if (strlen(errMessage)) {
|
||||
LOG(logERROR, ("%s\n\n", errMessage));
|
||||
return FAIL;
|
||||
}
|
||||
return initError;
|
||||
LOG(logINFOBLUE, ("Successfully read default pattern file\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int default_writePatternWord(char *line, uint32_t addr, uint64_t word) {
|
||||
|
@ -366,6 +366,7 @@ void function_table() {
|
||||
flist[F_SET_DEFAULT_DACS] = &set_default_dacs;
|
||||
flist[F_IS_VIRTUAL] = &is_virtual;
|
||||
flist[F_GET_PATTERN] = &get_pattern;
|
||||
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -8297,3 +8298,20 @@ int is_virtual(int file_des) {
|
||||
LOG(logDEBUG1, ("is virtual retval: %d\n", retval));
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int load_default_pattern(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
#if !defined(MYTHEN3D) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = loadDefaultPattern(DEFAULT_PATTERN_FILE, mess);
|
||||
if (ret == FAIL) {
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
#include "sls/Pattern.h"
|
||||
#include "sls/Result.h"
|
||||
#include "sls/network_utils.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#include "sls/Pattern.h"
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -16,7 +16,6 @@ class DetectorImpl;
|
||||
class MacAddr;
|
||||
class IpAddr;
|
||||
|
||||
|
||||
// Free function to avoid dependence on class
|
||||
// and avoid the option to free another objects
|
||||
// shm by mistake
|
||||
@ -1461,12 +1460,15 @@ class Detector {
|
||||
|
||||
/** [CTB][Moench][Mythen3] Loads pattern parameters structure directly to
|
||||
* server */
|
||||
void setPattern(const Pattern& pat, Positions pos = {});
|
||||
void setPattern(const Pattern &pat, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] [Ctb][Moench][Mythen3] Saves pattern to file
|
||||
* (ascii). \n [Ctb][Moench] Also executes pattern.*/
|
||||
void savePattern(const std::string &fname);
|
||||
|
||||
/** [Mythen3][Moench] Loads and runs default pattern */
|
||||
void loadDefaultPattern(Positions pos = {});
|
||||
|
||||
/** [CTB][Moench] */
|
||||
Result<uint64_t> getPatternIOControl(Positions pos = {}) const;
|
||||
|
||||
|
@ -1014,6 +1014,7 @@ class CmdProxy {
|
||||
/* Pattern */
|
||||
{"pattern", &CmdProxy::Pattern},
|
||||
{"savepattern", &CmdProxy::savepattern},
|
||||
{"defaultpattern", &CmdProxy::defaultpattern},
|
||||
{"patioctrl", &CmdProxy::patioctrl},
|
||||
{"patword", &CmdProxy::PatternWord},
|
||||
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||
@ -2063,6 +2064,11 @@ class CmdProxy {
|
||||
"[fname]\n\t[Ctb][Moench][Mythen3] Saves pattern to file (ascii). "
|
||||
"\n\t[Ctb][Moench] Also executes pattern.");
|
||||
|
||||
EXECUTE_SET_COMMAND(
|
||||
defaultpattern, loadDefaultPattern,
|
||||
"\n\t[Mythen3][Moench] Loads and runs default pattern in pattern "
|
||||
"generator. It is to go back to initial settings.");
|
||||
|
||||
INTEGER_COMMAND_HEX_WIDTH16(patioctrl, getPatternIOControl,
|
||||
setPatternIOControl, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
|
@ -1754,13 +1754,6 @@ void Detector::setLEDEnable(bool enable, Positions pos) {
|
||||
|
||||
// Pattern
|
||||
|
||||
void Detector::savePattern(const std::string &fname) {
|
||||
auto t = pimpl->Parallel(&Module::getPattern, {});
|
||||
auto pat = t.tsquash("Inconsistent pattern parameters between modules");
|
||||
pat.validate();
|
||||
pat.save(fname);
|
||||
}
|
||||
|
||||
void Detector::setPattern(const std::string &fname, Positions pos) {
|
||||
Pattern pat;
|
||||
pat.load(fname);
|
||||
@ -1773,6 +1766,17 @@ void Detector::setPattern(const Pattern &pat, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPattern, pos, pat);
|
||||
}
|
||||
|
||||
void Detector::savePattern(const std::string &fname) {
|
||||
auto t = pimpl->Parallel(&Module::getPattern, {});
|
||||
auto pat = t.tsquash("Inconsistent pattern parameters between modules");
|
||||
pat.validate();
|
||||
pat.save(fname);
|
||||
}
|
||||
|
||||
void Detector::loadDefaultPattern(Positions pos) {
|
||||
pimpl->Parallel(&Module::loadDefaultPattern, pos);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternIOControl(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPatternIOControl, pos);
|
||||
}
|
||||
|
@ -1923,6 +1923,8 @@ Pattern Module::getPattern() {
|
||||
return pat;
|
||||
}
|
||||
|
||||
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));
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "SharedMemory.h"
|
||||
#include "sls/ClientSocket.h"
|
||||
#include "sls/Pattern.h"
|
||||
#include "sls/StaticVector.h"
|
||||
#include "sls/logger.h"
|
||||
#include "sls/network_utils.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#include "sls/Pattern.h"
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
@ -463,8 +463,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
* Pattern *
|
||||
* *
|
||||
* ************************************************/
|
||||
void setPattern(const Pattern& pat);
|
||||
void setPattern(const Pattern &pat);
|
||||
Pattern getPattern();
|
||||
void loadDefaultPattern();
|
||||
uint64_t getPatternIOControl() const;
|
||||
void setPatternIOControl(uint64_t word);
|
||||
uint64_t getPatternWord(int addr) const;
|
||||
|
@ -46,6 +46,19 @@ TEST_CASE("savepattern", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("defaultpattern", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH || det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patioctrl", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -218,6 +218,7 @@ enum detFuncs {
|
||||
F_SET_DEFAULT_DACS,
|
||||
F_IS_VIRTUAL,
|
||||
F_GET_PATTERN,
|
||||
F_LOAD_DEFAULT_PATTERN,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -541,6 +542,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_DEFAULT_DACS: return "F_SET_DEFAULT_DACS";
|
||||
case F_IS_VIRTUAL: return "F_IS_VIRTUAL";
|
||||
case F_GET_PATTERN: return "F_GET_PATTERN";
|
||||
case F_LOAD_DEFAULT_PATTERN: return "F_LOAD_DEFAULT_PATTERN";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -5,8 +5,8 @@
|
||||
#define APIGUI 0x201119
|
||||
#define APICTB 0x201130
|
||||
#define APIGOTTHARD 0x201130
|
||||
#define APIGOTTHARD2 0x201130
|
||||
#define APIJUNGFRAU 0x201130
|
||||
#define APIMYTHEN3 0x201130
|
||||
#define APIMOENCH 0x201130
|
||||
#define APIEIGER 0x201130
|
||||
#define APIGOTTHARD2 0x201208
|
||||
#define APIMOENCH 0x201207
|
||||
#define APIMYTHEN3 0x201209
|
||||
|
Loading…
x
Reference in New Issue
Block a user