DNA/DNR-IRIG-650 IRIG Timing Layer
Chapter 3
40
Programming with the Low Level API
Tel: 508-921-4600
www.ueidaq.com
Vers:
4.6
Date: March 2019
DNx-IRIG-650 Chap3x.fm
© Copyright 2019
United Electronic Industries, Inc.
<event_tstamp>
is 32-bit tstamp with 10µs resolution which is stored when an
“ESRC_DNAB condition” event happens. Not used in SBT, BCD or other modes,
and is primarily intended for debugging.
Synchronous Programming Example 1
The simplest event programming example to receive periodic 1PPS events is:
evt_chan = CT650_EVENT_CH0;
flags = DQL_IOCTL650_EVT_EN;
event.event_cfg = CT650_EVT_CFG_EN|CT650_EVT_CFG_EV1IRQ|
CT650_EVT_CFG_EV0IRQ|CT650_EVT_CFG_RPT|
CT650_EVT_CFG_EDGE|CT650_EVT_PPS;
event.event_prm = 0;
event.event_sub0_dly = 0;
event.event_sub1_dly = 0;
event.event_val = 0;
ret = DqAdv650SetEvents(hd, devn, evt_chan, flags, &event,
¶m);
and then poll event status with:
ret = DqAdv650GetEventStatus(hd, devn, evt_chan, flags,
&event_sts);
printf("EvtSts: AD:%x STS:%x DNABTS:%x\n",
event_sts.event_ad, event_sts.event_sts,
event_sts.event_tstamp);
Channel
CT650_EVENT_CHD
is a special channel which will store events into
the layer FIFO, which can be retrieved by calling
DqAdv650ReadEventFifo()
periodically to make sure that FIFO does not overflow:
mode = 0;
rq_size = 200;
ret = DqAdv650ReadEventFifo(hd, devn, mode, rq_size, data,
&ret_size);
if (ret_size > 0) {
printf("EvtDta: ");
for (i = 0; i < ret_size; i++) {
printf("%x ", data[i]);
}
printf("\n");
} else {
printf(" no events\n");
}
}
To disable an event, call
DqAdv650SetEvents()
for that channel with a nulled
<event>
structure (e.g. set all
<event>
structure fields to 0).
25
CT650_EVT_STS_SEVT1D
=1-if subevent 1 was issued (auto-cleared after read)
24
CT650_EVT_STS_SEVT0D
=1-if subevent 0 was issued (auto-cleared after read)
23-0
CT650_EVT_STS_ECT
Event counter. Counter is incremented when event start
condition is detected and cleared when event is disabled