From cfe53a57a370e375ee38cdea78d310894ba18969 Mon Sep 17 00:00:00 2001 From: MorganTL Date: Fri, 18 Aug 2023 13:34:25 +0800 Subject: [PATCH] - runtime: replace block_sync with r#yield - runtime: chagne cfg that uses has_drtio - satman: chagne cfg that uses has_drtio --- src/runtime/src/main.rs | 21 +++------------------ src/satman/src/main.rs | 4 ++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/runtime/src/main.rs b/src/runtime/src/main.rs index 3d6ebdc..4f6433e 100644 --- a/src/runtime/src/main.rs +++ b/src/runtime/src/main.rs @@ -104,29 +104,14 @@ async fn report_async_rtio_errors() { } } -#[cfg(all(feature = "target_kasli_soc", has_drtio))] -static mut LAST_VIRTUAL_LED_STATUS: u8 = 0; - -#[cfg(all(feature = "target_kasli_soc", has_drtio))] +#[cfg(feature = "target_kasli_soc")] async fn io_expanders_service( i2c_bus: RefCell<&mut libboard_zynq::i2c::I2c>, io_expander0: RefCell, io_expander1: RefCell, ) { loop { - let _ = block_async!((|| -> nb::Result<(), Void> { - unsafe { - let current = pl::csr::virtual_leds::status_read(); - if current != LAST_VIRTUAL_LED_STATUS { - LAST_VIRTUAL_LED_STATUS = current; - Ok(()) - } else { - Err(nb::Error::WouldBlock) - } - } - })()) - .await; - + task::r#yield().await; io_expander0 .borrow_mut() .service(&mut i2c_bus.borrow_mut()) @@ -192,7 +177,7 @@ pub fn main_core0() { task::spawn(report_async_rtio_errors()); - #[cfg(all(feature = "target_kasli_soc", has_drtio))] + #[cfg(feature = "target_kasli_soc")] task::spawn(io_expanders_service( RefCell::new(i2c_bus), RefCell::new(io_expander0), diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index 6fcd991..db82244 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -671,7 +671,7 @@ pub extern "C" fn main_core0() -> i32 { for mut rep in repeaters.iter_mut() { rep.service(&routing_table, rank, &mut timer); } - #[cfg(all(feature = "target_kasli_soc", has_drtio))] + #[cfg(feature = "target_kasli_soc")] { io_expander0 .service(&mut i2c) @@ -717,7 +717,7 @@ pub extern "C" fn main_core0() -> i32 { for mut rep in repeaters.iter_mut() { rep.service(&routing_table, rank, &mut timer); } - #[cfg(all(feature = "target_kasli_soc", has_drtio))] + #[cfg(feature = "target_kasli_soc")] { io_expander0 .service(&mut i2c)