mirror of https://github.com/ARMmbed/mbed-os.git
[NUC472/M453] Remove fix of lp_ticker wrap-around
The original fix cannot handle both wrap-around and scheduled alarm behind now well. Leave wrap-around as known issue.pull/2861/head
parent
9b7642d783
commit
da15379907
|
@ -147,7 +147,14 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
|
|||
|
||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
||||
|
||||
int delta = (timestamp > now) ? (timestamp - now) : (uint32_t) ((uint64_t) timestamp + 0xFFFFFFFFu - now);
|
||||
/**
|
||||
* FIXME: Scheduled alarm may go off incorrectly due to wrap around.
|
||||
* Conditions in which delta is negative:
|
||||
* 1. Wrap around
|
||||
* 2. Newly scheduled alarm is behind now
|
||||
*/
|
||||
//int delta = (timestamp > now) ? (timestamp - now) : (uint32_t) ((uint64_t) timestamp + 0xFFFFFFFFu - now);
|
||||
int delta = (int) (timestamp - now);
|
||||
if (delta > 0) {
|
||||
cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC;
|
||||
lp_ticker_arm_cd();
|
||||
|
|
|
@ -146,7 +146,14 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
|
|||
|
||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
||||
|
||||
int delta = (timestamp > now) ? (timestamp - now) : (uint32_t) ((uint64_t) timestamp + 0xFFFFFFFFu - now);
|
||||
/**
|
||||
* FIXME: Scheduled alarm may go off incorrectly due to wrap around.
|
||||
* Conditions in which delta is negative:
|
||||
* 1. Wrap around
|
||||
* 2. Newly scheduled alarm is behind now
|
||||
*/
|
||||
//int delta = (timestamp > now) ? (timestamp - now) : (uint32_t) ((uint64_t) timestamp + 0xFFFFFFFFu - now);
|
||||
int delta = (int) (timestamp - now);
|
||||
if (delta > 0) {
|
||||
cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC;
|
||||
lp_ticker_arm_cd();
|
||||
|
|
Loading…
Reference in New Issue