mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 05:55:46 +08:00
armv7/8-m: change enter_critical_section to up_irq_save
caused critical_monitor will gettime, that will caused enter_critical_seciton recursive Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -135,7 +135,7 @@ static int systick_getstatus(struct timer_lowerhalf_s *lower_,
|
|||||||
struct timer_status_s *status)
|
struct timer_status_s *status)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
irqstate_t flags = enter_critical_section();
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
status->flags = lower->callback ? TCFLAGS_HANDLER : 0;
|
status->flags = lower->callback ? TCFLAGS_HANDLER : 0;
|
||||||
status->flags |= systick_is_running() ? TCFLAGS_ACTIVE : 0;
|
status->flags |= systick_is_running() ? TCFLAGS_ACTIVE : 0;
|
||||||
@@ -161,7 +161,7 @@ static int systick_getstatus(struct timer_lowerhalf_s *lower_,
|
|||||||
status->timeleft = status->timeout;
|
status->timeleft = status->timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
up_irq_restore(flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +169,8 @@ static int systick_settimeout(struct timer_lowerhalf_s *lower_,
|
|||||||
uint32_t timeout)
|
uint32_t timeout)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
irqstate_t flags = enter_critical_section();
|
|
||||||
if (lower->next_interval)
|
if (lower->next_interval)
|
||||||
{
|
{
|
||||||
/* If the timer callback is in the process,
|
/* If the timer callback is in the process,
|
||||||
@@ -194,7 +194,7 @@ static int systick_settimeout(struct timer_lowerhalf_s *lower_,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
up_irq_restore(flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,11 +202,12 @@ static void systick_setcallback(struct timer_lowerhalf_s *lower_,
|
|||||||
tccb_t callback, void *arg)
|
tccb_t callback, void *arg)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
irqstate_t flags = enter_critical_section();
|
|
||||||
lower->callback = callback;
|
lower->callback = callback;
|
||||||
lower->arg = arg;
|
lower->arg = arg;
|
||||||
leave_critical_section(flags);
|
|
||||||
|
up_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int systick_maxtimeout(struct timer_lowerhalf_s *lower_,
|
static int systick_maxtimeout(struct timer_lowerhalf_s *lower_,
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ static int systick_getstatus(struct timer_lowerhalf_s *lower_,
|
|||||||
struct timer_status_s *status)
|
struct timer_status_s *status)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
irqstate_t flags = enter_critical_section();
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
status->flags = lower->callback ? TCFLAGS_HANDLER : 0;
|
status->flags = lower->callback ? TCFLAGS_HANDLER : 0;
|
||||||
status->flags |= systick_is_running() ? TCFLAGS_ACTIVE : 0;
|
status->flags |= systick_is_running() ? TCFLAGS_ACTIVE : 0;
|
||||||
@@ -161,7 +161,7 @@ static int systick_getstatus(struct timer_lowerhalf_s *lower_,
|
|||||||
status->timeleft = status->timeout;
|
status->timeleft = status->timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
up_irq_restore(flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +169,8 @@ static int systick_settimeout(struct timer_lowerhalf_s *lower_,
|
|||||||
uint32_t timeout)
|
uint32_t timeout)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
irqstate_t flags = enter_critical_section();
|
|
||||||
if (lower->next_interval)
|
if (lower->next_interval)
|
||||||
{
|
{
|
||||||
/* If the timer callback is in the process,
|
/* If the timer callback is in the process,
|
||||||
@@ -194,7 +194,7 @@ static int systick_settimeout(struct timer_lowerhalf_s *lower_,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
up_irq_restore(flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,11 +202,12 @@ static void systick_setcallback(struct timer_lowerhalf_s *lower_,
|
|||||||
tccb_t callback, void *arg)
|
tccb_t callback, void *arg)
|
||||||
{
|
{
|
||||||
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
struct systick_lowerhalf_s *lower = (struct systick_lowerhalf_s *)lower_;
|
||||||
|
irqstate_t flags = up_irq_save();
|
||||||
|
|
||||||
irqstate_t flags = enter_critical_section();
|
|
||||||
lower->callback = callback;
|
lower->callback = callback;
|
||||||
lower->arg = arg;
|
lower->arg = arg;
|
||||||
leave_critical_section(flags);
|
|
||||||
|
up_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int systick_maxtimeout(struct timer_lowerhalf_s *lower_,
|
static int systick_maxtimeout(struct timer_lowerhalf_s *lower_,
|
||||||
|
|||||||
Reference in New Issue
Block a user