mirror of
https://github.com/apache/nuttx.git
synced 2026-10-03 20:27:53 +00:00
sched/sched: Remove nxsched_alarm_expiration
This commit removed nxsched_alarm_expiration to simplify the timer expiration. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
parent
3aed2485f8
commit
e5db83d7db
16 changed files with 86 additions and 151 deletions
|
|
@ -32,16 +32,6 @@ OS List Management APIs
|
||||||
**Assumptions**: Base code implementation assumes that this
|
**Assumptions**: Base code implementation assumes that this
|
||||||
function is called from interrupt handling logic with interrupts disabled.
|
function is called from interrupt handling logic with interrupts disabled.
|
||||||
|
|
||||||
.. c:function:: void nxsched_alarm_expiration(void);
|
|
||||||
|
|
||||||
If ``CONFIG_SCHED_TICKLESS`` is defined, then this
|
|
||||||
function is provided by the RTOS base code and called from
|
|
||||||
platform-specific code when the interval timer used to implemented
|
|
||||||
the tick-less OS expires.
|
|
||||||
|
|
||||||
**Assumptions**: Base code implementation assumes that this
|
|
||||||
function is called from interrupt handling logic with interrupts disabled.
|
|
||||||
|
|
||||||
.. c:function:: void irq_dispatch(int irq, FAR void *context)
|
.. c:function:: void irq_dispatch(int irq, FAR void *context)
|
||||||
|
|
||||||
This function must be called from the
|
This function must be called from the
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,6 @@ In addition to these imported interfaces, the RTOS will export the
|
||||||
following interfaces for use by the platform-specific interval
|
following interfaces for use by the platform-specific interval
|
||||||
timer implementation:
|
timer implementation:
|
||||||
|
|
||||||
- ``nxsched_alarm_expiration()``: called by the platform-specific logic when the alarm expires.
|
|
||||||
- ``nxsched_timer_expiration()``: called by the platform-specific logic when the interval time expires.
|
- ``nxsched_timer_expiration()``: called by the platform-specific logic when the interval time expires.
|
||||||
|
|
||||||
.. c:function:: void archname_timer_initialize(void)
|
.. c:function:: void archname_timer_initialize(void)
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ static uint64_t imxrt_get_counter(void)
|
||||||
|
|
||||||
static void imxrt_interval_handler(void)
|
static void imxrt_interval_handler(void)
|
||||||
{
|
{
|
||||||
struct timespec tv;
|
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* Disable the compare interrupt for now */
|
/* Disable the compare interrupt for now */
|
||||||
|
|
@ -184,8 +183,7 @@ static void imxrt_interval_handler(void)
|
||||||
|
|
||||||
g_tickless.pending = false;
|
g_tickless.pending = false;
|
||||||
|
|
||||||
up_timer_gettime(&tv);
|
nxsched_timer_expiration();
|
||||||
nxsched_alarm_expiration(&tv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
@ -479,7 +477,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
* Name: up_alarm_start
|
* Name: up_alarm_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Start the alarm. nxsched_alarm_expiration() will be called when the
|
* Start the alarm. nxsched_timer_expiration() will be called when the
|
||||||
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
||||||
*
|
*
|
||||||
* Provided by platform-specific code and called from the RTOS base code.
|
* Provided by platform-specific code and called from the RTOS base code.
|
||||||
|
|
@ -487,7 +485,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ts - The time in the future at the alarm is expected to occur. When
|
* ts - The time in the future at the alarm is expected to occur. When
|
||||||
* the alarm occurs the timer logic will call
|
* the alarm occurs the timer logic will call
|
||||||
* nxsched_alarm_expiration().
|
* nxsched_timer_expiration().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
|
@ -555,7 +553,7 @@ int up_alarm_start(const struct timespec *ts)
|
||||||
* Description:
|
* Description:
|
||||||
* Cancel the alarm and return the time of cancellation of the alarm.
|
* Cancel the alarm and return the time of cancellation of the alarm.
|
||||||
* These two steps need to be as nearly atomic as possible.
|
* These two steps need to be as nearly atomic as possible.
|
||||||
* nxsched_alarm_expiration() will not be called unless the alarm is
|
* nxsched_timer_expiration() will not be called unless the alarm is
|
||||||
* restarted with up_alarm_start().
|
* restarted with up_alarm_start().
|
||||||
*
|
*
|
||||||
* If, as a race condition, the alarm has already expired when this
|
* If, as a race condition, the alarm has already expired when this
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@
|
||||||
static double sec_per_tick;
|
static double sec_per_tick;
|
||||||
static uint64_t g_internal_timer;
|
static uint64_t g_internal_timer;
|
||||||
static uint64_t g_alarm;
|
static uint64_t g_alarm;
|
||||||
struct timespec g_ts;
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
|
|
@ -87,9 +86,7 @@ static int lpc43_rit_isr(int irq, void *context, void *arg)
|
||||||
{
|
{
|
||||||
/* handle expired alarm */
|
/* handle expired alarm */
|
||||||
|
|
||||||
g_ts.tv_sec = (uint32_t)(g_internal_timer / 1000000000);
|
nxsched_timer_expiration();
|
||||||
g_ts.tv_nsec = (uint32_t)(g_internal_timer % 1000000000);
|
|
||||||
nxsched_alarm_expiration(&g_ts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
|
||||||
|
|
@ -496,13 +496,7 @@ static inline void lpc43_tl_alarm(uint32_t curr)
|
||||||
lpc43_tl_init_timer_vars();
|
lpc43_tl_init_timer_vars();
|
||||||
lpc43_tl_set_default_compare(curr);
|
lpc43_tl_set_default_compare(curr);
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
struct timespec ts;
|
|
||||||
up_timer_gettime(&ts);
|
|
||||||
nxsched_alarm_expiration(&ts);
|
|
||||||
#else
|
|
||||||
nxsched_timer_expiration();
|
nxsched_timer_expiration();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt handler */
|
/* Interrupt handler */
|
||||||
|
|
|
||||||
|
|
@ -539,13 +539,7 @@ static inline void lpc54_tl_alarm(uint64_t curr)
|
||||||
lpc54_init_timer_vars();
|
lpc54_init_timer_vars();
|
||||||
lpc54_set_default_compare(curr);
|
lpc54_set_default_compare(curr);
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
struct timespec ts;
|
|
||||||
up_timer_gettime(&ts);
|
|
||||||
nxsched_alarm_expiration(&ts);
|
|
||||||
#else
|
|
||||||
nxsched_timer_expiration();
|
nxsched_timer_expiration();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt handler */
|
/* Interrupt handler */
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,25 @@ static void rtc_prepare_alarm(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: rtc_cancel_ack
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void rtc_cancel_ack(void)
|
||||||
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
|
NRF52_RTC_DISABLEINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
||||||
|
NRF52_RTC_ACKINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
||||||
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: rtc_handler
|
* Name: rtc_handler
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -221,15 +240,13 @@ static int rtc_handler(int irq, void *context, void *arg)
|
||||||
|
|
||||||
if (NRF52_RTC_CHECKINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0))
|
if (NRF52_RTC_CHECKINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0))
|
||||||
{
|
{
|
||||||
struct timespec now;
|
/* cancel the alarm and ack the event */
|
||||||
|
|
||||||
/* cancel alarm and get current time */
|
rtc_cancel_ack();
|
||||||
|
|
||||||
up_alarm_cancel(&now);
|
|
||||||
|
|
||||||
/* let scheduler now of alarm firing */
|
/* let scheduler now of alarm firing */
|
||||||
|
|
||||||
nxsched_alarm_expiration(&now);
|
nxsched_timer_expiration();
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
@ -254,13 +271,14 @@ int up_alarm_cancel(struct timespec *ts)
|
||||||
|
|
||||||
NRF52_RTC_DISABLEINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
NRF52_RTC_DISABLEINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
||||||
NRF52_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
NRF52_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
||||||
rtc_counter_to_ts(counter, ts);
|
|
||||||
|
|
||||||
NRF52_RTC_ACKINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
NRF52_RTC_ACKINT(g_tickless_dev.rtc, NRF52_RTC_EVT_COMPARE0);
|
||||||
g_tickless_dev.alarm_set = false;
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
rtc_counter_to_ts(counter, ts);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,8 +328,6 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
|
|
||||||
void up_timer_initialize(void)
|
void up_timer_initialize(void)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
memset(&g_tickless_dev, 0, sizeof(struct nrf52_tickless_dev_s));
|
memset(&g_tickless_dev, 0, sizeof(struct nrf52_tickless_dev_s));
|
||||||
|
|
||||||
g_tickless_dev.rtc = nrf52_rtc_init(CONFIG_NRF52_SYSTIMER_RTC_INSTANCE);
|
g_tickless_dev.rtc = nrf52_rtc_init(CONFIG_NRF52_SYSTIMER_RTC_INSTANCE);
|
||||||
|
|
@ -341,6 +357,5 @@ void up_timer_initialize(void)
|
||||||
|
|
||||||
/* kick off alarm scheduling */
|
/* kick off alarm scheduling */
|
||||||
|
|
||||||
ts.tv_sec = ts.tv_nsec = 0;
|
nxsched_timer_expiration();
|
||||||
nxsched_alarm_expiration(&ts);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,25 @@ static void rtc_prepare_alarm(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: rtc_cancel_ack
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void rtc_cancel_ack(void)
|
||||||
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
|
NRF53_RTC_DISABLEINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
||||||
|
NRF53_RTC_ACKINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
||||||
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: rtc_handler
|
* Name: rtc_handler
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -219,15 +238,13 @@ static int rtc_handler(int irq, void *context, void *arg)
|
||||||
|
|
||||||
if (NRF53_RTC_CHECKINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0))
|
if (NRF53_RTC_CHECKINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0))
|
||||||
{
|
{
|
||||||
struct timespec now;
|
/* cancel the alarm and ack the event */
|
||||||
|
|
||||||
/* cancel alarm and get current time */
|
rtc_cancel_ack();
|
||||||
|
|
||||||
up_alarm_cancel(&now);
|
|
||||||
|
|
||||||
/* let scheduler now of alarm firing */
|
/* let scheduler now of alarm firing */
|
||||||
|
|
||||||
nxsched_alarm_expiration(&now);
|
nxsched_timer_expiration();
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
@ -252,13 +269,14 @@ int up_alarm_cancel(struct timespec *ts)
|
||||||
|
|
||||||
NRF53_RTC_DISABLEINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
NRF53_RTC_DISABLEINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
||||||
NRF53_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
NRF53_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
||||||
rtc_counter_to_ts(counter, ts);
|
|
||||||
|
|
||||||
NRF53_RTC_ACKINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
NRF53_RTC_ACKINT(g_tickless_dev.rtc, NRF53_RTC_EVT_COMPARE0);
|
||||||
g_tickless_dev.alarm_set = false;
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
rtc_counter_to_ts(counter, ts);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,8 +326,6 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
|
|
||||||
void up_timer_initialize(void)
|
void up_timer_initialize(void)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
memset(&g_tickless_dev, 0, sizeof(struct nrf53_tickless_dev_s));
|
memset(&g_tickless_dev, 0, sizeof(struct nrf53_tickless_dev_s));
|
||||||
|
|
||||||
g_tickless_dev.rtc = nrf53_rtc_init(CONFIG_NRF53_SYSTIMER_RTC_INSTANCE);
|
g_tickless_dev.rtc = nrf53_rtc_init(CONFIG_NRF53_SYSTIMER_RTC_INSTANCE);
|
||||||
|
|
@ -339,6 +355,5 @@ void up_timer_initialize(void)
|
||||||
|
|
||||||
/* kick off alarm scheduling */
|
/* kick off alarm scheduling */
|
||||||
|
|
||||||
ts.tv_sec = ts.tv_nsec = 0;
|
nxsched_timer_expiration();
|
||||||
nxsched_alarm_expiration(&ts);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,21 @@ static void rtc_prepare_alarm(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rtc_cancel_ack(void)
|
||||||
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
|
NRF91_RTC_DISABLEINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
||||||
|
NRF91_RTC_ACKINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
||||||
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: rtc_handler
|
* Name: rtc_handler
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -219,15 +234,13 @@ static int rtc_handler(int irq, void *context, void *arg)
|
||||||
|
|
||||||
if (NRF91_RTC_CHECKINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0))
|
if (NRF91_RTC_CHECKINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0))
|
||||||
{
|
{
|
||||||
struct timespec now;
|
/* cancel the alarm and ack the event */
|
||||||
|
|
||||||
/* cancel alarm and get current time */
|
rtc_cancel_ack();
|
||||||
|
|
||||||
up_alarm_cancel(&now);
|
|
||||||
|
|
||||||
/* let scheduler now of alarm firing */
|
/* let scheduler now of alarm firing */
|
||||||
|
|
||||||
nxsched_alarm_expiration(&now);
|
nxsched_timer_expiration();
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
@ -252,13 +265,14 @@ int up_alarm_cancel(struct timespec *ts)
|
||||||
|
|
||||||
NRF91_RTC_DISABLEINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
NRF91_RTC_DISABLEINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
||||||
NRF91_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
NRF91_RTC_GETCOUNTER(g_tickless_dev.rtc, &counter);
|
||||||
rtc_counter_to_ts(counter, ts);
|
|
||||||
|
|
||||||
NRF91_RTC_ACKINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
NRF91_RTC_ACKINT(g_tickless_dev.rtc, NRF91_RTC_EVT_COMPARE0);
|
||||||
g_tickless_dev.alarm_set = false;
|
g_tickless_dev.alarm_set = false;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
rtc_counter_to_ts(counter, ts);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,8 +322,6 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
|
|
||||||
void up_timer_initialize(void)
|
void up_timer_initialize(void)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
memset(&g_tickless_dev, 0, sizeof(struct nrf91_tickless_dev_s));
|
memset(&g_tickless_dev, 0, sizeof(struct nrf91_tickless_dev_s));
|
||||||
|
|
||||||
g_tickless_dev.rtc = nrf91_rtc_init(CONFIG_NRF91_SYSTIMER_RTC_INSTANCE);
|
g_tickless_dev.rtc = nrf91_rtc_init(CONFIG_NRF91_SYSTIMER_RTC_INSTANCE);
|
||||||
|
|
@ -339,6 +351,5 @@ void up_timer_initialize(void)
|
||||||
|
|
||||||
/* kick off alarm scheduling */
|
/* kick off alarm scheduling */
|
||||||
|
|
||||||
ts.tv_sec = ts.tv_nsec = 0;
|
nxsched_timer_expiration();
|
||||||
nxsched_alarm_expiration(&ts);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,9 +313,6 @@ static int stm32_tickless_setchannel(uint8_t channel)
|
||||||
|
|
||||||
static void stm32_interval_handler(void)
|
static void stm32_interval_handler(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
struct timespec tv;
|
|
||||||
#endif
|
|
||||||
tmrinfo("Expired...\n");
|
tmrinfo("Expired...\n");
|
||||||
|
|
||||||
/* Disable the compare interrupt now. */
|
/* Disable the compare interrupt now. */
|
||||||
|
|
@ -325,12 +322,7 @@ static void stm32_interval_handler(void)
|
||||||
|
|
||||||
g_tickless.pending = false;
|
g_tickless.pending = false;
|
||||||
|
|
||||||
#ifndef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
nxsched_timer_expiration();
|
nxsched_timer_expiration();
|
||||||
#else
|
|
||||||
up_timer_gettime(&tv);
|
|
||||||
nxsched_alarm_expiration(&tv);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
||||||
|
|
@ -300,9 +300,6 @@ static int stm32_tickless_setchannel(uint8_t channel)
|
||||||
|
|
||||||
static void stm32_interval_handler(void)
|
static void stm32_interval_handler(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
struct timespec tv;
|
|
||||||
#endif
|
|
||||||
tmrinfo("Expired...\n");
|
tmrinfo("Expired...\n");
|
||||||
|
|
||||||
/* Disable the compare interrupt now. */
|
/* Disable the compare interrupt now. */
|
||||||
|
|
@ -312,12 +309,7 @@ static void stm32_interval_handler(void)
|
||||||
|
|
||||||
g_tickless.pending = false;
|
g_tickless.pending = false;
|
||||||
|
|
||||||
#ifndef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
nxsched_timer_expiration();
|
nxsched_timer_expiration();
|
||||||
#else
|
|
||||||
up_timer_gettime(&tv);
|
|
||||||
nxsched_alarm_expiration(&tv);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
* Name: up_alarm_start
|
* Name: up_alarm_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Start the alarm. nxsched_alarm_expiration() will be called when the
|
* Start the alarm. nxsched_timer_expiration() will be called when the
|
||||||
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
||||||
*
|
*
|
||||||
* Provided by platform-specific code and called from the RTOS base code.
|
* Provided by platform-specific code and called from the RTOS base code.
|
||||||
|
|
@ -393,7 +393,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ts - The time in the future at the alarm is expected to occur. When
|
* ts - The time in the future at the alarm is expected to occur. When
|
||||||
* the alarm occurs the timer logic will call
|
* the alarm occurs the timer logic will call
|
||||||
* nxsched_alarm_expiration().
|
* nxsched_timer_expiration().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
|
@ -466,7 +466,7 @@ int up_timer_start(const struct timespec *ts)
|
||||||
* Description:
|
* Description:
|
||||||
* Cancel the alarm and return the time of cancellation of the alarm.
|
* Cancel the alarm and return the time of cancellation of the alarm.
|
||||||
* These two steps need to be as nearly atomic as possible.
|
* These two steps need to be as nearly atomic as possible.
|
||||||
* nxsched_alarm_expiration() will not be called unless the alarm is
|
* nxsched_timer_expiration() will not be called unless the alarm is
|
||||||
* restarted with up_alarm_start().
|
* restarted with up_alarm_start().
|
||||||
*
|
*
|
||||||
* If, as a race condition, the alarm has already expired when this
|
* If, as a race condition, the alarm has already expired when this
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,7 @@ static void avrdx_check_alarm_expired(uint8_t context)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
avrdx_deactivate_alarm();
|
avrdx_deactivate_alarm();
|
||||||
up_timer_gettime(&tv);
|
nxsched_timer_expiration();
|
||||||
nxsched_alarm_expiration(&tv);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ int weak_function up_timer_gettime(struct timespec *ts)
|
||||||
* Description:
|
* Description:
|
||||||
* Cancel the alarm and return the time of cancellation of the alarm.
|
* Cancel the alarm and return the time of cancellation of the alarm.
|
||||||
* These two steps need to be as nearly atomic as possible.
|
* These two steps need to be as nearly atomic as possible.
|
||||||
* nxsched_alarm_expiration() will not be called unless the alarm is
|
* nxsched_timer_expiration() will not be called unless the alarm is
|
||||||
* restarted with up_alarm_start().
|
* restarted with up_alarm_start().
|
||||||
*
|
*
|
||||||
* If, as a race condition, the alarm has already expired when this
|
* If, as a race condition, the alarm has already expired when this
|
||||||
|
|
@ -348,14 +348,14 @@ int weak_function up_alarm_tick_cancel(FAR clock_t *ticks)
|
||||||
* Name: up_alarm_start
|
* Name: up_alarm_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Start the alarm. nxsched_alarm_expiration() will be called when the
|
* Start the alarm. nxsched_timer_expiration() will be called when the
|
||||||
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
||||||
*
|
*
|
||||||
* Provided by platform-specific code and called from the RTOS base code.
|
* Provided by platform-specific code and called from the RTOS base code.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ts - The time in the future at the alarm is expected to occur. When the
|
* ts - The time in the future at the alarm is expected to occur. When the
|
||||||
* alarm occurs the timer logic will call nxsched_alarm_expiration().
|
* alarm occurs the timer logic will call nxsched_timer_expiration().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
|
|
||||||
|
|
@ -1885,13 +1885,8 @@ void up_timer_initialize(void);
|
||||||
* The RTOS will provide the following interfaces for use by the platform-
|
* The RTOS will provide the following interfaces for use by the platform-
|
||||||
* specific interval timer implementation:
|
* specific interval timer implementation:
|
||||||
*
|
*
|
||||||
* #ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
* void nxsched_alarm_expiration(FAR const struct timespec *ts): Called
|
|
||||||
* by the platform-specific logic when the alarm expires.
|
|
||||||
* #else
|
|
||||||
* void nxsched_timer_expiration(void): Called by the platform-specific
|
* void nxsched_timer_expiration(void): Called by the platform-specific
|
||||||
* logic when the interval timer expires.
|
* logic when the interval timer expires.
|
||||||
* #endif
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
@ -1938,7 +1933,7 @@ void up_timer_getmask(FAR clock_t *mask);
|
||||||
* Description:
|
* Description:
|
||||||
* Cancel the alarm and return the time of cancellation of the alarm.
|
* Cancel the alarm and return the time of cancellation of the alarm.
|
||||||
* These two steps need to be as nearly atomic as possible.
|
* These two steps need to be as nearly atomic as possible.
|
||||||
* nxsched_alarm_expiration() will not be called unless the alarm is
|
* nxsched_timer_expiration() will not be called unless the alarm is
|
||||||
* restarted with up_alarm_start().
|
* restarted with up_alarm_start().
|
||||||
*
|
*
|
||||||
* If, as a race condition, the alarm has already expired when this
|
* If, as a race condition, the alarm has already expired when this
|
||||||
|
|
@ -1978,7 +1973,7 @@ int up_alarm_tick_cancel(FAR clock_t *ticks);
|
||||||
* Name: up_alarm_start
|
* Name: up_alarm_start
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Start the alarm. nxsched_alarm_expiration() will be called when the
|
* Start the alarm. nxsched_timer_expiration() will be called when the
|
||||||
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
* alarm occurs (unless up_alaram_cancel is called to stop it).
|
||||||
*
|
*
|
||||||
* Provided by platform-specific code and called from the RTOS base code.
|
* Provided by platform-specific code and called from the RTOS base code.
|
||||||
|
|
@ -1986,7 +1981,7 @@ int up_alarm_tick_cancel(FAR clock_t *ticks);
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* ts - The time in the future at the alarm is expected to occur. When
|
* ts - The time in the future at the alarm is expected to occur. When
|
||||||
* the alarm occurs the timer logic will call
|
* the alarm occurs the timer logic will call
|
||||||
* nxsched_alarm_expiration().
|
* nxsched_timer_expiration().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
|
@ -2466,30 +2461,6 @@ void nxsched_process_timer(void);
|
||||||
void nxsched_timer_expiration(void);
|
void nxsched_timer_expiration(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nxsched_alarm_expiration
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* if CONFIG_SCHED_TICKLESS is defined, then this function is provided by
|
|
||||||
* the RTOS base code and called from platform-specific code when the
|
|
||||||
* alarm used to implement the tick-less OS expires.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* ts - The time that the alarm expired
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Assumptions/Limitations:
|
|
||||||
* Base code implementation assumes that this function is called from
|
|
||||||
* interrupt handling logic with interrupts disabled.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM)
|
|
||||||
void nxsched_alarm_expiration(FAR const struct timespec *ts);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxsched_get_next_expired
|
* Name: nxsched_get_next_expired
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -451,38 +451,6 @@ clock_t nxsched_timer_update(clock_t ticks, bool noswitches)
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nxsched_alarm_expiration
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* if CONFIG_SCHED_TICKLESS is defined, then this function is provided by
|
|
||||||
* the RTOS base code and called from platform-specific code when the
|
|
||||||
* alarm used to implement the tick-less OS expires.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* ts - The time that the alarm expired
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Assumptions/Limitations:
|
|
||||||
* Base code implementation assumes that this function is called from
|
|
||||||
* interrupt handling logic with interrupts disabled.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_TICKLESS_ALARM
|
|
||||||
void nxsched_alarm_expiration(FAR const struct timespec *ts)
|
|
||||||
{
|
|
||||||
clock_t ticks;
|
|
||||||
|
|
||||||
DEBUGASSERT(ts);
|
|
||||||
|
|
||||||
ticks = clock_time2ticks_floor(ts);
|
|
||||||
nxsched_timer_update(ticks, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxsched_timer_expiration
|
* Name: nxsched_timer_expiration
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue