Hello,
(target is C6678, SYSBIOS bios_6_41_01_36)
I'm using the Timers->timer64->timer module.
I've looked at the source code and I've a couple of questions
1) Why is the implementation of Timer_setPeriod lacking in features vs the Timer_setPeriodMicrosec function ?
The Timer_setPeriod doesn't really support the 32-bit chained mode (where you need to configure both PRDHI and PRDLO.
It should be better implemented and at least documented. There is a major difference of features between the two functions.
2) In Timer_setPeriodMicrosec there is this code which truly manage the 32-bit chained mode
pscCounts = counts >> 32; if (pscCounts) { shift = Intrinsics_maxbit(pscCounts) + 1; pscCounts = (1 << shift) - 1; } prdCounts = (counts >> shift);
with PSC the prescaler counts (PRDHI) and PRD the low period counts. Counts is an unsigned int on 64 bits.
What this code is solving, is the following problem :
given a 64 bit number A, find two 32-bit numbers B and C for which A = B x C
But mathematically speaking I don't understand the algorithm implemented.
Can someone explain it ?
Regards,
Clement