- 将设备相关文件重新组织为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配置项替代硬编码值
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
/**
|
|
* @file initial.cpp
|
|
* @brief 应用启动初始化实现。
|
|
*/
|
|
|
|
#include "sys/initial.h"
|
|
|
|
#include "device/canfd.h"
|
|
#include "device/temp_sensor.h"
|
|
#include "device/usart0.h"
|
|
#include "device/timer.h"
|
|
#include "device/adc.h"
|
|
#include "device/watchdog.h"
|
|
#include "device/spi/app_spi_command.h"
|
|
#include "sys/systick.h"
|
|
#include "sys/ota_boot_request.h"
|
|
#include "sys/task_manager.h"
|
|
#include "sys/config.h"
|
|
#if CONFIG_ETHERCAT_ENABLE
|
|
#include "comm/ethercat_slave.h"
|
|
#include "comm/ethercat_sync.h"
|
|
#endif
|
|
|
|
/**
|
|
* @brief 执行应用级外设与调度初始化。
|
|
* @param[in] 无。
|
|
* @param[out] 无。
|
|
* @retval 无返回值。
|
|
* @note 依次完成 SysTick、USART0、ADC/温度采样、CANFD、任务管理器与调度定时器的启动。
|
|
*/
|
|
void AppInitializer::init()
|
|
{
|
|
printf("[APP] init: SysTick...\r\n");
|
|
SysTickTimer::initMs();
|
|
printf("[APP] init: USART0...\r\n");
|
|
Usart0::configurePins();
|
|
Usart0::init();
|
|
printf("[APP] init: TempSensor...\r\n");
|
|
TempSensor::init();
|
|
printf("[APP] init: CANFD...\r\n");
|
|
CanFd::init();
|
|
printf("[APP] init: OtaBootRequest...\r\n");
|
|
OtaBootRequest::init();
|
|
printf("[APP] init: AppSpiCommand...\r\n");
|
|
AppSpiCommandBus.init();
|
|
printf("[APP] init: TaskManager...\r\n");
|
|
TaskManager::init();
|
|
printf("[APP] init: SchedulerTimer...\r\n");
|
|
SchedulerTimer::init();
|
|
#if CONFIG_ETHERCAT_ENABLE
|
|
printf("[APP] init: EthercatSlave...\r\n");
|
|
EthercatSlave::init();
|
|
printf("[APP] init: EthercatSync...\r\n");
|
|
EthercatSync::init();
|
|
#endif
|
|
printf("[APP] init: Watchdog...\r\n");
|
|
Watchdog::init();
|
|
printf("[APP] init: all done\r\n");
|
|
}
|