|
|
|
# Schedules events
|
|
|
|
|
|
|
|
The White Rabbit PTP Core includes an event-condition-action (ECA) unit
|
|
|
|
for triggering actions at a scheduled time at address 0x140000. That
|
|
|
|
device has these registers:
|
|
|
|
|
|
|
|
PACKED struct ECA_WB {
|
|
|
|
/* [0x0]: REG FIFO Control Register */
|
|
|
|
uint32_t CR;
|
|
|
|
/* [0x4]: REG Current state (as seen on the output pins) */
|
|
|
|
uint32_t STATE;
|
|
|
|
|
|
|
|
/* [0x8-0xf]: padding */
|
|
|
|
uint32_t reserved[2];
|
|
|
|
|
|
|
|
/* [0x10]: REG UTC Counter register (most-significant part) */
|
|
|
|
uint32_t CNTR_UTCHI;
|
|
|
|
/* [0x14]: REG UTC Counter register (least-significant part) */
|
|
|
|
uint32_t CNTR_UTCLO;
|
|
|
|
/* [0x18]: REG Cycle Counter register (in 8ns units) */
|
|
|
|
uint32_t CNTR_CYCLE;
|
|
|
|
/* [0x1c]: REG Toggle value */
|
|
|
|
uint32_t TOGGLE;
|
|
|
|
};
|
|
|
|
|
|
|
|
An event is scheduled by writing the trigger time into CNTR\_UTCHI,
|
|
|
|
CNTR\_UTCLO, CNTR\_CYCLE. At the specified time, TOGGLE will be XOR'd
|
|
|
|
with STATE. You enqueue the event by writing 1 to CR. Multiple events
|
|
|
|
may be enqueued, but they must be inserted in sorted order.
|
|
|
|
|
|
|
|
The bits of the ECA STATE register are wired as follows:
|
|
|
|
SPEC output0 = LED "OUT"
|
|
|
|
SPEC output1 = DIO 2
|
|
|
|
SPEc output2 = DIO 3
|
|
|
|
SCU output0 = LEMO 1
|
|
|
|
|
|
|
|
To access the device, you will need to know it's Etherbone address. For
|
|
|
|
an SCU accessed from the ComExpress board (read how to
|
|
|
|
[Setup-an-SCU-Bootstick](Setup-an-SCU-Bootstick)), the address is
|
|
|
|
dev/pcie\_wb0. For a SPEC accessed from a host system (read how to
|
|
|
|
[Configure-a-SPEC-host](Configure-a-SPEC-host)), the address is
|
|
|
|
dev/spec\_wb0. For a FEC accessed from the data master, you form the
|
|
|
|
address as udp/IP where IP is the BOOTP address assigned when you
|
|
|
|
[Configure-a-Data-Master](Configure-a-Data-Master).
|
|
|
|
|
|
|
|
A shell script is available (see
|
|
|
|
[Building-from-Sources](Building-from-Sources)) to simplify toggling
|
|
|
|
all
|
|
|
|
outputs:
|
|
|
|
|
|
|
|
terpstra@belapc060:~/gsi-timing-starter-kit$ ./scripts/flip-outputs.sh udp/10.0.0.1 8000
|
|
|
|
|
|
|
|
... which would schedule the event for 8000 seconds since 1970.
|
|
|
|
|