Skip to content

Commit

Permalink
Adding the hardware Mxc reset function for each input
Browse files Browse the repository at this point in the history
  • Loading branch information
rhong committed Jun 27, 2024
1 parent 7b8f1c6 commit 0fcbe9f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
19 changes: 19 additions & 0 deletions evgMrmApp/Db/evgInput.db
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ record(ai, "$(P)FPMask-RB") {
field(DTYP, "Obj Prop uint32")
field(INP , "@OBJ=$(OBJ), PROP=FPMASK")
}

record(bo, "$(P)EnaMxcr-Sel") {
field(DESC, "Enable Hardware Mxc Reset")
field(DTYP, "Obj Prop bool")
field(OUT , "@OBJ=$(OBJ), PROP=Hw Reset MXC")
field(ZNAM, "Disabled")
field(ONAM, "Enabled")
field(FLNK, "$(P)EnaIrq-RB")
info(autosaveFields_pass0, "VAL")
}

record(bi, "$(P)EnaMxcr-RB") {
field(DESC, "Enable Hardware Mxc Reset")
field(DTYP, "Obj Prop bool")
field(INP , "@OBJ=$(OBJ), PROP=Hw Reset MXC")
field(ZNAM, "Disabled")
field(ONAM, "Enabled")
}

2 changes: 1 addition & 1 deletion evgMrmApp/src/evg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ OBJECT_BEGIN(evgInput) {
OBJECT_PROP2("IRQ", &evgInput::getExtIrq, &evgInput::setExtIrq);
OBJECT_PROP2("FPMASK", &evgInput::getHwMask, &evgInput::setHwMask);
OBJECT_PROP1("FPMASK", &evgInput::stateChange);

OBJECT_PROP2("Hw Reset MXC", &evgInput::getMxcReset, &evgInput::setMxcReset);
} OBJECT_END(evgInput)

OBJECT_BEGIN(evgMxc) {
Expand Down
19 changes: 17 additions & 2 deletions evgMrmApp/src/evgInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ evgInput::getDbusMap(epicsUInt16 dbus) const {
return (map & mask) != 0;
}

bool
evgInput::getMxcReset() const
{
bool val;
val = (nat_ioread32(m_pInReg) & EVG_INP_MXCR_ENA) >> EVG_INP_MXCR_ENA_shift;
return val;
}

void evgInput::setMxcReset(bool ena)
{
epicsUInt32 src = ena;
epicsUInt32 inReg=nat_ioread32(m_pInReg) & ~(EVG_INP_MXCR_ENA);
nat_iowrite32(m_pInReg, inReg | (src<<EVG_INP_MXCR_ENA_shift));
}

void
evgInput::setSeqTrigMap(epicsUInt32 seqTrigMap) {
if(seqTrigMap > 3)
Expand All @@ -100,7 +115,7 @@ evgInput::setSeqTrigMap(epicsUInt32 seqTrigMap) {
//Read-Modify-Write
epicsUInt32 map = nat_ioread32(m_pInReg);

map = map & 0xffff00ff;
map = map & 0xfffff0ff;
map = map | (seqTrigMap << 8);

nat_iowrite32(m_pInReg, map);
Expand All @@ -109,7 +124,7 @@ evgInput::setSeqTrigMap(epicsUInt32 seqTrigMap) {
epicsUInt32
evgInput::getSeqTrigMap() const {
epicsUInt32 map = nat_ioread32(m_pInReg);
map = map & 0x0000ff00;
map = map & 0x00000f00;
map = map >> 8;
return map;
}
Expand Down
3 changes: 3 additions & 0 deletions evgMrmApp/src/evgInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class evgInput : public mrf::ObjectInst<evgInput> {
void setSeqTrigMap(epicsUInt32);
epicsUInt32 getSeqTrigMap() const;

void setMxcReset(bool);
bool getMxcReset() const;

void setTrigEvtMap(epicsUInt16, bool);
bool getTrigEvtMap(epicsUInt16) const;

Expand Down
2 changes: 2 additions & 0 deletions evgMrmApp/src/evgRegMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@
#define EVG_INP_FP_ENA_shift 24
#define EVG_INP_FP_MASK 0xF0000000
#define EVG_INP_FP_MASK_shift 28
#define EVG_INP_MXCR_ENA 0x00008000
#define EVG_INP_MXCR_ENA_shift 15

#ifndef EVG_CONSTANTS
#define EVG_CONSTANTS
Expand Down

0 comments on commit 0fcbe9f

Please sign in to comment.