From 33e63d61a60683064a83c334669df3005db36025 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Thu, 5 Dec 2024 12:00:35 +0100 Subject: [PATCH] feat: Reset the EVR fractional synth command. --- evrApp/Db/evrbase.db | 8 ++++++++ evrApp/src/evr.cpp | 3 ++- evrApp/src/evr/evr.h | 1 + evrMrmApp/src/drvem.cpp | 7 +++++++ evrMrmApp/src/drvem.h | 3 ++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/evrApp/Db/evrbase.db b/evrApp/Db/evrbase.db index 985e35d4..49e1b561 100644 --- a/evrApp/Db/evrbase.db +++ b/evrApp/Db/evrbase.db @@ -152,6 +152,14 @@ record(ao, "$(P)Link$(s=:)Clk-SP") { info(autosaveFields_pass0, "VAL EGU ESLO HOPR LOPR DRVH DRVL PREC") } +record(bo,"$(P)ResetFracSynth-Cmd" ) { + field(DESC, "Reset button") + field(DTYP, "Obj Prop command") + field(OUT , "@OBJ=$(OBJ), PROP=Reset Frac Synth") + field(ZNAM, "Reset") + field(ONAM, "Reset") +} + record(ai, "$(P)Link$(s=:)Clk-I") { field(DTYP, "Obj Prop double") field(INP , "@OBJ=$(OBJ), PROP=Clock") diff --git a/evrApp/src/evr.cpp b/evrApp/src/evr.cpp index fb92600a..294f9277 100644 --- a/evrApp/src/evr.cpp +++ b/evrApp/src/evr.cpp @@ -50,7 +50,7 @@ std::string EVR::versionSw() const return MRF_VERSION; } -std::string EVR::getCommitHash() const +std::string EVR::getCommitHash() const { return __COMMIT_HASH; } @@ -131,6 +131,7 @@ OBJECT_BEGIN(EVR) { OBJECT_PROP2("Timestamp Source", &EVR::SourceTSraw, &EVR::setSourceTSraw); OBJECT_PROP2("Clock", &EVR::clock, &EVR::clockSet); + OBJECT_PROP1("Reset Frac Synth", &EVR::resetFracSynth); OBJECT_PROP2("Timestamp Clock", &EVR::clockTS, &EVR::clockTSSet); diff --git a/evrApp/src/evr/evr.h b/evrApp/src/evr/evr.h index f42164cd..d7aabdb9 100644 --- a/evrApp/src/evr/evr.h +++ b/evrApp/src/evr/evr.h @@ -97,6 +97,7 @@ class epicsShareClass EVR : public mrf::ObjectInst *@param clk Clock rate in Hz */ virtual void clockSet(double clk)=0; + virtual void resetFracSynth()=0; //! Internal PLL Status virtual bool pllLocked() const=0; diff --git a/evrMrmApp/src/drvem.cpp b/evrMrmApp/src/drvem.cpp index 8ec852b8..a85be550 100644 --- a/evrMrmApp/src/drvem.cpp +++ b/evrMrmApp/src/drvem.cpp @@ -607,6 +607,13 @@ void EVRMRM::clockSet(double freq) } } +void +EVRMRM::resetFracSynth() +{ + epicsUInt32 oldfrac=READ32(base, FracDiv); + WRITE32(base, FracDiv, oldfrac); +} + epicsUInt16 EVRMRM::clockMode() const { diff --git a/evrMrmApp/src/drvem.h b/evrMrmApp/src/drvem.h index 84a321d2..2f95d86b 100644 --- a/evrMrmApp/src/drvem.h +++ b/evrMrmApp/src/drvem.h @@ -89,7 +89,7 @@ struct eventCode { /**@brief Modular Register Map Event Receivers * - * + * */ class epicsShareClass EVRMRM : public mrf::ObjectInst, public MRMSPI, @@ -149,6 +149,7 @@ class epicsShareClass EVRMRM : public mrf::ObjectInst, virtual double clock() const OVERRIDE FINAL {SCOPED_LOCK(evrLock);return eventClock;} virtual void clockSet(double) OVERRIDE FINAL; + virtual void resetFracSynth() OVERRIDE FINAL; epicsUInt16 clockMode() const; void clockModeSet(epicsUInt16 mode);