runtime: added drtio init function

drtio_port
mwojcik 2021-09-21 11:13:36 +02:00
parent 589c4bebe4
commit da366b7a0d
1 changed files with 16 additions and 1 deletions

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> {
unsafe {
if pl::csr::rtio_core::async_error_read() != 0 {
@ -177,7 +190,9 @@ pub fn main_core0() {
let up_destinations = [false; drtio_routing::DEST_COUNT];
#[cfg(has_drtio_routing)]
drtio_routing::interconnect_disable_all();
#[cfg(has_drtio)]
init_drtio(&mut timer);
init_rtio(&mut timer, &cfg);
task::spawn(report_async_rtio_errors());