runtime: added drtio init function

This commit is contained in:
mwojcik 2021-09-21 11:13:36 +02:00
parent 589c4bebe4
commit da366b7a0d

View File

@ -89,6 +89,19 @@ fn init_rtio(timer: &mut GlobalTimer, cfg: &Config) {
} }
} }
#[cfg(has_drtio)]
fn init_drtio(timer: &mut GlobalTimer)
{
unsafe {
csr::drtio_transceiver::stable_clkin_write(1);
}
timer.delay_ms(2); // wait for CPLL/QPLL lock
unsafe {
csr::drtio_transceiver::txenable_write(0xffffffffu32 as _);
}
}
fn wait_for_async_rtio_error() -> nb::Result<(), Void> { fn wait_for_async_rtio_error() -> nb::Result<(), Void> {
unsafe { unsafe {
if pl::csr::rtio_core::async_error_read() != 0 { if pl::csr::rtio_core::async_error_read() != 0 {
@ -177,6 +190,8 @@ pub fn main_core0() {
let up_destinations = [false; drtio_routing::DEST_COUNT]; let up_destinations = [false; drtio_routing::DEST_COUNT];
#[cfg(has_drtio_routing)] #[cfg(has_drtio_routing)]
drtio_routing::interconnect_disable_all(); drtio_routing::interconnect_disable_all();
#[cfg(has_drtio)]
init_drtio(&mut timer);
init_rtio(&mut timer, &cfg); init_rtio(&mut timer, &cfg);
task::spawn(report_async_rtio_errors()); task::spawn(report_async_rtio_errors());