diff --git a/evrApp/Db/evrpulser.db b/evrApp/Db/evrpulser.db index e078af63..e40a1b9f 100644 --- a/evrApp/Db/evrpulser.db +++ b/evrApp/Db/evrpulser.db @@ -199,3 +199,24 @@ record(mbbiDirect, "$(PN)PSTrig-RB") field(NOBT, "8") info(autosaveFields_pass0, "RVAL") } + +# Trigger pulser generator by one or more DBus bits +record(mbboDirect, "$(PN)DBusTrig-Sel") +{ + field(DTYP, "Obj Prop uint32") + field(OUT , "@OBJ=$(OBJ), PROP=DBusTrig") + field(PINI, "YES") + field(NOBT, "8") + field(VAL , "0") + field(FLNK, "$(PN)DBusTrig-RB") + info(autosaveFields_pass0, "RVAL") +} + +record(mbbiDirect, "$(PN)DBusTrig-RB") +{ + field(DTYP, "Obj Prop uint32") + field(INP , "@OBJ=$(OBJ), PROP=DBusTrig") + field(PINI, "YES") + field(NOBT, "8") + info(autosaveFields_pass0, "RVAL") +} diff --git a/evrApp/src/evr.cpp b/evrApp/src/evr.cpp index 22e6c121..fb92600a 100644 --- a/evrApp/src/evr.cpp +++ b/evrApp/src/evr.cpp @@ -203,6 +203,8 @@ OBJECT_BEGIN(Pulser) { OBJECT_PROP2("PSTrig", &Pulser::psTrig, &Pulser::setPSTrig); + OBJECT_PROP2("DBusTrig", &Pulser::dbusTrig, &Pulser::setDBusTrig); + } OBJECT_END(Pulser) diff --git a/evrApp/src/evr/pulser.h b/evrApp/src/evr/pulser.h index 998ea60f..9cec80e7 100644 --- a/evrApp/src/evr/pulser.h +++ b/evrApp/src/evr/pulser.h @@ -92,6 +92,13 @@ class epicsShareClass Pulser : public mrf::ObjectInst virtual void setPSTrig(epicsUInt32)=0; /*@}*/ + /**\defgroup DBus Set DBus triggering + */ + /*@{*/ + virtual epicsUInt32 dbusTrig() const=0; + virtual void setDBusTrig(epicsUInt32)=0; + /*@}*/ + /**\defgroup pol Set output polarity * * Selects normal or inverted. diff --git a/evrFRIBApp/src/evr_frib.h b/evrFRIBApp/src/evr_frib.h index 15b8e733..88d759ad 100644 --- a/evrFRIBApp/src/evr_frib.h +++ b/evrFRIBApp/src/evr_frib.h @@ -81,6 +81,9 @@ struct PulserFRIB : public Pulser virtual epicsUInt32 psTrig() const { return 0u; } virtual void setPSTrig(epicsUInt32) {} + virtual epicsUInt32 dbusTrig() const { return 0u; } + virtual void setDBusTrig(epicsUInt32) {} + virtual bool polarityInvert() const { return false; } virtual void setPolarityInvert(bool) {} diff --git a/evrMrmApp/src/drvemPulser.cpp b/evrMrmApp/src/drvemPulser.cpp index 25ec33eb..4e18186b 100644 --- a/evrMrmApp/src/drvemPulser.cpp +++ b/evrMrmApp/src/drvemPulser.cpp @@ -10,6 +10,7 @@ */ #include "evrRegMap.h" +#include "evgRegMap.h" #include "drvem.h" #include @@ -178,6 +179,33 @@ MRMPulser::setPSTrig(epicsUInt32 v) } } +epicsUInt32 +MRMPulser::dbusTrig() const +{ + epicsUInt32 r = 0; + for (int i = 0; i < evgNumDbusBit; i++) { + if (READ32(owner.base, DBusPulsTrig(i)) & (1 << id)) { + r |= 1 << i; + } + } + + return r; +} + +void +MRMPulser::setDBusTrig(epicsUInt32 v) +{ + for (int i = 0; i < evgNumDbusBit; i++) { + epicsUInt32 t = READ32(owner.base, DBusPulsTrig(i)); + if (v & (1 << i)) { + t |= 1 << id; + } else { + t &= ~(1 << id); + } + WRITE32(owner.base, DBusPulsTrig(i), t); + } +} + bool MRMPulser::polarityInvert() const { diff --git a/evrMrmApp/src/drvemPulser.h b/evrMrmApp/src/drvemPulser.h index 0e15a3a8..1dd7ab01 100644 --- a/evrMrmApp/src/drvemPulser.h +++ b/evrMrmApp/src/drvemPulser.h @@ -53,6 +53,9 @@ class MRMPulser : public mrf::ObjectInst virtual epicsUInt32 psTrig() const OVERRIDE FINAL; virtual void setPSTrig(epicsUInt32) OVERRIDE FINAL; + virtual epicsUInt32 dbusTrig() const OVERRIDE FINAL; + virtual void setDBusTrig(epicsUInt32) OVERRIDE FINAL; + virtual bool polarityInvert() const OVERRIDE FINAL; virtual void setPolarityInvert(bool) OVERRIDE FINAL; diff --git a/evrMrmApp/src/evrRegMap.h b/evrMrmApp/src/evrRegMap.h index b69bfe37..33b61329 100755 --- a/evrMrmApp/src/evrRegMap.h +++ b/evrMrmApp/src/evrRegMap.h @@ -196,6 +196,9 @@ # define ScalerPhasOffs_offset 0x20 #define U32_ScalerPulsTrig(N) (U32_ScalerN + 0x40 + (4*(N))) +#define U32_DBusTrigN 0x180 +#define U32_DBusPulsTrig(N) (U32_DBusTrigN + (4*(N))) + #define U32_PulserNCtrl 0x200 #define U32_PulserNScal 0x204 #define U32_PulserNDely 0x208