feat(cproject): 重构项目文件结构并添加EtherCAT通信支持

- 将设备相关文件重新组织为device/spi和comm分组
- 添加EtherCAT从站通信模块(esc_exmc_bus、esc_lan9252、ethercat_slave等)
- 添加EXMC外设组件支持
- 统一文件命名规范为小写

refactor(canfd): 优化CANFD模块中断安全性和配置方式

- 替换自定义临界区函数为RT_CRITICAL_SAVE/RESTORE宏
- 使用配置常量CONFIG_IRQ_PREEMPT_CAN替代硬编码值
- 简化邮箱满时的处理逻辑,移除不必要的SysTick等待
- 移除废弃的中断保存头文件引用

refactor(timer): 更新定时器配置以使用配置常量

- 修复头文件包含路径大小写问题
- 使用CONFIG_NVIC_PRIORITY_GROUP配置项替代硬编码值
This commit is contained in:
cbb
2026-06-26 00:57:59 +08:00
parent 86c0ec730b
commit 1612e326ee
32 changed files with 1378 additions and 147 deletions
+6 -31
View File
@@ -1,4 +1,4 @@
/**
/**
* @file task_manager.cpp
* @brief 任务调度管理器实现。
*/
@@ -6,32 +6,7 @@
#include "main.h"
#include "sys/task_manager.h"
#include "sys/config.h"
namespace {
/**
* @brief Enter a critical section and preserve the previous interrupt mask.
* @param[in] 无。
* @param[out] 无。
* @retval uint32_t Previous PRIMASK value.
*/
static uint32_t enterCriticalSection()
{
const uint32_t primask = __get_PRIMASK();
__disable_irq();
return primask;
}
/**
* @brief Exit a critical section by restoring the saved interrupt mask.
* @param[in] primask Previous PRIMASK value returned by `enterCriticalSection()`.
* @param[out] 无。
* @retval 无返回值。
*/
static void exitCriticalSection(uint32_t primask)
{
__set_PRIMASK(primask);
}
} // namespace
#include "sys/critical.h"
task_scheduler_t g_scheduler = {0};
@@ -68,9 +43,9 @@ void TaskManager::init()
*/
void TaskManager::set(uint32_t taskMask)
{
const uint32_t primask = enterCriticalSection();
uint32_t save = RT_CRITICAL_SAVE();
g_scheduler.task_flags |= taskMask;
exitCriticalSection(primask);
RT_CRITICAL_RESTORE(save);
}
/**
@@ -83,10 +58,10 @@ void TaskManager::set(uint32_t taskMask)
uint32_t TaskManager::takePending()
{
uint32_t pending;
const uint32_t primask = enterCriticalSection();
uint32_t save = RT_CRITICAL_SAVE();
pending = g_scheduler.task_flags;
g_scheduler.task_flags &= ~pending;
exitCriticalSection(primask);
RT_CRITICAL_RESTORE(save);
return pending;
}