Skip to content

Commit

Permalink
fix: Better softclock handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerzyjamroz committed Apr 3, 2024
1 parent b1bf486 commit d207444
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions evrMrmApp/src/drvem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,11 @@ EVRMRM::specialSetMap(epicsUInt32 code, epicsUInt32 func,bool v)
}
}

void
EVRMRM::clockSet(double freq)
// Set both the fractional synthesiser and microsecond divider.
void EVRMRM::clockSet(double freq)
{
double err;
// Set both the fractional synthesiser and microsecond
// divider.
printf("Set EVR clock %f\n",freq);
double clk_soft = freq; //[Hz]

freq/=1e6;

Expand All @@ -594,9 +592,11 @@ EVRMRM::clockSet(double freq)

double clk = FracSynthAnalyze(READ32(base, FracDiv), fracref,0) * 1e6;
// Apply the soft clock if the registry is not implemented (EVRD/U)
eventClock = (clk == 0.0) ? clockTS() : clk;
eventClock = (clk == 0.0) ? clk_soft : clk;
}

printf("Set EVR %s clock %f newfrac %d (oldfrac %d)\n", model().c_str(), eventClock, newfrac, oldfrac);

// USecDiv is accessed as a 32 bit register, but
// only 16 are used.
epicsUInt16 oldudiv=READ32(base, USecDiv);
Expand Down

0 comments on commit d207444

Please sign in to comment.