mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5553 from 0xc0170/OpenNuvoton-nuvoton_fix_lpticker
Nuvoton: fix lpticker interruptpull/5526/head
commit
b7a7d4ed1a
|
@ -103,8 +103,6 @@ void lp_ticker_init(void)
|
|||
|
||||
// Schedule wakeup to match semantics of lp_ticker_get_compare_match()
|
||||
lp_ticker_set_interrupt(wakeup_tick);
|
||||
|
||||
|
||||
}
|
||||
|
||||
timestamp_t lp_ticker_read()
|
||||
|
@ -144,21 +142,13 @@ timestamp_t lp_ticker_read()
|
|||
|
||||
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||
{
|
||||
uint32_t now = lp_ticker_read();
|
||||
uint32_t delta = timestamp - lp_ticker_read();
|
||||
wakeup_tick = timestamp;
|
||||
|
||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
||||
|
||||
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();
|
||||
} else {
|
||||
// NOTE: With lp_ticker_fire_interrupt() introduced, upper layer would handle past event case.
|
||||
// This code fragment gets redundant, but it is still kept here for backward-compatible.
|
||||
void lp_ticker_fire_interrupt(void);
|
||||
lp_ticker_fire_interrupt();
|
||||
}
|
||||
cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC;
|
||||
lp_ticker_arm_cd();
|
||||
}
|
||||
|
||||
void lp_ticker_fire_interrupt(void)
|
||||
|
|
|
@ -147,16 +147,9 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
|
|||
{
|
||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer1hires_modinit.modname));
|
||||
|
||||
int delta = (int) (timestamp - us_ticker_read());
|
||||
if (delta > 0) {
|
||||
cd_major_minor_us = delta * US_PER_TICK;
|
||||
us_ticker_arm_cd();
|
||||
} else {
|
||||
// NOTE: With us_ticker_fire_interrupt() introduced, upper layer would handle past event case.
|
||||
// This code fragment gets redundant, but it is still kept here for backward-compatible.
|
||||
void us_ticker_fire_interrupt(void);
|
||||
us_ticker_fire_interrupt();
|
||||
}
|
||||
uint32_t delta = timestamp - us_ticker_read();
|
||||
cd_major_minor_us = delta * US_PER_TICK;
|
||||
us_ticker_arm_cd();
|
||||
}
|
||||
|
||||
void us_ticker_fire_interrupt(void)
|
||||
|
|
Loading…
Reference in New Issue