mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef CONFIG_RTC
|
||||
# include <arch/irq.h>
|
||||
# include <nuttx/irq.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@@ -256,9 +256,9 @@ void clock_synchronize(void)
|
||||
|
||||
/* Re-initialize the time value to match the RTC */
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
clock_inittime();
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
@@ -109,7 +109,7 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
|
||||
* possible.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the elapsed time since power up (in milliseconds). This is a
|
||||
* bias value that we need to use to correct the base time.
|
||||
@@ -146,7 +146,7 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
|
||||
up_rtc_settime(tp);
|
||||
}
|
||||
#endif
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
sdbg("basetime=(%ld,%lu) bias=(%ld,%lu)\n",
|
||||
(long)g_basetime.tv_sec, (unsigned long)g_basetime.tv_nsec,
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
@@ -53,10 +54,6 @@
|
||||
|
||||
#undef clock_systimer
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -115,9 +112,9 @@ systime_t clock_systimer(void)
|
||||
|
||||
/* 64-bit accesses are not atomic on most architectures. */
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
sample = g_system_timer;
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
return sample;
|
||||
|
||||
# else /* CONFIG_SYSTEM_TIME64 */
|
||||
|
||||
Reference in New Issue
Block a user