优化代码,修改 FALLTHROUGH 宏定义,增加递归互斥锁支持,改进调度器挂起和恢复逻辑,增强命令查找功能
This commit is contained in:
@@ -27,14 +27,7 @@ void os_int_exit(void)
|
||||
|
||||
bool os_is_isr_context(void)
|
||||
{
|
||||
if (int_flag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return xPortInIsrContext() || (int_flag > 0);
|
||||
}
|
||||
|
||||
void os_interrupt_disable(void)
|
||||
@@ -49,12 +42,22 @@ void os_interrupt_enable(void)
|
||||
|
||||
void os_scheduler_suspend(void)
|
||||
{
|
||||
// 在进入临界区前检查是否在中断上下文中
|
||||
if (os_is_isr_context())
|
||||
{
|
||||
OS_ERR("Called in isr"); // 在中断中不要挂起调度器,可能会导致死锁
|
||||
return;
|
||||
}
|
||||
vTaskSuspendAll();
|
||||
}
|
||||
|
||||
void os_scheduler_resume(void)
|
||||
{
|
||||
xTaskResumeAll();
|
||||
// 只有在非中断上下文中才恢复调度器
|
||||
if (!os_is_isr_context())
|
||||
{
|
||||
xTaskResumeAll();
|
||||
}
|
||||
}
|
||||
|
||||
bool os_scheduler_is_running(void)
|
||||
|
||||
Reference in New Issue
Block a user