- 将设备相关文件重新组织为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配置项替代硬编码值
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
/**
|
|
* @file esc_exmc_bus.h
|
|
* @brief LAN9252 ESC 的 EXMC 16-bit 并行总线抽象接口。
|
|
* @note 通过 EXMC NOR/SRAM Region1(NE1,基址 0x60000000)以内存映射方式访问 LAN9252。
|
|
* 16-bit 数据总线 + A16 地址线 + NOE/NWE/NE1 控制线。
|
|
*/
|
|
#ifndef COMM_ESC_EXMC_BUS_H
|
|
#define COMM_ESC_EXMC_BUS_H
|
|
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
|
|
/**
|
|
* @brief LAN9252 ESC 的 EXMC 并行总线驱动。
|
|
* @note 提供 16-bit 读写与块读写接口,内部通过内存映射地址直接访问 ESC 寄存器空间。
|
|
*/
|
|
class EscExmcBus {
|
|
public:
|
|
/** @brief 初始化 EXMC NOR/SRAM Region1 与全部 GPIO(AF 复用)。 */
|
|
static void init();
|
|
|
|
/**
|
|
* @brief 从指定偏移读取 16-bit 数据。
|
|
* @param[in] offset 地址偏移(字节)。
|
|
* @return uint16_t 读取的 16-bit 数据。
|
|
*/
|
|
static uint16_t read16(uint32_t offset);
|
|
|
|
/**
|
|
* @brief 向指定偏移写入 16-bit 数据。
|
|
* @param[in] offset 地址偏移(字节)。
|
|
* @param[in] data 待写入的 16-bit 数据。
|
|
*/
|
|
static void write16(uint32_t offset, uint16_t data);
|
|
|
|
/**
|
|
* @brief 从指定偏移连续读取一块 16-bit 数据。
|
|
* @param[in] offset 地址偏移(字节)。
|
|
* @param[out] buf 输出缓冲(以 uint16_t 为单位)。
|
|
* @param[in] count 读取的 16-bit 半字数量。
|
|
*/
|
|
static void readBlock(uint32_t offset, uint16_t *buf, size_t count);
|
|
|
|
/**
|
|
* @brief 向指定偏移连续写入一块 16-bit 数据。
|
|
* @param[in] offset 地址偏移(字节)。
|
|
* @param[in] buf 数据缓冲(以 uint16_t 为单位)。
|
|
* @param[in] count 写入的 16-bit 半字数量。
|
|
*/
|
|
static void writeBlock(uint32_t offset, const uint16_t *buf, size_t count);
|
|
};
|
|
|
|
#endif /* COMM_ESC_EXMC_BUS_H */
|