
Understanding the eTPU Channel Hardware, Rev. 0
Channel Modes
Freescale Semiconductor
18
Example 5.
SingleMatchDoubleTransition();
DetectARisingEdge();
DetectBDisable();
/* This will set TDLA on a pin rising edge but will not cause a service request.
If a subsequent service request is made for a match A, for example, the scheduler will
decode the entry using both MatchA_TransB and MatchB_TransA. */
If the application requires the measurement of the width of a pulse, the sm_dt mode will allow both edges
of the pulse to be captured before the eTPU engine needs to process anything. This is particularly useful
if the user needs to reduce the load on the eTPU engine, or if the pulse width is small with respect to the
worst case latency of the eTPU functions. The IPACA can be set to detect the leading edge, and IPACB
the trailing edge. The two capture registers will be read into the respective ERT registers, and one
subtraction will yield the pulse width.
If Match A is enabled (by writing to the match register) in this mode, a match will also cause a service
request. This may be used as an alarm in the event the pulse has not completed by a given time/angle. If
the match occurs before the first transition, the capture registers will contain the time bases selected in the
action units at the time of the match. During the Time Slot Transition (TST) the capture register values are
read into the respective ERTs.
If one transition (necessarily A) has occurred before the match, then capture register A will have the
time/angle of the A transition, and capture register B will have the value of the timebase selected for Action
Unit B at the time of the match. There is no confusion here because the capture value and the latching of
the TDL occur coherently. The interpretation of the values that have been captured is determined uniquely
by the states of the TDLs.
If both transitions occur before the match, then the match is blocked. Therefore, if all three latches (MRLA,
TDLA, and TDLB) are asserted, this indicates that the second transition occurred after the match.
If the transitions occur after the match request service has begun, the conditions tested by the software and
the values in the ERTs will reflect the values latched (coherently) during the time slot transition. If the
application requires the latest transition information, the software must rewrite the CHAN register to
update the TDLs and the ERTs.
NOTE
During a service routine which had been entered due to a match condition,
it is essential to clear the MRL before exiting the thread. If, during that
thread, a transition occurs and a TDL is set but not latched into the condition
codes, then exiting the thread without clearing the TDL will cause new
service request and the transition can then be serviced.
3.3
Both Matches, Single Transition
The
BothMatchSingleTransition()
(bm_st) mode enables the MRLB. It differs from the sm_st mode in that
the first match, either A or B, does not request service, but the second match does. In its simplest
application, if transitions are disabled, this mode could be used to generate a single output pulse as narrow