fixup: add Kconfig option

This commit is contained in:
Shell 2024-04-19 13:13:31 +08:00 committed by Meco Man
parent 8c4db32d04
commit d1bb01621b
4 changed files with 15 additions and 9 deletions

View File

@ -184,7 +184,7 @@ struct rt_spinlock
#define _SPIN_UNLOCK_DEBUG_OWNER(lock) RT_UNUSED(lock) #define _SPIN_UNLOCK_DEBUG_OWNER(lock) RT_UNUSED(lock)
#endif /* RT_DEBUGING_SPINLOCK */ #endif /* RT_DEBUGING_SPINLOCK */
#ifdef RT_USING_DEBUG #ifdef RT_DEBUGING_CRITICAL
#define _SPIN_LOCK_DEBUG_CRITICAL(lock) \ #define _SPIN_LOCK_DEBUG_CRITICAL(lock) \
do \ do \
{ \ { \
@ -197,11 +197,11 @@ struct rt_spinlock
(critical) = (lock)->critical_level; \ (critical) = (lock)->critical_level; \
} while (0) } while (0)
#else /* !RT_USING_DEBUG */ #else /* !RT_DEBUGING_CRITICAL */
#define _SPIN_LOCK_DEBUG_CRITICAL(lock) RT_UNUSED(lock) #define _SPIN_LOCK_DEBUG_CRITICAL(lock) RT_UNUSED(lock)
#define _SPIN_UNLOCK_DEBUG_CRITICAL(lock, critical) do {critical = 0; RT_UNUSED(lock);} while (0) #define _SPIN_UNLOCK_DEBUG_CRITICAL(lock, critical) do {critical = 0; RT_UNUSED(lock);} while (0)
#endif /* RT_USING_DEBUG */ #endif /* RT_DEBUGING_CRITICAL */
#define RT_SPIN_LOCK_DEBUG(lock) \ #define RT_SPIN_LOCK_DEBUG(lock) \
do \ do \

View File

@ -239,6 +239,12 @@ menuconfig RT_USING_DEBUG
bool "Enable spinlock debugging" bool "Enable spinlock debugging"
depends on RT_USING_SMP depends on RT_USING_SMP
default n default n
config RT_DEBUGING_CRITICAL
bool "Enable critical level tracing"
depends on RT_USING_SMP
default y if RT_USING_SMART
default n
endif endif
menu "Inter-Thread communication" menu "Inter-Thread communication"

View File

@ -1056,7 +1056,7 @@ void rt_sched_post_ctx_switch(struct rt_thread *thread)
pcpu->current_thread = thread; pcpu->current_thread = thread;
} }
#ifdef RT_USING_DEBUG #ifdef RT_DEBUGING_CRITICAL
static volatile int _critical_error_occurred = 0; static volatile int _critical_error_occurred = 0;
@ -1083,14 +1083,14 @@ void rt_exit_critical_safe(rt_base_t critical_level)
rt_exit_critical(); rt_exit_critical();
} }
#else #else /* !RT_DEBUGING_CRITICAL */
void rt_exit_critical_safe(rt_base_t critical_level) void rt_exit_critical_safe(rt_base_t critical_level)
{ {
return rt_exit_critical(); return rt_exit_critical();
} }
#endif #endif /* RT_DEBUGING_CRITICAL */
RTM_EXPORT(rt_exit_critical_safe); RTM_EXPORT(rt_exit_critical_safe);
/** /**

View File

@ -451,7 +451,7 @@ void rt_sched_remove_thread(struct rt_thread *thread)
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
} }
#ifdef RT_USING_DEBUG #ifdef RT_DEBUGING_CRITICAL
static volatile int _critical_error_occurred = 0; static volatile int _critical_error_occurred = 0;
@ -482,14 +482,14 @@ void rt_exit_critical_safe(rt_base_t critical_level)
rt_exit_critical(); rt_exit_critical();
} }
#else #else /* !RT_DEBUGING_CRITICAL */
void rt_exit_critical_safe(rt_base_t critical_level) void rt_exit_critical_safe(rt_base_t critical_level)
{ {
rt_exit_critical(); rt_exit_critical();
} }
#endif #endif/* RT_DEBUGING_CRITICAL */
RTM_EXPORT(rt_exit_critical_safe); RTM_EXPORT(rt_exit_critical_safe);
/** /**