1#![no_std]
21
22extern crate alloc;
23#[cfg(feature = "smoltcp")]
24#[macro_use]
25extern crate log;
26
27cfg_if::cfg_if! {
28 if #[cfg(feature = "smoltcp")] {
29 mod smoltcp_impl;
30 use smoltcp_impl as net_impl;
31 }
32}
33
34#[cfg(feature = "smoltcp")]
35use ax_driver::{AxDeviceContainer, AxNetDevice};
36
37#[cfg(feature = "smoltcp")]
38pub use self::net_impl::{
39 TcpSocket, UdpSocket, bench_receive, bench_transmit, dns_query, poll_interfaces,
40};
41
42#[cfg(feature = "smoltcp")]
44pub fn init_network(mut net_devs: AxDeviceContainer<AxNetDevice>) {
45 use ax_driver::prelude::*;
46
47 info!("Initialize network subsystem...");
48
49 if let Some(dev) = net_devs.take_one() {
50 info!(" use NIC 0: {:?}", dev.device_name());
51 net_impl::init(dev);
52 } else {
53 warn!(" No network device found!");
54 }
55}