From e7aa2c70a07a63328aa706d377e7a2c2b548ef82 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 23 Nov 2020 20:05:36 +0800 Subject: [PATCH] shell: use `connect()` instead of `try_connect()` We don't need to use `try_connect()` anymore since we now have `connect()` which will automatically retry as necessary. Signed-off-by: Sean Cross --- services/shell/src/main.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/services/shell/src/main.rs b/services/shell/src/main.rs index be9f78f54..d30ac0dbe 100644 --- a/services/shell/src/main.rs +++ b/services/shell/src/main.rs @@ -44,9 +44,6 @@ impl Rectangle { } } -#[cfg(baremetal)] -use utralib::generated::*; - fn move_lfsr(mut lfsr: u32) -> u32 { lfsr ^= lfsr >> 7; lfsr ^= lfsr << 9; @@ -54,15 +51,6 @@ fn move_lfsr(mut lfsr: u32) -> u32 { lfsr } -fn ensure_connection(server: xous::SID) -> xous::CID { - loop { - if let Ok(cid) = xous::syscall::try_connect(server) { - return cid; - } - xous::syscall::yield_slice(); - } -} - pub struct Bounce { vector: Point, radius: u16, @@ -136,9 +124,9 @@ fn shell_main() -> ! { let log_server_id = xous::SID::from_bytes(b"xous-log-server ").unwrap(); println!("SHELL: Attempting to connect to servers..."); - let log_conn = ensure_connection(log_server_id); - let graphics_conn = ensure_connection(graphics_server_id); - let ticktimer_conn = ensure_connection(ticktimer_server_id); + let log_conn = xous::connect(log_server_id).unwrap(); + let graphics_conn = xous::connect(graphics_server_id).unwrap(); + let ticktimer_conn = xous::connect(ticktimer_server_id).unwrap(); println!( "SHELL: Connected to Log server: {} Graphics server: {} Ticktimer server: {}", @@ -168,6 +156,7 @@ fn shell_main() -> ! { #[cfg(baremetal)] { + use utralib::generated::*; let gpio_base = xous::syscall::map_memory( xous::MemoryAddress::new(utra::gpio::HW_GPIO_BASE), None,