变更点: 1. CAN-FD(device/CANFD.cpp、sys/config.h) - 发送统一 FD+BRS(DLC≤8 不再回退经典 CAN);OTA 期仍按通道压制 BRS - 空通道自动识别:连续 5 个 1Hz 窗口无有效帧且有错误 → 静默上报;有帧即恢复 - 三路 CAN 默认全开;RX parse budget 48→64 2. EtherCAT 桥 / PDO - 段1 增 txtxid/rx00ff;版本应答 0x00FF 粘滞发布,避免被 CONFIG 冲掉 - STATUS 禁止写入 xrx 快照;processSeq 新鲜度救援 3. OTA / 配置 - sys/config.h include 仓库内 shared/ota_layout.h(与 BOOT 共用,不再依赖仓外路径) - ota_boot_request 对齐配置页 word 布局 4. docs/audit_ecat_spi_wifi_ota_compatibility.md:ECAT/SPI/WiFi/OTA 兼容性审计 5. .gitignore:忽略 .trae/、docs/traework-import、评审过程稿
41 lines
1.6 KiB
C++
41 lines
1.6 KiB
C++
/**
|
|
* @file ethercat_slave.h
|
|
* @brief EtherCAT 从站 init 探针与运行状态查询接口。
|
|
* @note 运行期 PDO 交换由 SSC 协议栈完成 —— 周期路径为 Sync0_Isr →
|
|
* ECAT_Application → APPL_InputMapping/OutputMapping(comm/ssc/port/dc_app.c),
|
|
* 主循环路径为 MainLoop → ECAT_Main。本类仅保留 init 探针与诊断查询。
|
|
*/
|
|
#ifndef COMM_ETHERCAT_SLAVE_H
|
|
#define COMM_ETHERCAT_SLAVE_H
|
|
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
|
|
/** @brief EtherCAT AL 状态码(EtherCAT 协议定义,ESC AL Status 寄存器低 4 位)。 */
|
|
constexpr uint8_t AL_STATE_SAFEOP = 0x04U; /**< SAFEOP 状态(SYNC0 可触发下限)。 */
|
|
|
|
/**
|
|
* @brief EtherCAT 从站 init 探针与状态查询。
|
|
*/
|
|
class EthercatSlave {
|
|
public:
|
|
/** @brief 初始化 ESC(HBI 探活 + 芯片 ID + AL 状态),供 init 汇总诊断。 */
|
|
static void init();
|
|
|
|
/** @brief ESC 自检是否通过(init 后可查询,用于决定是否使能同步中断)。 */
|
|
static bool isEscReady() { return s_escReady; }
|
|
|
|
/** @brief 读取 ESC 芯片 ID(供诊断打印;未就绪时为上次读到的值)。 */
|
|
static uint32_t getChipId() { return s_chipId; }
|
|
|
|
/** @brief 读取 ESC AL 状态码(供诊断打印;未就绪时为上次读到的值)。 */
|
|
static uint8_t getAlState() { return s_alState; }
|
|
|
|
private:
|
|
static bool s_escReady; /**< ESC 自检结果(init 后置位)。 */
|
|
static uint32_t s_chipId; /**< ESC 芯片 ID(诊断用)。 */
|
|
static uint8_t s_alState; /**< ESC AL 状态码(init 后可查询,供 isEscReady 守卫)。 */
|
|
};
|
|
|
|
#endif /* COMM_ETHERCAT_SLAVE_H */
|