| Crates.io | fxmac_rs |
| lib.rs | fxmac_rs |
| version | 0.2.1 |
| created_at | 2026-01-24 11:17:02.164943+00 |
| updated_at | 2026-01-24 11:17:02.164943+00 |
| description | FXMAC Ethernet driver in Rust for PhytiumPi (Phytium Pi) board, supporting DMA-based packet transmission and reception. |
| homepage | https://github.com/elliott10/fxmac_rs |
| repository | https://github.com/elliott10/fxmac_rs |
| max_upload_size | |
| id | 2066540 |
| size | 3,040,300 |
fxmac ethernet driver in Rust on PhytiumPi board.
For instance, fxmac_rs ethernet driver in Rust on ArceOS

pub struct FXmacDriver;
#[crate_interface::impl_interface]
impl axdriver_net::fxmac::KernelFunc for FXmacDriver{
/// 虚拟地址转换成物理地址
fn virt_to_phys(addr: usize) -> usize {
}
/// 物理地址转换成虚拟地址
fn phys_to_virt(addr: usize) -> usize {
}
/// 申请页对齐的DMA连续内存页
/// 返回((cpu virtual address, dma physical address))
fn dma_alloc_coherent(pages: usize) -> (usize, usize) {
}
/// 释放DMA内存页
fn dma_free_coherent(vaddr: usize, pages: usize) {
}
/// 使能并注册网卡中断
fn dma_request_irq(_irq: usize, _handler: fn()) {
warn!("unimplemented dma_request_irq for fxmax");
}
}
let hwaddr: [u8; 6] = [0x55, 0x44, 0x33, 0x22, 0x11, 0x00];
let fxmac_device: &'static mut FXmac = fxmac_rs::fxmac::xmac_init(&hwaddr);
let mut tx_vec = Vec::new();
tx_vec.push(packet.to_vec());
FXmacLwipPortTx(fxmac_device, tx_vec);
let recv_packets = FXmacRecvHandler(fxmac_device);
cargo build --target=aarch64-unknown-none-softfloat
由于该驱动强依赖硬件与 DMA,建议分层补充测试并按能力选择运行环境:
cargo test --all-features、cargo test --docPHY: Motorcomm YT8521
