Compare commits

...

2 Commits

Author SHA1 Message Date
Astro c4ce42f7a4 runtime: use GlobalTimer 2020-04-25 01:36:15 +02:00
Astro 8e99c5eb7a Cargo.lock: cargo update 2020-04-25 01:35:47 +02:00
3 changed files with 45 additions and 14 deletions

48
Cargo.lock generated
View File

@ -45,13 +45,28 @@ checksum = "0f8cb7306107e4b10e64994de6d3274bd08996a7c1322a27b86482392f96be0a"
[[package]]
name = "dyld"
version = "0.1.0"
dependencies = [
"log",
]
[[package]]
name = "embedded-hal"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee4908a155094da7723c2d60d617b820061e3b4efcc3d9e293d206a5a76c170b"
dependencies = [
"nb",
"void",
]
[[package]]
name = "libasync"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#f8782f3f699ba0e749a639534553c9dc2599523e"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#63d71d021ca673d0b34a44279cd13e120d810835"
dependencies = [
"embedded-hal",
"libcortex_a9",
"nb",
"pin-utils",
"smoltcp",
]
@ -59,19 +74,22 @@ dependencies = [
[[package]]
name = "libboard_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#f8782f3f699ba0e749a639534553c9dc2599523e"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#63d71d021ca673d0b34a44279cd13e120d810835"
dependencies = [
"bit_field",
"embedded-hal",
"libcortex_a9",
"libregister",
"nb",
"smoltcp",
"void",
"volatile-register",
]
[[package]]
name = "libcortex_a9"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#f8782f3f699ba0e749a639534553c9dc2599523e"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#63d71d021ca673d0b34a44279cd13e120d810835"
dependencies = [
"bit_field",
"libregister",
@ -80,7 +98,7 @@ dependencies = [
[[package]]
name = "libregister"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#f8782f3f699ba0e749a639534553c9dc2599523e"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#63d71d021ca673d0b34a44279cd13e120d810835"
dependencies = [
"bit_field",
"vcell",
@ -90,7 +108,7 @@ dependencies = [
[[package]]
name = "libsupport_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#f8782f3f699ba0e749a639534553c9dc2599523e"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#63d71d021ca673d0b34a44279cd13e120d810835"
dependencies = [
"compiler_builtins",
"libboard_zynq",
@ -122,6 +140,12 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6"
[[package]]
name = "nb"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1411551beb3c11dedfb0a90a0fa256b47d28b9ec2cdff34c25a2fa59e45dbdc"
[[package]]
name = "num-derive"
version = "0.3.0"
@ -144,9 +168,9 @@ dependencies = [
[[package]]
name = "pin-utils"
version = "0.1.0-alpha.4"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "proc-macro2"
@ -200,9 +224,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213"
dependencies = [
"proc-macro2",
"quote",
@ -221,6 +245,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "volatile-register"
version = "0.2.0"

View File

@ -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)
});
}

View File

@ -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);
}