fxmac_rs 技术文档
路径:
components/fxmac_rs类型:库 crate 分层:组件层 / 可复用基础组件 版本:0.4.1文档依据:当前仓库源码、Cargo.toml与components/fxmac_rs/README.md
fxmac_rs 的核心定位是:FXMAC Ethernet driver in Rust for PhytiumPi (Phytium Pi) board, supporting DMA-based packet transmission and reception.
1. 架构设计分析
- 目录角色:可复用基础组件
- crate 形态:库 crate
- 工作区位置:根工作区
- feature 视角:主要通过
debug控制编译期能力装配。 - 关键数据结构:可直接观察到的关键数据结构/对象包括
FXmac、FXmacConfig、FXmacQueue、FXmacBdRing、FXmacNetifBuffer、FXmacPhyInterface、FXmacBd、FXmacIntrHandler、FXMAC_HANDLER_DMASEND、FXMAC_HANDLER_DMARECV等(另有 1 个关键类型/对象)。 - 设计重心:该 crate 通常作为多个内核子系统共享的底层构件,重点在接口边界、数据结构和被上层复用的方式。
1.1 内部模块划分
fxmac_const:FXMAC hardware register offsets and bit definitions. This module mirrors the low-level register layout from the FXMAC hardware specification and is primarily intended for internal…fxmac:Core FXMAC Ethernet controller functionality. This module provides the main data structures and functions for controlling the FXMAC Ethernet MAC controllerfxmac_dma:DMA buffer descriptor management for FXMAC Ethernet. This module handles DMA-based packet transmission and reception, including buffer descriptor ring managementfxmac_intr:Interrupt handling for FXMAC Ethernet controller. This module provides interrupt handlers and ISR setup functions for handling TX/RX completion, errors, and link status changesfxmac_phy:PHY management for FXMAC Ethernet controller. This module provides functions for PHY initialization, configuration, and management through the MDIO interfaceutils:Architecture helpers for FXMAC on supported targets. This module provides low-level helpers (CPU ID, barriers, cache ops) used by the driver on aarch64 platforms