mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
jungfrau server: added deg and maxadcphaseshift, ctb & moench server: set adc phase like jungfrau that positive shift is positive, moved conversion between shift to degrees to the common function. receiver: removed unused variables
This commit is contained in:
parent
5a4122ae7c
commit
c38bebd615
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/ctbDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: c7ad548e4c2026a826b9f269f32d9970ce0a44e8
|
||||
Revision: 48
|
||||
Repsitory UUID: 5a4122ae7c8dae1572e9db336de70183956e58c7
|
||||
Revision: 50
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4478
|
||||
Last Changed Date: 2019-03-27 11:13:21.000000002 +0100 ../slsDetectorServer/slsDetectorServer_funcs.c
|
||||
Last Changed Rev: 4481
|
||||
Last Changed Date: 2019-03-28 08:18:03.000000002 +0100 ../slsDetectorServer/slsDetectorFunctionList.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "c7ad548e4c2026a826b9f269f32d9970ce0a44e8"
|
||||
#define GITREPUUID "5a4122ae7c8dae1572e9db336de70183956e58c7"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4478
|
||||
#define GITDATE 0x20190327
|
||||
#define GITREV 0x4481
|
||||
#define GITDATE 0x20190328
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -1649,25 +1649,20 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
||||
return;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("Configuring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||
FILE_LOG(logINFO, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||
int valShift = val;
|
||||
// convert to phase shift
|
||||
if (degrees) {
|
||||
double temp = val * ((double)maxShift / 360.00);
|
||||
if ((temp - (int)temp) > 0.0001) {
|
||||
temp += 0.5;
|
||||
}
|
||||
valShift = temp;
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d\n", valShift));
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val));
|
||||
|
||||
int relativePhase = clkPhase[ind] - valShift;
|
||||
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(logDEBUG1, ("Nothing to do\n"));
|
||||
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1687,7 +1682,10 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
||||
int getPhase(enum CLKINDEX ind, int degrees) {
|
||||
if (!degrees)
|
||||
return clkPhase[ind];
|
||||
return (clkPhase[ind] * (360.00 / (double)getMaxPhase(ind)));
|
||||
// convert back to degrees
|
||||
int val = 0;
|
||||
ConvertToDifferentRange(0, getMaxPhase(ind) - 1, 0, 359, clkPhase[ind], &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int getMaxPhase(enum CLKINDEX ind) {
|
||||
@ -1717,14 +1715,11 @@ int validatePhaseinDegrees(enum speedVariable ind, int val, int retval) {
|
||||
FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", clkIndex));
|
||||
int maxShift = getMaxPhase(clkIndex);
|
||||
// convert degrees to shift
|
||||
double temp = val;
|
||||
temp *= ((double)maxShift / 360.00);
|
||||
if ((temp - (int)temp) > 0.0001) {
|
||||
temp += 0.5;
|
||||
}
|
||||
val = (int)temp;
|
||||
// convert degrees to shift
|
||||
int valShift = 0;
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
// convert back to degrees
|
||||
val *= (360.00 / (double)maxShift);
|
||||
ConvertToDifferentRange(0, maxShift - 1, 0, 359, valShift, &val);
|
||||
|
||||
if (val == retval)
|
||||
return OK;
|
||||
@ -1746,7 +1741,7 @@ void configureFrequency(enum CLKINDEX ind, int val) {
|
||||
|
||||
// reset phase
|
||||
if (ind == ADC_CLK || ind == DBIT_CLK) {
|
||||
FILE_LOG(logDEBUG1, ("Reseting phase of %s\n", clock_names[ind]));
|
||||
FILE_LOG(logINFO, ("\tReseting phase of %s\n", clock_names[ind]));
|
||||
configurePhase(ind, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/jungfrauDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: cd5aea895b07b7af25e3fb74a341a861f9aa291c
|
||||
Revision: 30
|
||||
Branch: jungfrau
|
||||
Repsitory UUID: 5a4122ae7c8dae1572e9db336de70183956e58c7
|
||||
Revision: 31
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4473
|
||||
Last Changed Date: 2019-03-26 14:19:40.000000002 +0100 ./slsDetectorFunctionList.c
|
||||
Last Changed Rev: 4481
|
||||
Last Changed Date: 2019-03-28 08:18:03.000000002 +0100 ../slsDetectorServer/slsDetectorFunctionList.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "cd5aea895b07b7af25e3fb74a341a861f9aa291c"
|
||||
#define GITREPUUID "5a4122ae7c8dae1572e9db336de70183956e58c7"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4473
|
||||
#define GITDATE 0x20190326
|
||||
#define GITBRANCH "jungfrau"
|
||||
#define GITREV 0x4481
|
||||
#define GITDATE 0x20190328
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -33,7 +33,7 @@ int virtual_stop = 0;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int highvoltage = 0;
|
||||
int dacValues[NDAC] = {0};
|
||||
int32_t clkPhase[2] = {0, 0};
|
||||
int adcPhase = 0;
|
||||
|
||||
|
||||
int isFirmwareCheckDone() {
|
||||
@ -365,7 +365,6 @@ u_int32_t getDetectorIP(){
|
||||
/* initialization */
|
||||
|
||||
void initControlServer(){
|
||||
clkPhase[0] = 0; clkPhase[1] = 0;
|
||||
setupDetector();
|
||||
}
|
||||
|
||||
@ -393,6 +392,7 @@ void initStopServer() {
|
||||
void setupDetector() {
|
||||
FILE_LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n"));
|
||||
|
||||
adcPhase = 0;
|
||||
ALTERA_PLL_ResetPLL();
|
||||
resetCore();
|
||||
resetPeripheral();
|
||||
@ -518,23 +518,25 @@ int setDynamicRange(int dr){
|
||||
|
||||
/* parameters - speed, readout */
|
||||
|
||||
void setSpeed(enum speedVariable ind, int val) {
|
||||
void setSpeed(enum speedVariable ind, int val, int mode) {
|
||||
switch(ind) {
|
||||
case CLOCK_DIVIDER:
|
||||
setClockDivider(val);
|
||||
case ADC_PHASE:
|
||||
setAdcPhase(val);
|
||||
setAdcPhase(val, mode);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int getSpeed(enum speedVariable ind) {
|
||||
int getSpeed(enum speedVariable ind, int mode) {
|
||||
switch(ind) {
|
||||
case CLOCK_DIVIDER:
|
||||
return getClockDivider();
|
||||
case ADC_PHASE:
|
||||
return getPhase();
|
||||
return getPhase(mode);
|
||||
case MAX_ADC_PHASE_SHIFT:
|
||||
return getMaxPhaseShift();
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -1210,7 +1212,7 @@ void setClockDivider(int val) {
|
||||
bus_w(ADC_OFST_REG, ADC_OFST_HALF_SPEED_VAL);
|
||||
|
||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_HALF_SPEED));
|
||||
setAdcPhase(ADC_PHASE_HALF_SPEED);
|
||||
setAdcPhase(ADC_PHASE_HALF_SPEED, 0);
|
||||
|
||||
break;
|
||||
case HALF_SPEED:
|
||||
@ -1227,7 +1229,7 @@ void setClockDivider(int val) {
|
||||
bus_w(ADC_OFST_REG, ADC_OFST_HALF_SPEED_VAL);
|
||||
|
||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_HALF_SPEED));
|
||||
setAdcPhase(ADC_PHASE_HALF_SPEED);
|
||||
setAdcPhase(ADC_PHASE_HALF_SPEED, 0);
|
||||
|
||||
break;
|
||||
case QUARTER_SPEED:
|
||||
@ -1244,7 +1246,7 @@ void setClockDivider(int val) {
|
||||
bus_w(ADC_OFST_REG, ADC_OFST_QUARTER_SPEED_VAL);
|
||||
|
||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_QUARTER_SPEED));
|
||||
setAdcPhase(ADC_PHASE_QUARTER_SPEED);
|
||||
setAdcPhase(ADC_PHASE_QUARTER_SPEED, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1265,51 +1267,77 @@ int getClockDivider() {
|
||||
}
|
||||
}
|
||||
|
||||
int setAdcPhase(int st){ /**carlos needed clkphase 1 and 2? cehck with Aldo */
|
||||
FILE_LOG(logINFO, ("Setting ADC Phase to %d\n", st));
|
||||
if (st > 65535 || st < -65535)
|
||||
return clkPhase[0];
|
||||
void setAdcPhase(int val, int degrees){
|
||||
int maxShift = MAX_PHASE_SHIFTS;
|
||||
|
||||
clkPhase[1] = st - clkPhase[0];
|
||||
if (clkPhase[1] == 0)
|
||||
return clkPhase[0];
|
||||
// validation
|
||||
if (degrees && (val < 0 || val > 359)) {
|
||||
FILE_LOG(logERROR, ("\tPhase provided outside limits (0 - 359°C)\n"));
|
||||
return;
|
||||
}
|
||||
if (!degrees && (val < 0 || val > MAX_PHASE_SHIFTS - 1)) {
|
||||
FILE_LOG(logERROR, ("\tPhase provided outside limits (0 - %d phase shifts)\n", maxShift - 1));
|
||||
return;
|
||||
}
|
||||
|
||||
configurePll();
|
||||
clkPhase[0] = st;
|
||||
return clkPhase[0];
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting ADC Phase to %d (degree mode: %d)\n", val, degrees));
|
||||
int valShift = val;
|
||||
// convert to phase shift
|
||||
if (degrees) {
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val));
|
||||
|
||||
int getPhase() {
|
||||
return clkPhase[0];
|
||||
}
|
||||
int relativePhase = valShift - adcPhase;
|
||||
FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, adcPhase));
|
||||
|
||||
|
||||
void configurePll() {
|
||||
#ifdef VIRTUAL
|
||||
return;
|
||||
#endif
|
||||
int32_t phase=0;
|
||||
// ensuring PLL is never configured with same phase
|
||||
if (clkPhase[1] == 0) {
|
||||
return;
|
||||
// same phase
|
||||
if (!relativePhase) {
|
||||
FILE_LOG(logINFO, ("Nothing to do in Phase Shift\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\tConfiguring PLL with phase in %d\n", clkPhase[1]));
|
||||
int phase = 0;
|
||||
if (relativePhase > 0) {
|
||||
phase = (maxShift - relativePhase);
|
||||
} else {
|
||||
phase = (-1) * relativePhase;
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift));
|
||||
|
||||
// delay ADC clk
|
||||
if (clkPhase[1]>0) {
|
||||
phase = MAX_PHASE_SHIFTS - clkPhase[1];
|
||||
}
|
||||
// advance adc clk
|
||||
else {
|
||||
phase = (-1) * clkPhase[1];
|
||||
}
|
||||
ALTERA_PLL_SetPhaseShift(phase, 1, 0);
|
||||
|
||||
FILE_LOG(logDEBUG1, ("\tphase out %d (0x%08x)\n", phase, phase));
|
||||
ALTERA_PLL_SetPhaseShift(phase, 1, 0); // phase, 1: adc clk, 0:neg
|
||||
usleep(10000);
|
||||
adcPhase = valShift;
|
||||
}
|
||||
|
||||
int getPhase(degrees) {
|
||||
if (!degrees)
|
||||
return adcPhase;
|
||||
// convert back to degrees
|
||||
int val = 0;
|
||||
ConvertToDifferentRange(0, MAX_PHASE_SHIFTS - 1, 0, 359, adcPhase, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int getMaxPhaseShift() {
|
||||
return MAX_PHASE_SHIFTS;
|
||||
}
|
||||
|
||||
int validatePhaseinDegrees(int val, int retval) {
|
||||
if (val == -1)
|
||||
return OK;
|
||||
FILE_LOG(logDEBUG1, ("validating phase in degrees\n"));
|
||||
int maxShift = MAX_PHASE_SHIFTS;
|
||||
// convert degrees to shift
|
||||
int valShift = 0;
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
// convert back to degrees
|
||||
ConvertToDifferentRange(0, maxShift - 1, 0, 359, valShift, &val);
|
||||
|
||||
if (val == retval)
|
||||
return OK;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
int setThresholdTemperature(int val) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/moenchDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 7cd5bc8b2db6e89fbec4c06c65e683cf788338c0
|
||||
Revision: 22
|
||||
Branch: jungfrau
|
||||
Repsitory UUID: 5a4122ae7c8dae1572e9db336de70183956e58c7
|
||||
Revision: 26
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4474
|
||||
Last Changed Date: 2019-03-26 15:01:04.000000002 +0100 ./slsDetectorServer_defs.h
|
||||
Last Changed Rev: 4481
|
||||
Last Changed Date: 2019-03-28 09:08:53.000000002 +0100 ./slsDetectorFunctionList.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "7cd5bc8b2db6e89fbec4c06c65e683cf788338c0"
|
||||
#define GITREPUUID "5a4122ae7c8dae1572e9db336de70183956e58c7"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4474
|
||||
#define GITDATE 0x20190326
|
||||
#define GITBRANCH "jungfrau"
|
||||
#define GITREV 0x4481
|
||||
#define GITDATE 0x20190328
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -1285,25 +1285,20 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
||||
return;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("Configuring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||
FILE_LOG(logINFO, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||
int valShift = val;
|
||||
// convert to phase shift
|
||||
if (degrees) {
|
||||
double temp = val * ((double)maxShift / 360.00);
|
||||
if ((temp - (int)temp) > 0.0001) {
|
||||
temp += 0.5;
|
||||
}
|
||||
valShift = temp;
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d\n", valShift));
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val));
|
||||
|
||||
int relativePhase = clkPhase[ind] - valShift;
|
||||
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(logDEBUG1, ("Nothing to do\n"));
|
||||
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1323,7 +1318,10 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
||||
int getPhase(enum CLKINDEX ind, int degrees) {
|
||||
if (!degrees)
|
||||
return clkPhase[ind];
|
||||
return (clkPhase[ind] * (360.00 / (double)getMaxPhase(ind)));
|
||||
// convert back to degrees
|
||||
int val = 0;
|
||||
ConvertToDifferentRange(0, getMaxPhase(ind) - 1, 0, 359, clkPhase[ind], &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int getMaxPhase(enum CLKINDEX ind) {
|
||||
@ -1353,14 +1351,10 @@ int validatePhaseinDegrees(enum speedVariable ind, int val, int retval) {
|
||||
FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", clkIndex));
|
||||
int maxShift = getMaxPhase(clkIndex);
|
||||
// convert degrees to shift
|
||||
double temp = val;
|
||||
temp *= ((double)maxShift / 360.00);
|
||||
if ((temp - (int)temp) > 0.0001) {
|
||||
temp += 0.5;
|
||||
}
|
||||
val = (int)temp;
|
||||
int valShift = 0;
|
||||
ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift);
|
||||
// convert back to degrees
|
||||
val *= (360.00 / (double)maxShift);
|
||||
ConvertToDifferentRange(0, maxShift - 1, 0, 359, valShift, &val);
|
||||
|
||||
if (val == retval)
|
||||
return OK;
|
||||
@ -1382,7 +1376,7 @@ void configureFrequency(enum CLKINDEX ind, int val) {
|
||||
|
||||
// reset phase
|
||||
if (ind == ADC_CLK || ind == DBIT_CLK) {
|
||||
FILE_LOG(logDEBUG1, ("Reseting phase of %s\n", clock_names[ind]));
|
||||
FILE_LOG(logINFO, ("\tReseting phase of %s\n", clock_names[ind]));
|
||||
configurePhase(ind, 0, 0);
|
||||
}
|
||||
|
||||
@ -2004,7 +1998,7 @@ void readSample(int ns) {
|
||||
|
||||
// loop through all channels
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
for (ich = 0; ich < NCHAN; ++ich) {
|
||||
|
||||
// if channel is in ROI
|
||||
if ((1 << ich) & ~(adcDisableMask)) {
|
||||
|
@ -137,7 +137,7 @@ void ALTERA_PLL_ResetPLLAndReconfiguration () {
|
||||
* @param val value
|
||||
*/
|
||||
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val) {
|
||||
FILE_LOG(logINFO, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x)\n", reg, val));
|
||||
FILE_LOG(logDEBUG1, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x)\n", reg, val));
|
||||
|
||||
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));
|
||||
@ -198,7 +198,7 @@ void ALTERA_PLL_SetModePolling() {
|
||||
* @param frequency set
|
||||
*/
|
||||
int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) {
|
||||
FILE_LOG(logINFO, ("\tC%d: Setting output frequency to %d (pllvcofreq: %dMhz)\n", clkIndex, value, pllVCOFreqMhz));
|
||||
FILE_LOG(logDEBUG1, ("C%d: Setting output frequency to %d (pllvcofreq: %dMhz)\n", clkIndex, value, pllVCOFreqMhz));
|
||||
|
||||
// calculate output frequency
|
||||
float total_div = (float)pllVCOFreqMhz / (float)value;
|
||||
@ -225,7 +225,13 @@ int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) {
|
||||
// write frequency (post-scale output counter C)
|
||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val);
|
||||
|
||||
return (pllVCOFreqMhz / (low_count + high_count));
|
||||
/*double temp = ((double)pllVCOFreqMhz / (double)(low_count + high_count));
|
||||
if ((temp - (int)temp) > 0.0001) {
|
||||
temp += 0.5;
|
||||
}
|
||||
return (int)temp;
|
||||
*/
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
#endif
|
||||
|
||||
// parameters - readout
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
void setSpeed(enum speedVariable ind, int val, int mode);
|
||||
int getSpeed(enum speedVariable ind, int mode);
|
||||
#else
|
||||
@ -283,11 +283,10 @@ int autoCompDisable(int on);
|
||||
void configureASICTimer();
|
||||
void setClockDivider(int val);
|
||||
int getClockDivider();
|
||||
int setAdcPhase(int st);
|
||||
int getPhase();
|
||||
void resetPLL();
|
||||
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val);
|
||||
void configurePll();
|
||||
void setAdcPhase(int val, int degrees);
|
||||
int getPhase(int degrees);
|
||||
int getMaxPhaseShift();
|
||||
int validatePhaseinDegrees(int val, int retval);
|
||||
int setThresholdTemperature(int val);
|
||||
int setTemperatureControl(int val);
|
||||
int setTemperatureEvent(int val);
|
||||
|
@ -1957,6 +1957,7 @@ int set_speed(int file_des) {
|
||||
#ifdef JUNGFRAUD
|
||||
case ADC_PHASE:
|
||||
case CLOCK_DIVIDER:
|
||||
case MAX_ADC_PHASE_SHIFT:
|
||||
#elif CHIPTESTBOARDD
|
||||
case ADC_PHASE:
|
||||
case DBIT_PHASE:
|
||||
@ -1987,7 +1988,7 @@ int set_speed(int file_des) {
|
||||
modeNotImplemented(speedName, (int)ind);
|
||||
break;
|
||||
}
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD))
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(JUNGFRAUD))
|
||||
if (ret == OK && mode == 1) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "deg is not defined for this detector.\n");
|
||||
@ -1998,14 +1999,14 @@ int set_speed(int file_des) {
|
||||
if (ret == OK) {
|
||||
// set
|
||||
if ((val != -1) && (Server_VerifyLock() == OK)) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
setSpeed(ind, val, mode);
|
||||
#else
|
||||
setSpeed(ind, val);
|
||||
#endif
|
||||
}
|
||||
// get
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
retval = getSpeed(ind, mode);
|
||||
#else
|
||||
retval = getSpeed(ind);
|
||||
@ -2015,9 +2016,13 @@ int set_speed(int file_des) {
|
||||
char validateName[20] = {0};
|
||||
sprintf(validateName, "set %s", speedName);
|
||||
#ifndef GOTTHARDD
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
if (ind == ADC_PHASE || ind == DBIT_PHASE && mode == 1) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
ret = validatePhaseinDegrees(ind, val, retval);
|
||||
#else
|
||||
ret = validatePhaseinDegrees(val, retval);
|
||||
#endif
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set %s. Set %s, got %s\n", validateName);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
|
@ -729,7 +729,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page config
|
||||
- <b>adcphase [i] [deg]</b> Sets/gets phase of the ADC clock to i. i is the shift or in degrees if deg is used. deg is optional & only for CTB & Moench. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger. \c Returns \c (int)
|
||||
- <b>adcphase [i] [deg]</b> Sets/gets phase of the ADC clock to i. i is the shift or in degrees if deg is used. deg is optional & only for CTB, Moench and Jungfrau. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "adcphase";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSpeed;
|
||||
@ -743,7 +743,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page config
|
||||
- <b>maxadcphaseshift </b> Gets maximum phase shift of the ADC clock. CTB & Moench only. \c Returns \c (int)
|
||||
- <b>maxadcphaseshift </b> Gets maximum phase shift of the ADC clock. CTB, Moench and Jungfrau only. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "maxadcphaseshift";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSpeed;
|
||||
@ -4636,7 +4636,7 @@ std::string slsDetectorCommand::helpSpeed(int action) {
|
||||
os << "clkdivider c \t sets readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau, full speed is not implemented and overwrites adcphase to recommended default. Not for Gotthard." << std::endl;
|
||||
os << "adcclk c \tSets ADC clock frequency in MHz. CTB & Moench only. It also resets adcphase." << std::endl;
|
||||
os << "dbitclk c \tSets the clock frequency of the latching of the digital bits in MHz. CTB & Moench only. It also resets dbit phase." << std::endl;
|
||||
os << "adcphase c [deg]\t Sets phase of the ADC clock to i. i is the shift or in degrees if deg is used. deg is optional & only for CTB & Moench. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger." << std::endl;
|
||||
os << "adcphase c [deg]\t Sets phase of the ADC clock to i. i is the shift or in degrees if deg is used. deg is optional & only for CTB, Moench & Jungfrau. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger." << std::endl;
|
||||
os << "dbitphase c [deg]\t Sets the phase of the clock for latching of the digital bits to i. i is the shift or in degrees if deg is used. deg is optional. dbitphase is also reset if dbitclk is changed. These are absolute values with limits. for CTB & Moench only." << std::endl;
|
||||
os << "adcpipeline c \t Sets the pipeline of the ADC. For CTB & Moench only." << std::endl;
|
||||
os << "dbitpipeline c \t Sets the pipeline of the latching of the digital bits. For CTB & Moench only." << std::endl;
|
||||
@ -4646,11 +4646,11 @@ std::string slsDetectorCommand::helpSpeed(int action) {
|
||||
os << "clkdivider \t Gets readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau, full speed is not implemented and overwrites adcphase to recommended default. Not for Gotthard." << std::endl;
|
||||
os << "adcclk \tGets ADC clock frequency in MHz. CTB & Moench only. It also resets adcphase." << std::endl;
|
||||
os << "dbitclk \tGets the clock frequency of the latching of the digital bits in MHz. CTB & Moench only. It also resets dbit phase." << std::endl;
|
||||
os << "adcphase [deg]\t Gets phase of the ADC clock. unit is number of shifts or in degrees if deg is used. deg is optional & only for CTB & Moench. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger." << std::endl;
|
||||
os << "adcphase [deg]\t Gets phase of the ADC clock. unit is number of shifts or in degrees if deg is used. deg is optional & only for CTB, Moench & Jungfrau. For CTB & Moench, adcphase is reset if adcclk is changed. For Jungfrau, adcphase changed to defaults if clkdivider changed. Jungfrau, CTB & Moench, these are absolute values with limits. Gotthard, relative phase shift. Not for Eiger." << std::endl;
|
||||
os << "dbitphase [deg]\t Gets the phase of the clock for latching of the digital bits. unit is number of shifts or in degrees if deg is used. deg is optional. dbitphase is also reset if dbitclk is changed. These are absolute values with limits. for CTB & Moench only." << std::endl;
|
||||
os << "adcpipeline \t Gets the pipeline of the ADC. For CTB & Moench only." << std::endl;
|
||||
os << "dbitpipeline \t Gets the pipeline of the latching of the digital bits. For CTB & Moench only." << std::endl;
|
||||
os << "maxadcphaseshift \t Gets maximum phase shift of the ADC clock. CTB & Moench only." << std::endl;
|
||||
os << "maxadcphaseshift \t Gets maximum phase shift of the ADC clock. CTB,Moench and Jungfrau only." << std::endl;
|
||||
os << "maxdbitphaseshift \t Gets maximum phase shift of the clock for latching of the digital bits. CTB & Moench only." << std::endl;
|
||||
os << std::endl;
|
||||
}
|
||||
|
@ -558,8 +558,6 @@ private:
|
||||
const int NCHAN_ANALOG = 32;
|
||||
/** Number of digital channels */
|
||||
const int NCHAN_DIGITAL = 4;
|
||||
/** Number of bytes per pixel */
|
||||
const int NUM_BYTES_PER_PIXEL = 2;
|
||||
public:
|
||||
|
||||
|
||||
@ -634,11 +632,6 @@ class MoenchData : public GeneralData {
|
||||
|
||||
|
||||
private:
|
||||
/** Number of analog channels */
|
||||
const int NCHAN_ANALOG = 32;
|
||||
/** Number of bytes per pixel */
|
||||
const int NUM_BYTES_PER_PIXEL = 2;
|
||||
|
||||
/** Structure of an jungfrau ctb packet header (10G Udp) */
|
||||
typedef struct {
|
||||
unsigned char emptyHeader[6];
|
||||
@ -697,7 +690,7 @@ private:
|
||||
*/
|
||||
void setImageSize(std::vector<slsDetectorDefs::ROI> r, int s, bool t,
|
||||
slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
|
||||
int nchans = NCHAN_ANALOG;
|
||||
int nchans = 32;
|
||||
// if roi
|
||||
if (r.size()) {
|
||||
nchans = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user