diff options
| author | guo <[email protected]> | 2023-06-21 22:42:50 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-21 22:42:50 +0800 |
| commit | 8d2072de5569840591d039478046b3c9ae6947aa (patch) | |
| tree | 0f893993ecbfd3ceb760da8a14f1be3849254edc /include/rtdebug.h | |
| parent | 74b15524db12c1d923eedf893f1729b19ec75af7 (diff) | |
[kernel]add api rt_hw_interrupt_is_disabled (#7706)
Diffstat (limited to 'include/rtdebug.h')
| -rw-r--r-- | include/rtdebug.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/rtdebug.h b/include/rtdebug.h index ac5ba6c1c5..76a9779a57 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -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); \ } \ |
