Skip to content

Commit

Permalink
Adding AcTrig source select options for external references
Browse files Browse the repository at this point in the history
  • Loading branch information
rhong committed May 22, 2024
1 parent 69d4e0d commit c22b26d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
34 changes: 24 additions & 10 deletions evgMrmApp/Db/evgAcTrig.db
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,37 @@ record(bi, "$(P)Bypass-RB") {
field(ONAM, "On")
}

record(bo, "$(P)SyncSrc-Sel") {
field(DESC, "Sync to Event Clock or Mxc7")
field(DTYP, "Obj Prop bool")
record(mbbo, "$(P)SyncSrc-Sel") {
field(DESC, "Synchronization Source")
field(DTYP, "Obj Prop uint16")
field(OUT, "@OBJ=$(OBJ), PROP=SyncSrc")
field(PINI, "YES")
field(ZRST, "Event Clk")
field(ONST, "Mxc7")
field(TWST, "FP IN1")
field(THST, "FP IN2")
field(ZRVL, "0x00")
field(ONVL, "0x01")
field(TWVL, "0x05")
field(THVL, "0x09")
field(VAL , "0")
field(UDF, "0")
field(ZNAM, "Event Clk")
field(ONAM, "Mxc7")
field(FLNK, "$(P)SyncSrc-RB")
info(autosaveFields_pass0, "VAL")
}

record(bi, "$(P)SyncSrc-RB") {
field(DESC, "Sync to Event Clock or Mxc7")
field(DTYP, "Obj Prop bool")

record(mbbi, "$(P)SyncSrc-RB") {
field(DESC, "Synchronization Source")
field(DTYP, "Obj Prop uint16")
field(INP, "@OBJ=$(OBJ), PROP=SyncSrc")
field(ZNAM, "Event Clk")
field(ONAM, "Mxc7")
field(ZRST, "Event Clk")
field(ONST, "Mxc7")
field(TWST, "FP IN1")
field(THST, "FP IN2")
field(ZRVL, "0x00")
field(ONVL, "0x01")
field(TWVL, "0x05")
field(THVL, "0x09")
}

15 changes: 7 additions & 8 deletions evgMrmApp/src/evgAcTrig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,17 @@ evgAcTrig::getBypass() const {
return !!(READ32(m_pReg, AcTrigControl)&AcTrigControl_Bypass);
}


void
evgAcTrig::setSyncSrc(bool syncSrc) {
if(syncSrc)
BITSET32(m_pReg, AcTrigControl, AcTrigControl_Sync);
else
BITCLR32(m_pReg, AcTrigControl, AcTrigControl_Sync);
evgAcTrig::setSyncSrc(epicsUInt16 syncSrc) {
epicsUInt32 cur = READ32(m_pReg, AcTrigControl);
cur &= ~AcTrigControl_Sync_MASK;
cur |= (epicsUInt8)syncSrc << AcTrigControl_Sync_SHIFT;
WRITE32(m_pReg, AcTrigControl, cur);
}

bool
epicsUInt16
evgAcTrig::getSyncSrc() const {
return !!(READ32(m_pReg, AcTrigControl)&AcTrigControl_Sync);
return (READ32(m_pReg, AcTrigControl)&AcTrigControl_Sync_MASK)>>AcTrigControl_Sync_SHIFT;
}

void
Expand Down
4 changes: 2 additions & 2 deletions evgMrmApp/src/evgAcTrig.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class evgAcTrig : public mrf::ObjectInst<evgAcTrig> {
void setBypass(bool);
bool getBypass() const;

void setSyncSrc(bool);
bool getSyncSrc() const;
void setSyncSrc(epicsUInt16);
epicsUInt16 getSyncSrc() const;

void setTrigEvtMap(epicsUInt16, bool);
epicsUInt32 getTrigEvtMap() const;
Expand Down
3 changes: 2 additions & 1 deletion evgMrmApp/src/evgRegMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
//
#define U32_AcTrigControl 0x0010

#define AcTrigControl_Sync 0x00010000
#define AcTrigControl_Sync_MASK 0x000d0000
#define AcTrigControl_Sync_SHIFT 16
#define AcTrigControl_Bypass 0x00020000
#define AcTrigControl_Divider_MASK 0x0000ff00
#define AcTrigControl_Divider_SHIFT 8
Expand Down

0 comments on commit c22b26d

Please sign in to comment.