When an event is push onto the Event FIFO, an interrupt can be generated to indicate to software that a time sync event occurred. The following steps should be taken to process time sync events using interrupts:
- Enable the TS_PEND interrupt by setting the
TS_PEND_EN bit of the CPTS_INT_ENABLE_REG.
- Upon interrupt, read the CPTS_EVENT_0_REG through
CPTS_EVENT_3_REG register values.
- Set the CPTS_EVENT_POP_REG[0] EVENT_POP bit to 1
to pop the previously read value off of the event FIFO.
- Process the interrupt as required by the application software.
Software has the option of processing more than a single event from the event FIFO in the interrupt service routine in the following way:
- Enable the TS_PEND interrupt by setting the
TS_PEND_EN bit of the CPTS_INT_ENABLE_REG.
- Upon interrupt, read the CPTS_EVENT_0_REG through
CPTS_EVENT_3_REG register values.
- Set the CPTS_EVENT_POP_REG[0] bit to 1 to pop the
previously read value off of the event FIFO.
- Wait for an amount of time greater than four RCLK periods plus four ICLK periods.
- Read the TS_PEND_RAW bit in the
CPTS_INTSTAT_RAW_REG register to determine if another valid event is in the
event FIFO. If it is asserted, go to step 2; otherwise, proceed to step 6.
- Process the interrupt(s) as required by the application software.
Software also has the option of disabling the
interrupt and polling the TS_PEND_RAW bit of the CPTS_INTSTAT_RAW_REG to determine
if a valid event is on the event FIFO.