mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
[kernel]add api rt_hw_interrupt_is_disabled (#7706)
This commit is contained in:
@@ -119,13 +119,16 @@ while (0)
|
||||
* 1) the scheduler has been started.
|
||||
* 2) not in interrupt context.
|
||||
* 3) scheduler is not locked.
|
||||
* 4) interrupt is not disabled.
|
||||
*/
|
||||
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check) \
|
||||
do \
|
||||
{ \
|
||||
if (need_check) \
|
||||
{ \
|
||||
rt_bool_t interrupt_disabled; \
|
||||
rt_base_t level; \
|
||||
interrupt_disabled = rt_hw_interrupt_is_disabled(); \
|
||||
level = rt_hw_interrupt_disable(); \
|
||||
if (rt_critical_level() != 0) \
|
||||
{ \
|
||||
@@ -133,6 +136,12 @@ do \
|
||||
__FUNCTION__); \
|
||||
RT_ASSERT(0) \
|
||||
} \
|
||||
if (interrupt_disabled == RT_TRUE) \
|
||||
{ \
|
||||
rt_kprintf("Function[%s]: interrupt is disabled\n", \
|
||||
__FUNCTION__); \
|
||||
RT_ASSERT(0) \
|
||||
} \
|
||||
RT_DEBUG_IN_THREAD_CONTEXT; \
|
||||
rt_hw_interrupt_enable(level); \
|
||||
} \
|
||||
|
||||
@@ -126,11 +126,11 @@ void rt_hw_local_irq_enable(rt_base_t level);
|
||||
|
||||
#define rt_hw_interrupt_disable rt_cpus_lock
|
||||
#define rt_hw_interrupt_enable rt_cpus_unlock
|
||||
|
||||
#else
|
||||
rt_base_t rt_hw_interrupt_disable(void);
|
||||
void rt_hw_interrupt_enable(rt_base_t level);
|
||||
#endif /*RT_USING_SMP*/
|
||||
rt_bool_t rt_hw_interrupt_is_disabled(void);
|
||||
|
||||
/*
|
||||
* Context interfaces
|
||||
|
||||
Reference in New Issue
Block a user