mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
moench and eiger updated as well
This commit is contained in:
commit
e3f9ef0b25
@ -4,13 +4,14 @@ if [ $# -eq 0 ]; then
|
||||
"gotthard2DetectorServer"
|
||||
"jungfrauDetectorServer"
|
||||
"mythen3DetectorServer"
|
||||
"moenchDetectorServer"
|
||||
)
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo "got something"
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK")
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
do
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -219,6 +219,8 @@
|
||||
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_PLL_RST_OFST (3)
|
||||
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_OFST (5)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_DBIT_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_ADDR_OFST (16)
|
||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||
|
||||
|
Binary file not shown.
@ -38,7 +38,7 @@ int virtual_stop = 0;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int highvoltage = 0;
|
||||
int dacValues[NDAC] = {};
|
||||
int adcPhase = 0;
|
||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
int detPos[4] = {};
|
||||
int numUDPInterfaces = 1;
|
||||
|
||||
@ -366,7 +366,12 @@ void initStopServer() {
|
||||
void setupDetector() {
|
||||
FILE_LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n"));
|
||||
|
||||
adcPhase = 0;
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
}
|
||||
ALTERA_PLL_ResetPLL();
|
||||
resetCore();
|
||||
resetPeripheral();
|
||||
@ -389,7 +394,7 @@ void setupDetector() {
|
||||
setDefaultDacs();
|
||||
|
||||
// altera pll
|
||||
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG, PLL_CNTRL_RCNFG_PRMTR_RST_MSK, PLL_CNTRL_WR_PRMTR_MSK, PLL_CNTRL_PLL_RST_MSK, PLL_CNTRL_ADDR_MSK, PLL_CNTRL_ADDR_OFST);
|
||||
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG, PLL_CNTRL_RCNFG_PRMTR_RST_MSK, PLL_CNTRL_WR_PRMTR_MSK, PLL_CNTRL_PLL_RST_MSK, PLL_CNTRL_ADDR_MSK, PLL_CNTRL_ADDR_OFST, PLL_CNTRL_DBIT_WR_PRMTR_MSK, DBIT_CLK_INDEX);
|
||||
|
||||
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
|
||||
|
||||
@ -1390,12 +1395,13 @@ int getClockDivider(enum CLKINDEX ind) {
|
||||
}
|
||||
|
||||
int setPhase(enum CLKINDEX ind, int val, int degrees){
|
||||
if (ind != ADC_CLK) {
|
||||
if (ind != ADC_CLK && ind != DBIT_CLK) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind));
|
||||
return FAIL;
|
||||
}
|
||||
char* clock_names[] = {CLK_NAMES};
|
||||
FILE_LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees"));
|
||||
int maxShift = MAX_PHASE_SHIFTS;
|
||||
|
||||
// validation
|
||||
if (degrees && (val < 0 || val > 359)) {
|
||||
FILE_LOG(logERROR, ("\tPhase provided outside limits (0 - 359°C)\n"));
|
||||
@ -1406,7 +1412,6 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("Setting ADC Phase to %d (degree mode: %d)\n", val, degrees));
|
||||
int valShift = val;
|
||||
// convert to phase shift
|
||||
if (degrees) {
|
||||
@ -1414,14 +1419,15 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val));
|
||||
|
||||
int relativePhase = valShift - adcPhase;
|
||||
FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, adcPhase));
|
||||
int relativePhase = valShift - clkPhase[ind];
|
||||
FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind]));
|
||||
|
||||
// same phase
|
||||
if (!relativePhase) {
|
||||
FILE_LOG(logINFO, ("Nothing to do in Phase Shift\n"));
|
||||
return OK;
|
||||
}
|
||||
FILE_LOG(logINFOBLUE, ("Configuring Phase\n"));
|
||||
|
||||
int phase = 0;
|
||||
if (relativePhase > 0) {
|
||||
@ -1431,29 +1437,29 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift));
|
||||
|
||||
ALTERA_PLL_SetPhaseShift(phase, 1, 0);
|
||||
ALTERA_PLL_SetPhaseShift(phase, (ind == ADC_CLK ? ADC_CLK_INDEX : DBIT_CLK_INDEX), 0);
|
||||
|
||||
adcPhase = valShift;
|
||||
clkPhase[ind] = valShift;
|
||||
|
||||
alignDeserializer();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getPhase(enum CLKINDEX ind, int degrees) {
|
||||
if (ind != ADC_CLK) {
|
||||
if (ind != ADC_CLK && ind != DBIT_CLK) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind));
|
||||
return -1;
|
||||
}
|
||||
if (!degrees)
|
||||
return adcPhase;
|
||||
return clkPhase[ind];
|
||||
// convert back to degrees
|
||||
int val = 0;
|
||||
ConvertToDifferentRange(0, MAX_PHASE_SHIFTS - 1, 0, 359, adcPhase, &val);
|
||||
ConvertToDifferentRange(0, MAX_PHASE_SHIFTS - 1, 0, 359, clkPhase[ind], &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int getMaxPhase(enum CLKINDEX ind) {
|
||||
if (ind != ADC_CLK) {
|
||||
if (ind != ADC_CLK && ind != DBIT_CLK) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind));
|
||||
return -1;
|
||||
}
|
||||
@ -1461,7 +1467,7 @@ int getMaxPhase(enum CLKINDEX ind) {
|
||||
}
|
||||
|
||||
int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) {
|
||||
if (ind != ADC_CLK) {
|
||||
if (ind != ADC_CLK && ind != DBIT_CLK) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind));
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x190716
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x200304
|
||||
#define REQRD_FRMWRE_VRSN 0x190708
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
@ -50,8 +50,8 @@ enum DACINDEX {J_VB_COMP, J_VDD_PROT, J_VIN_COM, J_VREF_PRECH, J_VB_PIXBUF, J
|
||||
420 /* J_VREF_COMP */ \
|
||||
};
|
||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||
enum CLKINDEX {RUN_CLK, ADC_CLK, NUM_CLOCKS};
|
||||
#define CLK_NAMES "run", "adc"
|
||||
enum CLKINDEX {RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS};
|
||||
#define CLK_NAMES "run", "adc", "dbit"
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (256 * 256)
|
||||
@ -63,6 +63,8 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, NUM_CLOCKS};
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
||||
#define CLK_RUN (40) /* MHz */
|
||||
#define CLK_SYNC (20) /* MHz */
|
||||
#define ADC_CLK_INDEX (1)
|
||||
#define DBIT_CLK_INDEX (0)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_NUM_FRAMES (100*1000*1000)
|
||||
|
Binary file not shown.
@ -2,6 +2,21 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef JUNGFRAUD
|
||||
/**
|
||||
* Set Defines
|
||||
* @param creg control register
|
||||
* @param preg parameter register
|
||||
* @param rprmsk reconfig parameter reset mask
|
||||
* @param wpmsk write parameter mask
|
||||
* @param prmsk pll reset mask
|
||||
* @param amsk address mask
|
||||
* @param aofst address offset
|
||||
* @param wd2msk write parameter mask for pll for dbit clock (Jungfrau only)
|
||||
* @param clk2Index clkIndex of second pll (Jungfrau only)
|
||||
*/
|
||||
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, int aofst, uint32_t wd2msk, int clk2Index);
|
||||
#else
|
||||
/**
|
||||
* Set Defines
|
||||
* @param creg control register
|
||||
@ -13,6 +28,7 @@
|
||||
* @param aofst address offset
|
||||
*/
|
||||
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, int aofst);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Reset only PLL
|
||||
@ -28,8 +44,9 @@ void ALTERA_PLL_ResetPLLAndReconfiguration ();
|
||||
* Set PLL Reconfig register
|
||||
* @param reg register
|
||||
* @param val value
|
||||
* @param useDefaultWRMask only jungfrau for dbit clk (clkindex1, use second WR mask)
|
||||
*/
|
||||
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val);
|
||||
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val, int useSecondWRMask);
|
||||
|
||||
/**
|
||||
* Write Phase Shift
|
||||
|
@ -79,11 +79,28 @@ uint32_t ALTERA_PLL_Cntrl_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_Param_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask = 0x0;
|
||||
uint32_t ALTERA_PLL_Cntrl_WrPrmtrMask = 0x0;
|
||||
#ifdef JUNGFRAUD
|
||||
uint32_t ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask = 0x0;
|
||||
int ALTERA_PLL_Cntrl_DBIT_ClkIndex = 0;
|
||||
|
||||
#endif
|
||||
uint32_t ALTERA_PLL_Cntrl_PLLRstMask = 0x0;
|
||||
uint32_t ALTERA_PLL_Cntrl_AddrMask = 0x0;
|
||||
int ALTERA_PLL_Cntrl_AddrOfst = 0;
|
||||
|
||||
|
||||
#ifdef JUNGFRAUD
|
||||
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, int aofst, uint32_t wd2msk, int clk2Index) {
|
||||
ALTERA_PLL_Cntrl_Reg = creg;
|
||||
ALTERA_PLL_Param_Reg = preg;
|
||||
ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask = rprmsk;
|
||||
ALTERA_PLL_Cntrl_WrPrmtrMask = wpmsk;
|
||||
ALTERA_PLL_Cntrl_PLLRstMask = prmsk;
|
||||
ALTERA_PLL_Cntrl_AddrMask = amsk;
|
||||
ALTERA_PLL_Cntrl_AddrOfst = aofst;
|
||||
ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask = wd2msk;
|
||||
ALTERA_PLL_Cntrl_DBIT_ClkIndex = clk2Index;
|
||||
}
|
||||
#else
|
||||
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, int aofst) {
|
||||
ALTERA_PLL_Cntrl_Reg = creg;
|
||||
ALTERA_PLL_Param_Reg = preg;
|
||||
@ -93,6 +110,7 @@ void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32
|
||||
ALTERA_PLL_Cntrl_AddrMask = amsk;
|
||||
ALTERA_PLL_Cntrl_AddrOfst = aofst;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ALTERA_PLL_ResetPLL () {
|
||||
FILE_LOG(logINFO, ("Resetting only PLL\n"));
|
||||
@ -117,11 +135,18 @@ void ALTERA_PLL_ResetPLLAndReconfiguration () {
|
||||
bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) & ~ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask & ~ALTERA_PLL_Cntrl_PLLRstMask);
|
||||
}
|
||||
|
||||
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val) {
|
||||
FILE_LOG(logDEBUG1, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x)\n", reg, val));
|
||||
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val, int useSecondWRMask) {
|
||||
FILE_LOG(logDEBUG1, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x, useSecondWRMask:%d)\n", reg, val, useSecondWRMask));
|
||||
|
||||
uint32_t wrmask = ALTERA_PLL_Cntrl_WrPrmtrMask;
|
||||
#ifdef JUNGFRAUD
|
||||
if (useSecondWRMask) {
|
||||
wrmask = ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask;
|
||||
}
|
||||
#endif
|
||||
|
||||
FILE_LOG(logDEBUG2, ("pllparamreg:0x%x pllcontrolreg:0x%x addrofst:%d addrmsk:0x%x wrmask:0x%x\n",
|
||||
ALTERA_PLL_Param_Reg, ALTERA_PLL_Cntrl_Reg, ALTERA_PLL_Cntrl_AddrOfst, ALTERA_PLL_Cntrl_AddrMask, ALTERA_PLL_Cntrl_WrPrmtrMask));
|
||||
ALTERA_PLL_Param_Reg, ALTERA_PLL_Cntrl_Reg, ALTERA_PLL_Cntrl_AddrOfst, ALTERA_PLL_Cntrl_AddrMask, wrmask));
|
||||
|
||||
// set parameter
|
||||
bus_w(ALTERA_PLL_Param_Reg, val);
|
||||
@ -134,12 +159,12 @@ void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val) {
|
||||
usleep(ALTERA_PLL_WAIT_TIME_US);
|
||||
|
||||
//write parameter
|
||||
bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) | ALTERA_PLL_Cntrl_WrPrmtrMask);
|
||||
bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) | wrmask);
|
||||
FILE_LOG(logDEBUG2, ("Set WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg)));
|
||||
|
||||
usleep(ALTERA_PLL_WAIT_TIME_US);
|
||||
|
||||
bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) & ~ALTERA_PLL_Cntrl_WrPrmtrMask);
|
||||
bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) & ~wrmask);
|
||||
FILE_LOG(logDEBUG2, ("Unset WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg)));
|
||||
|
||||
usleep(ALTERA_PLL_WAIT_TIME_US);
|
||||
@ -153,13 +178,20 @@ void ALTERA_PLL_SetPhaseShift(int32_t phase, int clkIndex, int pos) {
|
||||
|
||||
FILE_LOG(logDEBUG1, ("C%d phase word:0x%08x\n", clkIndex, value));
|
||||
|
||||
int useSecondWR = 0;
|
||||
#ifdef JUNGFRAUD
|
||||
if (clkIndex == ALTERA_PLL_Cntrl_DBIT_ClkIndex) {
|
||||
useSecondWR = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// write phase shift
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_PHASE_SHIFT_REG, value);
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_PHASE_SHIFT_REG, value, useSecondWR);
|
||||
}
|
||||
|
||||
void ALTERA_PLL_SetModePolling() {
|
||||
FILE_LOG(logINFO, ("\tSetting Polling Mode\n"));
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_MODE_REG, ALTERA_PLL_MODE_PLLNG_MD_VAL);
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_MODE_REG, ALTERA_PLL_MODE_PLLNG_MD_VAL, 0);
|
||||
}
|
||||
|
||||
int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) {
|
||||
@ -188,7 +220,7 @@ int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) {
|
||||
FILE_LOG(logDEBUG1, ("C%d word:0x%08x\n", clkIndex, val));
|
||||
|
||||
// write frequency (post-scale output counter C)
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val);
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val, 0);
|
||||
|
||||
// reset required to keep the phase (must reconfigure adcs again after this as adc clock is stopped temporarily when resetting pll)
|
||||
ALTERA_PLL_ResetPLL ();
|
||||
|
@ -5902,7 +5902,7 @@ int set_clock_phase(int file_des) {
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
@ -5995,8 +5995,6 @@ int get_clock_phase(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
@ -6041,8 +6039,6 @@ int get_max_clock_phase_shift(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
|
@ -209,6 +209,21 @@ class Detector {
|
||||
/** [Gotthard][Jungfrau][CTB][Moench] */
|
||||
void setADCPhaseInDegrees(int value, Positions pos = {});
|
||||
|
||||
/** [CTB][Jungfrau] */
|
||||
Result<int> getDBITPhase(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Jungfrau] */
|
||||
void setDBITPhase(int value, Positions pos = {});
|
||||
|
||||
/** [CTB][Jungfrau] */
|
||||
Result<int> getMaxDBITPhaseShift(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Jungfrau] */
|
||||
Result<int> getDBITPhaseInDegrees(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Jungfrau] */
|
||||
void setDBITPhaseInDegrees(int value, Positions pos = {});
|
||||
|
||||
/** [Mythen3][Gotthard2] Hz */
|
||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||
|
||||
@ -1035,21 +1050,6 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setDBITClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getDBITPhase(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setDBITPhase(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getMaxDBITPhaseShift(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getDBITPhaseInDegrees(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setDBITPhaseInDegrees(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getDBITPipeline(Positions pos = {}) const;
|
||||
|
||||
|
@ -438,6 +438,50 @@ std::string CmdProxy::Adcphase(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Dbitphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of clock to "
|
||||
"latch digital bits. Absolute phase shift. If deg used, then "
|
||||
"shift in degrees. \n\t[Ctb]Changing dbitclk also resets dbitphase and "
|
||||
"sets to previous values."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.empty()) {
|
||||
t = det->getDBITPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase argument " +
|
||||
args[0] + ". Did you mean deg?");
|
||||
}
|
||||
t = det->getDBITPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setDBITPhase(std::stoi(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ClockFrequency(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@ -1366,50 +1410,6 @@ std::string CmdProxy::Samples(int action) {
|
||||
|
||||
/* CTB Specific */
|
||||
|
||||
std::string CmdProxy::Dbitphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_value] [(optional)deg]\n\t[Ctb] Phase shift of clock to "
|
||||
"latch digital bits. Absolute phase shift. If deg used, then "
|
||||
"shift in degrees. Changing dbitclk also resets dbitphase and "
|
||||
"sets to previous values."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.empty()) {
|
||||
t = det->getDBITPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase argument " +
|
||||
args[0] + ". Did you mean deg?");
|
||||
}
|
||||
t = det->getDBITPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setDBITPhase(std::stoi(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::SlowAdc(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
@ -585,6 +585,8 @@ class CmdProxy {
|
||||
{"speed", &CmdProxy::Speed},
|
||||
{"adcphase", &CmdProxy::Adcphase},
|
||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||
{"dbitphase", &CmdProxy::Dbitphase},
|
||||
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
|
||||
{"clkfreq", &CmdProxy::ClockFrequency},
|
||||
{"clkphase", &CmdProxy::ClockPhase},
|
||||
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
|
||||
@ -817,8 +819,6 @@ class CmdProxy {
|
||||
{"dsamples", &CmdProxy::dsamples},
|
||||
{"romode", &CmdProxy::romode},
|
||||
{"dbitclk", &CmdProxy::dbitclk},
|
||||
{"dbitphase", &CmdProxy::Dbitphase},
|
||||
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
|
||||
{"dbitpipeline", &CmdProxy::dbitpipeline},
|
||||
{"v_a", &CmdProxy::v_a},
|
||||
{"v_b", &CmdProxy::v_b},
|
||||
@ -923,6 +923,7 @@ class CmdProxy {
|
||||
std::string acquire(int action);
|
||||
std::string Speed(int action);
|
||||
std::string Adcphase(int action);
|
||||
std::string Dbitphase(int action);
|
||||
std::string ClockFrequency(int action);
|
||||
std::string ClockPhase(int action);
|
||||
std::string MaxClockPhaseShift(int action);
|
||||
@ -966,7 +967,6 @@ class CmdProxy {
|
||||
/* CTB/ Moench Specific */
|
||||
std::string Samples(int action);
|
||||
/* CTB Specific */
|
||||
std::string Dbitphase(int action);
|
||||
std::string SlowAdc(int action);
|
||||
std::string ReceiverDbitList(int action);
|
||||
std::string DigitalIODelay(int action);
|
||||
@ -1074,6 +1074,9 @@ class CmdProxy {
|
||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock.");
|
||||
|
||||
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
|
||||
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.");
|
||||
|
||||
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
||||
"[n_value]\n\tHigh voltage to the sensor in Voltage."
|
||||
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
|
||||
@ -1640,9 +1643,6 @@ class CmdProxy {
|
||||
INTEGER_COMMAND(dbitclk, getDBITClock, setDBITClock, std::stoi,
|
||||
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
|
||||
|
||||
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
|
||||
"\n\t[CTB] Absolute maximum Phase shift of of the clock to latch digital bits.");
|
||||
|
||||
INTEGER_COMMAND(dbitpipeline, getDBITPipeline, setDBITPipeline, std::stoi,
|
||||
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");
|
||||
|
||||
|
@ -273,6 +273,31 @@ void Detector::setADCPhaseInDegrees(int value, Positions pos) {
|
||||
true);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDBITPhase(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
|
||||
false);
|
||||
}
|
||||
|
||||
void Detector::setDBITPhase(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
||||
false);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
|
||||
defs::DBIT_CLOCK);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
|
||||
true);
|
||||
}
|
||||
|
||||
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
||||
true);
|
||||
}
|
||||
|
||||
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getClockFrequency, pos, clkIndex);
|
||||
}
|
||||
@ -1355,32 +1380,6 @@ void Detector::setDBITClock(int value_in_MHz, Positions pos) {
|
||||
value_in_MHz);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDBITPhase(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
|
||||
false);
|
||||
}
|
||||
|
||||
void Detector::setDBITPhase(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
||||
false);
|
||||
}
|
||||
|
||||
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
|
||||
defs::DBIT_CLOCK);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
|
||||
true);
|
||||
}
|
||||
|
||||
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
void Detector::setDBITPipeline(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setPipeline, pos, defs::DBIT_CLOCK, value);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "developer"
|
||||
#define APIEIGER 0x200226
|
||||
#define APILIB 0x200227
|
||||
#define APIRECEIVER 0x200227
|
||||
#define APIGUI 0x200227
|
||||
#define APIMOENCH 0x200304
|
||||
#define APICTB 0x200305
|
||||
#define APIGOTTHARD 0x200305
|
||||
#define APIGOTTHARD2 0x200305
|
||||
#define APIJUNGFRAU 0x200305
|
||||
#define APIMYTHEN3 0x200305
|
||||
#define APIMOENCH 0x200304
|
||||
#define APIEIGER 0x200305
|
||||
|
Loading…
x
Reference in New Issue
Block a user