From 8e3b4625605e0493661c9cebcb8ca5fe1c36b35d Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 25 Mar 2022 17:50:26 +0800 Subject: [PATCH] get_destination_status: move from rtio to core1.rs --- src/runtime/src/kernel/api.rs | 5 ++--- src/runtime/src/kernel/core1.rs | 18 ++++++++++++++++++ src/runtime/src/kernel/mod.rs | 1 - src/runtime/src/kernel/rtio.rs | 19 ------------------- 4 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 src/runtime/src/kernel/rtio.rs diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index 7b4c01d..e86c2c2 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -13,8 +13,7 @@ use crate::i2c; use super::rpc::{rpc_send, rpc_send_async, rpc_recv}; use super::dma; use super::cache; -use super::rtio as kernel_rtio; - +use super::core1::get_destination_status; extern "C" { fn vsnprintf_(buffer: *mut c_char, count: size_t, format: *const c_char, va: VaList) -> c_int; @@ -88,7 +87,7 @@ pub fn resolve(required: &[u8]) -> Option { // rtio api!(rtio_init = rtio::init), - api!(rtio_get_destination_status = kernel_rtio::get_destination_status), + api!(rtio_get_destination_status = get_destination_status), api!(rtio_get_counter = rtio::get_counter), api!(rtio_output = rtio::output), api!(rtio_output_wide = rtio::output_wide), diff --git a/src/runtime/src/kernel/core1.rs b/src/runtime/src/kernel/core1.rs index 72725d1..9107bc4 100644 --- a/src/runtime/src/kernel/core1.rs +++ b/src/runtime/src/kernel/core1.rs @@ -233,3 +233,21 @@ extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32 } start } + +pub extern fn get_destination_status(destination: i32) -> bool { + #[cfg(has_drtio)] + if destination > 0 && destination < 255 { + let reply = unsafe { + let core1_rx = KERNEL_CHANNEL_0TO1.as_mut().unwrap(); + let core1_tx = KERNEL_CHANNEL_1TO0.as_mut().unwrap(); + core1_tx.send(Message::UpDestinationsRequest(destination)); + core1_rx.recv() + }; + return match reply { + Message::UpDestinationsReply(x) => x, + _ => panic!("received unexpected reply to UpDestinationsRequest: {:?}", reply) + }; + } + + destination == 0 +} \ No newline at end of file diff --git a/src/runtime/src/kernel/mod.rs b/src/runtime/src/kernel/mod.rs index c12cdb9..f1770a3 100644 --- a/src/runtime/src/kernel/mod.rs +++ b/src/runtime/src/kernel/mod.rs @@ -7,7 +7,6 @@ use crate::eh_artiq; mod control; pub use control::Control; pub mod core1; -pub mod rtio; mod api; mod rpc; mod dma; diff --git a/src/runtime/src/kernel/rtio.rs b/src/runtime/src/kernel/rtio.rs deleted file mode 100644 index bf04755..0000000 --- a/src/runtime/src/kernel/rtio.rs +++ /dev/null @@ -1,19 +0,0 @@ -use super::{KERNEL_CHANNEL_0TO1, KERNEL_CHANNEL_1TO0, Message}; - -pub extern fn get_destination_status(destination: i32) -> bool { - #[cfg(has_drtio)] - if destination > 0 && destination < 255 { - let reply = unsafe { - let core1_rx = KERNEL_CHANNEL_0TO1.as_mut().unwrap(); - let core1_tx = KERNEL_CHANNEL_1TO0.as_mut().unwrap(); - core1_tx.send(Message::UpDestinationsRequest(destination)); - core1_rx.recv() - }; - return match reply { - Message::UpDestinationsReply(x) => x, - _ => panic!("received unexpected reply to UpDestinationsRequest: {:?}", reply) - }; - } - - destination == 0 -} \ No newline at end of file