use core::ptr; use alloc::{vec::Vec, string::String}; use libcortex_a9::{mutex::Mutex, sync_channel, semaphore::Semaphore}; use crate::eh_artiq; mod control; pub use control::Control; pub mod core1; mod api; mod rpc; mod dma; pub use dma::DmaRecorder; mod cache; #[derive(Debug, Clone)] pub struct RPCException { pub name: String, pub message: String, pub param: [i64; 3], pub file: String, pub line: i32, pub column: i32, pub function: String } #[derive(Debug, Clone)] pub enum Message { LoadRequest(Vec), LoadCompleted, LoadFailed, StartRequest, KernelFinished { async_errors: u8 }, KernelException(&'static eh_artiq::Exception<'static>, &'static [usize], u8), RpcSend { is_async: bool, data: Vec }, RpcRecvRequest(*mut ()), RpcRecvReply(Result), CacheGetRequest(String), CacheGetReply(Vec), CachePutRequest(String, Vec), DmaPutRequest(DmaRecorder), DmaEraseRequest(String), DmaGetRequest(String), DmaGetReply(Option<(Vec, i64)>), } static CHANNEL_0TO1: Mutex>> = Mutex::new(None); static CHANNEL_1TO0: Mutex>> = Mutex::new(None); static CHANNEL_SEM: Semaphore = Semaphore::new(0, 1); static mut KERNEL_CHANNEL_0TO1: Option> = None; static mut KERNEL_CHANNEL_1TO0: Option> = None; static mut KERNEL_IMAGE: *const core1::KernelImage = ptr::null(); static INIT_LOCK: Mutex<()> = Mutex::new(());