mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
mythen3: setting clk frequecy and phase shifts work
This commit is contained in:
parent
c689b8b954
commit
c4ae32b216
Binary file not shown.
@ -1021,7 +1021,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
char* clock_names[] = {CLK_NAMES};
|
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"));
|
FILE_LOG(logINFOBLUE, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees"));
|
||||||
int maxShift = getMaxPhase(ind);
|
int maxShift = getMaxPhase(ind);
|
||||||
// validation
|
// validation
|
||||||
if (degrees && (val < 0 || val > 359)) {
|
if (degrees && (val < 0 || val > 359)) {
|
||||||
@ -1048,19 +1048,17 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFOBLUE, ("Configuring Phase\n"));
|
|
||||||
|
|
||||||
int phase = 0;
|
int direction = 1;
|
||||||
if (relativePhase > 0) {
|
if (relativePhase < 0) {
|
||||||
phase = (maxShift - relativePhase);
|
relativePhase *= -1;
|
||||||
} else {
|
direction = 0;
|
||||||
phase = (-1) * relativePhase;
|
}
|
||||||
}
|
FILE_LOG(logDEBUG1, ("\tConfiguring Phase: [phase:%d (0x%x), direction:%d]\n", relativePhase, relativePhase, direction));
|
||||||
FILE_LOG(logDEBUG1, ("\t[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift));
|
|
||||||
|
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
||||||
int ret = ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, phase, 0);
|
int ret = ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
||||||
|
|
||||||
clkPhase[ind] = valShift;
|
clkPhase[ind] = valShift;
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user