bsp::ethernet_phy::LwipPlatform
借用 ETH 句柄与 IPhy 的 LwIP 平台状态机。
构造与析构
4LwipPlatform
bsp::ethernet_phy::LwipPlatform::LwipPlatform (ETH_HandleTypeDef ð, IPhy &phy) noexcept
只保存借用引用并初始化成员;不访问 HAL、PHY 或 RTOS,不失败。 eth STM32 ETH 句柄,借用,生命周期须覆盖本对象全部使用期。 phy 具体 PHY 的 IPhy 接口,借用,生命周期须覆盖本对象全部使用期。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:63LwipPlatform
bsp::ethernet_phy::LwipPlatform::LwipPlatform (LwipPlatform &&)=delete
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:70LwipPlatform
bsp::ethernet_phy::LwipPlatform::LwipPlatform (const LwipPlatform &)=delete
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:68~LwipPlatform
bsp::ethernet_phy::LwipPlatform::~LwipPlatform ()=default
静态存储期对象;析构不销毁 PHY、不停止 MAC、不操作 RTOS。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:66成员函数
10init
bool bsp::ethernet_phy::LwipPlatform::init (struct netif &netif, const PhyLinkConfig &config) noexcept
一次性初始化:绑定 netif、置 link down,并把 config 原样交给 PHY 启动。 config 被原样传递给 phy_.start();本类不覆盖调用方配置,也不静默取能力交集, 不支持的模式由具体 IPhy::start 报错并令本函数返回 false。 netif 已建立的 LwIP 接口,仅借用,不拥有。 config 期望的链路配置,原样传递。 true 平台可用于 poll;false(未 prepare、重复 init 或 PHY 启动失败)。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:89input
void bsp::ethernet_phy::LwipPlatform::input (struct netif &netif, osSemaphoreId_t rx_semaphore, ReceiveFunction receive_fn)
RX 线程入口:等待给定信号量,逐包提交给 LwIP,提交失败则释放。 未 prepare、信号量为空、回调为空或 netif.input 为空时直接返回,不访问 HAL; 本函数不创建/删除任务或信号量。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:110operator=
LwipPlatform & bsp::ethernet_phy::LwipPlatform::operator= (LwipPlatform &&)=delete
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:71operator=
LwipPlatform & bsp::ethernet_phy::LwipPlatform::operator= (const LwipPlatform &)=delete
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:69poll
bool bsp::ethernet_phy::LwipPlatform::poll () noexcept
读取 PHY 链路并按需切换 MAC 与 netif link。 true 本轮状态已处理(含正常断链/协商);false 表示 PHY 读取或 MAC 配置/启停失败,链路保持在 down。本函数不重试,错误处理留给调用方。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:96prepare
bool bsp::ethernet_phy::LwipPlatform::prepare () noexcept
创建本实例的静态 RX 互斥体;不注册 MSP、不启动 PHY。 true 已就绪(可重复调用,幂等);false 互斥体创建失败,调用方须终止初始化。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:77receive
struct pbuf * bsp::ethernet_phy::LwipPlatform::receive (struct netif &netif, ReceiveFunction receive_fn)
在 RX 互斥体内执行原始接收回调,返回前释放互斥体。 收到的 pbuf,或 nullptr(未 prepare、空回调或取锁失败)。不得从 ISR 调用。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:102setLinkDownLocked
void bsp::ethernet_phy::LwipPlatform::setLinkDownLocked () noexcept
在 core lock 内置链路为 down(幂等)。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:114startMacLocked
bool bsp::ethernet_phy::LwipPlatform::startMacLocked (std::uint32_t speed, std::uint32_t duplex) noexcept
配置并启动 MAC;前置:已持 core lock 且 MAC 已停止。 true 仅当 Get/Set/Start 全部成功。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:127stopMacLocked
bool bsp::ethernet_phy::LwipPlatform::stopMacLocked () noexcept
停止 MAC;前置:已持 core lock,内部获取/释放 RX 互斥体。 true 已停止或本就未启动;false 取锁失败或 HAL_ETH_Stop_IT 失败, 此时保留 mac_started_(停止失败不得谎称已停)。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:121成员变量
10applied_state_
PhyLinkState bsp::ethernet_phy::LwipPlatform::applied_state_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:140bound_netif_
struct netif* bsp::ethernet_phy::LwipPlatform::bound_netif_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:138eth_
ETH_HandleTypeDef& bsp::ethernet_phy::LwipPlatform::eth_
借用,不拥有。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:129init_attempted_
bool bsp::ethernet_phy::LwipPlatform::init_attempted_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:136initialized_
bool bsp::ethernet_phy::LwipPlatform::initialized_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:135mac_started_
bool bsp::ethernet_phy::LwipPlatform::mac_started_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:137phy_
IPhy& bsp::ethernet_phy::LwipPlatform::phy_
借用,不拥有。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:130prepared_
bool bsp::ethernet_phy::LwipPlatform::prepared_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:134rx_mutex_
osMutexId_t bsp::ethernet_phy::LwipPlatform::rx_mutex_
上游未提供说明。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:133rx_mutex_storage_
StaticSemaphore_t bsp::ethernet_phy::LwipPlatform::rx_mutex_storage_
本实例静态互斥体控制块。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:132嵌套类型
1ReceiveFunction
using bsp::ethernet_phy::LwipPlatform::ReceiveFunction = struct pbuf* (*)(struct netif*)
原始接收回调类型;负责 DMA/RX pool 读取,返回收到的 pbuf 或 nullptr。
bsp/ethernet/lwip_platform/LwipPlatform.hpp:56