mirror of https://github.com/ARMmbed/mbed-os.git
Added xx_ticker_fire_interrupt function for M2351 device
parent
5876114f23
commit
0468bf2b6b
|
@ -145,32 +145,23 @@ timestamp_t lp_ticker_read()
|
||||||
|
|
||||||
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
uint32_t now = lp_ticker_read();
|
uint32_t delta = timestamp - lp_ticker_read();
|
||||||
wakeup_tick = timestamp;
|
wakeup_tick = timestamp;
|
||||||
|
|
||||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
TIMER_Stop((TIMER_T *) NU_MODBASE(timer3_modinit.modname));
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE: 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;
|
||||||
cd_major_minor_clks = (uint64_t) delta * US_PER_TICK * TMR3_CLK_PER_SEC / US_PER_SEC;
|
lp_ticker_arm_cd();
|
||||||
lp_ticker_arm_cd();
|
}
|
||||||
}
|
|
||||||
else {
|
void lp_ticker_fire_interrupt(void)
|
||||||
cd_major_minor_clks = cd_minor_clks = 0;
|
{
|
||||||
/**
|
cd_major_minor_clks = cd_minor_clks = 0;
|
||||||
* This event was in the past. Set the interrupt as pending, but don't process it here.
|
/**
|
||||||
* This prevents a recurive loop under heavy load which can lead to a stack overflow.
|
* This event was in the past. Set the interrupt as pending, but don't process it here.
|
||||||
*/
|
* This prevents a recurive loop under heavy load which can lead to a stack overflow.
|
||||||
NVIC_SetPendingIRQ(timer3_modinit.irq_n);
|
*/
|
||||||
}
|
NVIC_SetPendingIRQ(timer3_modinit.irq_n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lp_ticker_disable_interrupt(void)
|
void lp_ticker_disable_interrupt(void)
|
||||||
|
|
|
@ -152,20 +152,20 @@ void us_ticker_clear_interrupt(void)
|
||||||
void us_ticker_set_interrupt(timestamp_t timestamp)
|
void us_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
TIMER_Stop((TIMER_T *) NU_MODBASE(timer1hires_modinit.modname));
|
TIMER_Stop((TIMER_T *) NU_MODBASE(timer1hires_modinit.modname));
|
||||||
int delta = (int) (timestamp - us_ticker_read());
|
|
||||||
|
|
||||||
if (delta > 0) {
|
uint32_t delta = timestamp - us_ticker_read();
|
||||||
cd_major_minor_us = delta * US_PER_TICK;
|
cd_major_minor_us = delta * US_PER_TICK;
|
||||||
us_ticker_arm_cd();
|
us_ticker_arm_cd();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
cd_major_minor_us = cd_minor_us = 0;
|
void us_ticker_fire_interrupt(void)
|
||||||
/**
|
{
|
||||||
* This event was in the past. Set the interrupt as pending, but don't process it here.
|
cd_major_minor_us = cd_minor_us = 0;
|
||||||
* This prevents a recurive loop under heavy load which can lead to a stack overflow.
|
/**
|
||||||
*/
|
* This event was in the past. Set the interrupt as pending, but don't process it here.
|
||||||
NVIC_SetPendingIRQ(timer1hires_modinit.irq_n);
|
* This prevents a recurive loop under heavy load which can lead to a stack overflow.
|
||||||
}
|
*/
|
||||||
|
NVIC_SetPendingIRQ(timer1hires_modinit.irq_n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tmr0_vec(void)
|
static void tmr0_vec(void)
|
||||||
|
|
Loading…
Reference in New Issue