19 #include <epicsMath.h> 34 throw std::out_of_range(
"pulser id is out of range");
36 std::memset(&this->mapped, 0, NELEMENTS(this->mapped));
70 double clk=owner.
clock();
88 double clk=owner.
clock();
91 return (ticks*scal)/clk;
104 double clk=owner.
clock();
123 double clk=owner.
clock();
126 return (ticks*scal)/clk;
163 epicsUInt32 reg =
READ32(owner.
base, PulserCtrl(
id));
172 epicsUInt32 rereg =
READ32(owner.
base, PulserCtrl(
id));
175 throw std::runtime_error(
"FW doesn't support Pulser enable-gates");
185 epicsUInt32 reg =
READ32(owner.
base, PulserCtrl(
id));
194 epicsUInt32 rereg =
READ32(owner.
base, PulserCtrl(
id));
197 throw std::runtime_error(
"FW doesn't support Pulser masking");
204 throw std::out_of_range(
"Event code is out of range");
211 map[0]=
READ32(owner.
base, MappingRam(0,evt,Trigger));
212 map[1]=
READ32(owner.
base, MappingRam(0,evt,Set));
213 map[2]=
READ32(owner.
base, MappingRam(0,evt,Reset));
215 epicsUInt32 pmask=1<<id, insanity=0;
232 errlogPrintf(
"EVR %s pulser #%d code %02x maps too many actions %08x %08x %08x\n",
233 owner.
name().c_str(),id,evt,map[0],map[1],map[2]);
237 errlogPrintf(
"EVR %s pulser #%d code %02x mapping (%08x %08x %08x) is out of sync with view (%d)\n",
238 owner.
name().c_str(),id,evt,map[0],map[1],map[2],_ismap(evt));
248 throw std::out_of_range(
"Event code is out of range");
253 epicsUInt32 pmask=1<<id;
256 throw std::runtime_error(
"Ignore request for duplicate mapping");
264 BITSET(NAT,32, owner.
base, MappingRam(0,evt,Trigger), pmask);
266 BITCLR(NAT,32, owner.
base, MappingRam(0,evt,Trigger), pmask);
269 BITSET(NAT,32, owner.
base, MappingRam(0,evt,Set), pmask);
271 BITCLR(NAT,32, owner.
base, MappingRam(0,evt,Set), pmask);
274 BITSET(NAT,32, owner.
base, MappingRam(0,evt,Reset), pmask);
276 BITCLR(NAT,32, owner.
base, MappingRam(0,evt,Reset), pmask);
#define BITCLR(ord, len, base, offset, mask)
#define READ32(base, offset)
virtual double clock() const OVERRIDE FINAL
volatile unsigned char *const base
epicsUInt32 masks() const
virtual epicsUInt32 delayRaw() const OVERRIDE FINAL
virtual void enable(bool) OVERRIDE FINAL
OBJECT_PROP2("Masks", &MRMPulser::masks, &MRMPulser::setMasks)
virtual double width() const OVERRIDE FINAL
virtual void setDelayRaw(epicsUInt32) OVERRIDE FINAL
virtual void setPrescaler(epicsUInt32) OVERRIDE FINAL
#define OBJECT_BEGIN2(klass, Base)
#define PulserCtrl_enables
virtual epicsUInt32 prescaler() const OVERRIDE FINAL
Modular Register Map Event Receivers.
virtual void unlock() const OVERRIDE FINAL
virtual epicsUInt32 widthRaw() const OVERRIDE FINAL
virtual bool enabled() const OVERRIDE FINAL
virtual void setDelay(double) OVERRIDE FINAL
virtual bool polarityInvert() const OVERRIDE FINAL
virtual void setWidth(double) OVERRIDE FINAL
virtual void lock() const OVERRIDE FINAL
A programmable delay unit.
virtual MapType::type mappedSource(epicsUInt32 src) const OVERRIDE FINAL
What action is source 'src' mapped to?
MRMPulser(const std::string &n, epicsUInt32, EVRMRM &)
#define PulserCtrl_enables_shift
#define OBJECT_END(klass)
virtual void sourceSetMap(epicsUInt32 src, MapType::type action) OVERRIDE FINAL
Set mapping of source 'src'.
void setEnables(epicsUInt32 inps)
virtual void setPolarityInvert(bool) OVERRIDE FINAL
const std::string & name() const
virtual void lock() const OVERRIDE FINAL
#define PulserCtrl_masks_shift
epicsUInt32 roundToUInt(double val, epicsUInt32 max)
void setMasks(epicsUInt32 inps)
#define BITSET(ord, len, base, offset, mask)
epicsUInt32 enables() const
virtual double delay() const OVERRIDE FINAL
#define WRITE32(base, offset, value)
virtual void setWidthRaw(epicsUInt32) OVERRIDE FINAL
virtual void unlock() const OVERRIDE FINAL