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 CPSW_CPTS_INT_ENABLE_REG register.
- Upon interrupt, read the CPSW_CPTS_EVENT_0_REG
through CPSW_CPTS_EVENT_3_REG registers values.
- Set the CPSW_CPTS_EVENT_POP_REG[0] EVENT_POP bit
to 1h 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 CPSW_CPTS_INT_ENABLE_REG
- Upon interrupt, enter the CPTS service routine.
- Read the CPSW_CPTS_EVENT_0_REG through
CPSW_CPTS_EVENT_3_REG registers values.
- Set the CPSW_CPTS_EVENT_POP_REG[0] EVENT_POP bit
to 1h 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 CPPI_ICLK periods.
- Read the TS_PEND_RAW bit in the
CPSW_CPTS_INTSTAT_RAW_REG register to determine if another valid event is in the
event FIFO. If bit TS_PEND_RAW is asserted, go to step 3. If bit TS_PEND_RAW is
not asserted proceed with step 7.
- 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 CPSW_CPTS_INTSTAT_RAW_REG register
to determine if a valid event is on the event FIFO.