mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 13:52:22 +08:00
sched/init: Add OSINIT_IS_PANIC to replace 'g_nx_initstate == OSINIT_PANIC'
to simplify the code logic which need handle the panic in special way Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#define OSINIT_HW_READY() (g_nx_initstate >= OSINIT_HARDWARE)
|
||||
#define OSINIT_OS_READY() (g_nx_initstate >= OSINIT_OSREADY)
|
||||
#define OSINIT_IDLELOOP() (g_nx_initstate >= OSINIT_IDLELOOP)
|
||||
#define OSINIT_IS_PANIC() (g_nx_initstate >= OSINIT_PANIC)
|
||||
#define OSINIT_OS_INITIALIZING() (g_nx_initstate < OSINIT_OSREADY)
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
+3
-3
@@ -833,7 +833,7 @@ void _assert(FAR const char *filename, int linenum,
|
||||
struct panic_notifier_s notifier_data;
|
||||
irqstate_t flags;
|
||||
|
||||
if (g_nx_initstate == OSINIT_PANIC)
|
||||
if (OSINIT_IS_PANIC())
|
||||
{
|
||||
/* Already in fatal state, reset board directly. */
|
||||
|
||||
@@ -885,7 +885,7 @@ void _assert(FAR const char *filename, int linenum,
|
||||
notifier_data.filename = filename;
|
||||
notifier_data.linenum = linenum;
|
||||
notifier_data.msg = msg;
|
||||
panic_notifier_call_chain(g_nx_initstate == OSINIT_PANIC
|
||||
panic_notifier_call_chain(OSINIT_IS_PANIC()
|
||||
? PANIC_KERNEL : PANIC_TASK,
|
||||
¬ifier_data);
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
@@ -902,7 +902,7 @@ void _assert(FAR const char *filename, int linenum,
|
||||
dump_assert_info(rtcb, filename, linenum, msg, regs);
|
||||
#endif
|
||||
|
||||
if (g_nx_initstate == OSINIT_PANIC)
|
||||
if (OSINIT_IS_PANIC())
|
||||
{
|
||||
/* Dump fatal info of assertion. */
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ int sched_backtrace(pid_t tid, FAR void **buffer, int size, int skip)
|
||||
if (tcb != NULL)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
if (tcb->task_state == TSTATE_TASK_RUNNING &&
|
||||
g_nx_initstate != OSINIT_PANIC)
|
||||
if (!OSINIT_IS_PANIC() &&
|
||||
tcb->task_state == TSTATE_TASK_RUNNING)
|
||||
{
|
||||
struct backtrace_arg_s arg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user