The following are the operating modes
of the SEC unit. The counters are initialized to zero when the SEC module receives a
reset input signal, and always count up.
- Continuous Count: In this mode,
the counter continues to count as specified by the input selector. The counter
can count the CPU cycles without any events selected. In this mode, the module
can be used as a software-controlled SYSCLK counter. Continuous mode is active
when CTM_CNTL.START_STOP_MODE and CTM_REF are both set to 0.
- Timer Mode Count: In this mode,
the counter counts up to a set reference value, defined in the CTM_REF register.
Upon reaching the reference value, the counter generates an event that can send
an interrupt to the CPU or generate a watch point. The RST_ON_MATCH bit in the
CTM_CNTL register configures the counter to either continue incrementing or
reset when a match event occurs.
- Start-Stop Count: In this mode,
two events are configured to act as start and stop indicators to the counter.
The counter commences counting only when the defined start event occurs. The
counter then continues to count up until the stop event occurs. Once the first
start event has occurred, further start events are ignored until the stop event
occurs.
In any of the counter modes of
operation, there is a possibility that the 32-bit counter value overflows. If an
overflow occurs, the counter value resets to zero and continues to count up, and the
OVERFLOW bit in the CTM_STATUS register is set high. The OVERFLOW bit remains high
until either the counter is reset, or the application writes 1 to the OVERFLOW_CLEAR
bit of the CTM_CLEAR register.