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 register.
- Upon interrupt, read the CPTS_EVENT_LOW and CPTS_EVENT_HIGH registers values.
- Set the EVENT_POP field (bit 0) of the CPTS_EVENT_POP register 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 register.
- Upon interrupt, read the CPTS_EVENT_LOW and CPTS_EVENT_HIGH registers values.
- Set the EVENT_POP bit of the CPTS_EVENT_POP register to pop the previously read value off of the event FIFO.
- Wait for an amount of time greater than four CPTS_RFT_CLK periods plus four MAIN_CLK periods.
- Read the TS_PEND_RAW bit in the CPTS_INTSTAT_RAW register to determine if another valid event is in the event FIFO. If it is asserted, go to step 2; otherwise, go 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 register to determine if a valid event is on the event FIFO.