forked from M-Labs/artiq-zynq
runtime: use GlobalTimer
This commit is contained in:
parent
8e99c5eb7a
commit
c4ce42f7a4
|
@ -16,6 +16,7 @@ use libboard_zynq::{
|
|||
iface::{NeighborCache, EthernetInterfaceBuilder, Routes},
|
||||
time::Instant,
|
||||
},
|
||||
timer::GlobalTimer,
|
||||
};
|
||||
use libsupport_zynq::alloc::{vec, vec::Vec};
|
||||
use libasync::{smoltcp::{Sockets, TcpStream}, task};
|
||||
|
@ -205,7 +206,7 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
|
|||
const HWADDR: [u8; 6] = [0, 0x23, 0xab, 0xad, 0x1d, 0xea];
|
||||
const IPADDR: IpAddress = IpAddress::Ipv4(Ipv4Address([192, 168, 1, 52]));
|
||||
|
||||
pub fn main() {
|
||||
pub fn main(timer: GlobalTimer) {
|
||||
let eth = zynq::eth::Eth::default(HWADDR.clone());
|
||||
const RX_LEN: usize = 8;
|
||||
let mut rx_descs = (0..RX_LEN)
|
||||
|
@ -257,9 +258,7 @@ pub fn main() {
|
|||
}
|
||||
});
|
||||
|
||||
let mut time = 0u32;
|
||||
Sockets::run(&mut iface, || {
|
||||
time += 1;
|
||||
Instant::from_millis(time)
|
||||
Instant::from_millis(timer.get_time().0 as i32)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use core::{cmp, str};
|
|||
use libboard_zynq::{
|
||||
println,
|
||||
self as zynq, clocks::Clocks, clocks::source::{ClockSource, ArmPll, IoPll},
|
||||
timer::GlobalTimer,
|
||||
};
|
||||
use libsupport_zynq::{logger, ram};
|
||||
|
||||
|
@ -45,8 +46,9 @@ pub fn main_core0() {
|
|||
libboard_zynq::stdio::drop_uart(); // reinitialize UART after clocking change
|
||||
let mut ddr = zynq::ddr::DdrRam::new();
|
||||
ram::init_alloc(&mut ddr);
|
||||
let timer = GlobalTimer::new();
|
||||
|
||||
println!("Detected gateware: {}", identifier_read(&mut [0; 64]));
|
||||
|
||||
comms::main();
|
||||
comms::main(timer);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue