diff --git a/axdriver_net/src/fxmac.rs b/axdriver_net/src/fxmac.rs index ff3e9bb..392deb5 100644 --- a/axdriver_net/src/fxmac.rs +++ b/axdriver_net/src/fxmac.rs @@ -1,18 +1,19 @@ +use crate::{EthernetAddress, NetBufPtr, NetDriverOps}; use alloc::boxed::Box; -use alloc::vec::Vec; use alloc::collections::VecDeque; -use core::ptr::NonNull; +use alloc::vec::Vec; use axdriver_base::{BaseDriverOps, DevError, DevResult, DeviceType}; -use crate::{EthernetAddress, NetBufPtr, NetDriverOps}; +use core::ptr::NonNull; +use fxmac_rs::{self, xmac_init, FXmac, FXmacLwipPortTx, FXmacRecvHandler}; use log::*; -use fxmac_rs::{self, FXmac, xmac_init, FXmacLwipPortTx, FXmacRecvHandler}; extern crate alloc; const QS: usize = 64; //const NET_BUF_LEN: usize = 1526; +/// fxmac driver device pub struct FXmacNic { inner: &'static mut FXmac, rx_buffer_queue: VecDeque, @@ -22,6 +23,7 @@ unsafe impl Sync for FXmacNic {} unsafe impl Send for FXmacNic {} impl FXmacNic { + /// initialize fxmac driver pub fn init(mapped_regs: usize) -> DevResult { info!("FXmacNic init @ {:#x}", mapped_regs); let rx_buffer_queue = VecDeque::with_capacity(QS); diff --git a/axdriver_net/src/lib.rs b/axdriver_net/src/lib.rs index 0002780..8742b9c 100644 --- a/axdriver_net/src/lib.rs +++ b/axdriver_net/src/lib.rs @@ -1,13 +1,14 @@ //! Common traits and types for network device (NIC) drivers. #![no_std] +#![feature(const_mut_refs)] -#[cfg(feature = "ixgbe")] -/// ixgbe NIC device driver. -pub mod ixgbe; #[cfg(feature = "fxmac")] /// fxmac driver for PhytiumPi pub mod fxmac; +#[cfg(feature = "ixgbe")] +/// ixgbe NIC device driver. +pub mod ixgbe; mod net_buf; use core::ptr::NonNull;