Schedule 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.
See I/O-assignments for wiring of the bits of ECA STATE.
To access the device, you will need to know it's Etherbone address:
- SCU accessed from the ComExpress board (read how to Setup-an-SCU-Bootstick), the address is dev/pcie_wb0.
- SPEC accessed from a host system (read how to Configure-a-SPEC-host), the address is dev/spec_wb0.
- VETAR accessed from a host system TO BE DONE
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.
A shell script is available (see 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.