diff --git a/evrApp/Db/evrpulser.db b/evrApp/Db/evrpulser.db index e078af63a..e40a1b9fa 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 22e6c121b..fb92600ac 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 998ea60f6..9cec80e70 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 15b8e7339..88d759ad6 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 25ec33eba..ef72c4083 100644 --- a/evrMrmApp/src/drvemPulser.cpp +++ b/evrMrmApp/src/drvemPulser.cpp @@ -178,6 +178,33 @@ MRMPulser::setPSTrig(epicsUInt32 v) } } +epicsUInt32 +MRMPulser::dbusTrig() const +{ + epicsUInt32 r = 0; + for (int i = 0; i < evrNumDbusBit; i++) { + if (READ32(owner.base, DBusPulsTrig(i)) & (1 << id)) { + r |= 1 << i; + } + } + + return r; +} + +void +MRMPulser::setDBusTrig(epicsUInt32 v) +{ + for (int i = 0; i < evrNumDbusBit; 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 0e15a3a8f..1dd7ab019 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 b69bfe379..c8ab70ada 100755 --- a/evrMrmApp/src/evrRegMap.h +++ b/evrMrmApp/src/evrRegMap.h @@ -42,6 +42,8 @@ * do this assuming 32-bit data width. */ +#define evrNumDbusBit 8 + #define U32_Status 0x000 # define Status_dbus_mask 0xff000000 # define Status_dbus_shift 24 @@ -196,6 +198,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