Compare commits

..

No commits in common. "4846f2891b3e4370047f77a14da85bd0bd1cd7b2" and "9b07468e50a5b1c78c49fc42f256a01298b463d8" have entirely different histories.

3 changed files with 23 additions and 19 deletions

22
src/Cargo.lock generated
View File

@ -111,9 +111,9 @@ dependencies = [
[[package]] [[package]]
name = "fatfs" name = "fatfs"
version = "0.3.4" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93079df23039e52059e1f03b4c29fb0c72da2c792aad91bb2236c9fb81d3592e" checksum = "f6d1df9e4503954f60504a5ee4fc435cd65cc42e98b2081f7f421be5f2e68e7d"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"byteorder", "byteorder",
@ -200,7 +200,7 @@ dependencies = [
[[package]] [[package]]
name = "libasync" name = "libasync"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#0aa75d3544a2092a0ba6ce689c3f025f22ec30e4" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#84f1380f4830055bfe69ca14b5ade527a5edef6b"
dependencies = [ dependencies = [
"embedded-hal", "embedded-hal",
"libcortex_a9", "libcortex_a9",
@ -212,7 +212,7 @@ dependencies = [
[[package]] [[package]]
name = "libboard_zynq" name = "libboard_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#0aa75d3544a2092a0ba6ce689c3f025f22ec30e4" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#84f1380f4830055bfe69ca14b5ade527a5edef6b"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"embedded-hal", "embedded-hal",
@ -236,7 +236,7 @@ dependencies = [
[[package]] [[package]]
name = "libcortex_a9" name = "libcortex_a9"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#0aa75d3544a2092a0ba6ce689c3f025f22ec30e4" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#84f1380f4830055bfe69ca14b5ade527a5edef6b"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"libregister", "libregister",
@ -251,7 +251,7 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]] [[package]]
name = "libregister" name = "libregister"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#0aa75d3544a2092a0ba6ce689c3f025f22ec30e4" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#84f1380f4830055bfe69ca14b5ade527a5edef6b"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"vcell", "vcell",
@ -261,7 +261,7 @@ dependencies = [
[[package]] [[package]]
name = "libsupport_zynq" name = "libsupport_zynq"
version = "0.0.0" version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zc706.git#0aa75d3544a2092a0ba6ce689c3f025f22ec30e4" source = "git+https://git.m-labs.hk/M-Labs/zc706.git#84f1380f4830055bfe69ca14b5ade527a5edef6b"
dependencies = [ dependencies = [
"compiler_builtins", "compiler_builtins",
"libboard_zynq", "libboard_zynq",
@ -379,9 +379,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.19" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
@ -443,9 +443,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.35" version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -90,7 +90,7 @@ impl Log for BufferLogger {
if self.enabled(record.metadata()) { if self.enabled(record.metadata()) {
let timestamp = unsafe { let timestamp = unsafe {
GlobalTimer::get() GlobalTimer::get()
}.get_us().0; }.get_us();
let seconds = timestamp / 1_000_000; let seconds = timestamp / 1_000_000;
let micros = timestamp % 1_000_000; let micros = timestamp % 1_000_000;

View File

@ -10,13 +10,13 @@ extern crate alloc;
use core::{cmp, str}; use core::{cmp, str};
use log::{info, warn, error}; use log::{info, warn, error};
use libboard_zynq::{timer::GlobalTimer, devc, slcr}; use libboard_zynq::{timer::GlobalTimer, time::Milliseconds, devc, slcr};
use libasync::{task, block_async}; use libasync::{task, block_async};
use libsupport_zynq::ram; use libsupport_zynq::ram;
use libregister::RegisterW; use libregister::RegisterW;
use nb; use nb;
use void::Void; use void::Void;
use embedded_hal::blocking::delay::DelayMs; use embedded_hal::timer::CountDown;
mod sd_reader; mod sd_reader;
mod config; mod config;
@ -89,7 +89,7 @@ fn identifier_read(buf: &mut [u8]) -> &str {
} }
} }
fn init_rtio(timer: &mut GlobalTimer, cfg: &config::Config) { fn init_rtio(timer: GlobalTimer, cfg: &config::Config) {
let clock_sel = let clock_sel =
if let Ok(rtioclk) = cfg.read_str("rtioclk") { if let Ok(rtioclk) = cfg.read_str("rtioclk") {
match rtioclk.as_ref() { match rtioclk.as_ref() {
@ -117,13 +117,17 @@ fn init_rtio(timer: &mut GlobalTimer, cfg: &config::Config) {
pl::csr::rtio_crg::clock_sel_write(clock_sel); pl::csr::rtio_crg::clock_sel_write(clock_sel);
} }
timer.delay_ms(2); let mut countdown = timer.countdown();
countdown.start(Milliseconds(2));
nb::block!(countdown.wait()).unwrap();
unsafe { unsafe {
pl::csr::rtio_crg::pll_reset_write(0); pl::csr::rtio_crg::pll_reset_write(0);
} }
timer.delay_ms(2); let mut countdown = timer.countdown();
countdown.start(Milliseconds(2));
nb::block!(countdown.wait()).unwrap();
let locked = unsafe { pl::csr::rtio_crg::pll_locked_read() != 0 }; let locked = unsafe { pl::csr::rtio_crg::pll_locked_read() != 0 };
if !locked { if !locked {
@ -171,7 +175,7 @@ static mut LOG_BUFFER: [u8; 1<<17] = [0; 1<<17];
#[no_mangle] #[no_mangle]
pub fn main_core0() { pub fn main_core0() {
let mut timer = GlobalTimer::start(); let timer = GlobalTimer::start();
let buffer_logger = unsafe { let buffer_logger = unsafe {
logger::BufferLogger::new(&mut LOG_BUFFER[..]) logger::BufferLogger::new(&mut LOG_BUFFER[..])
@ -195,7 +199,7 @@ pub fn main_core0() {
} }
}; };
init_rtio(&mut timer, &cfg); init_rtio(timer, &cfg);
task::spawn(report_async_rtio_errors()); task::spawn(report_async_rtio_errors());
comms::main(timer, &cfg); comms::main(timer, &cfg);