ETPU_function parameters don't just pertain to the code in the ETPU_function body; they are relevant to everything that happens in the thread. It would be undesirable to pass these parameters around, and very difficult to get a globally-valid reference.
This item describes a way to use a matched set of ETPU_function parameters and a special global pointer to get access to the parameters in a C function.
I want to assign an ETPU_function to more than one channel. Will all channels share static variables in common?Submitted by Kirk Zurell on Wed, 2007-11-21 16:02. eTPU_C
Each channel, when it runs a shared ETPU_function, can have its own function frame based at its own
CPBA setting. This allocation contains parameters and local static variables.
The angle clock hardware allows microcode to watch the turning of a gear, and act at angles or rotations.
The TPR register, type register_tpr is specified as a structure:
The short answer: assign a number from 0 to 3 to
channel.SMPR, and loop until
channel.SMPR tests true. Perform the sensitive work to be protected by the semaphore, and assign -1 to
Alternatively, use these macros in
No. Signed divide is not supported at this time.
MACH register directly:
Result = Value1 / Value2; Remainder = mach;
The host and eTPU are performing read-modify-writes but the eTPU is overwriting the host's update. Is this a bug?Submitted by Kirk Zurell on Wed, 2007-11-21 15:42. eTPU_C
I'm having problems when the host and eTPU are using variables in the same PRAM word. Both are performing read-modify-write sequences on their own words, but the eTPU is overwriting the host's update. Is this a bug?
No, but it will require you to use semaphores to arbitrate access to the PRAM location.
How can I recover the the contents of the Capture registers after ERT_A/B have been written over by programming a match?Submitted by Kirk Zurell on Wed, 2007-11-21 15:40. eTPU_C
chan = chan;
The compiler will not optimize this out, as there are side effects.
Recovering the Capture register values
When a thread starts, ERT_A/B are loaded with the values of the Capture registers. This code reloads those values after using ERT_A/B for other purposes.
You can place variables in their declaration:
Simply append an
@ symbol and a valid address. Since eTPU_C can calculate constant expressions at compile time, you can use relative addresses:
Add the following declarations to your program: