Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ authentication = { workspace = true, optional = true }
log = { workspace = true, optional = true }
shared = { workspace = true, optional = true }
synchronization = { workspace = true, optional = true }
futures = { workspace = true, optional = true }
host_bindings = { workspace = true, optional = true }
bootsplash = { workspace = true, optional = true }

Expand All @@ -54,7 +53,6 @@ host = [
"dep:abi_declarations",
"dep:abi_definitions",
"dep:little_fs",
"dep:futures",
"dep:virtual_file_system",
"dep:graphics",
"dep:task",
Expand Down Expand Up @@ -100,7 +98,6 @@ host_bindings = { path = "modules/bindings/host" }
bindings_utilities = { path = "modules/bindings/utilities" }
authentication = { path = "modules/authentication" }
log = { path = "modules/log" }
futures = { path = "modules/futures" }
shared = { path = "modules/shared" }
synchronization = { path = "modules/synchronization" }
target = { path = "modules/target" }
Expand Down Expand Up @@ -183,7 +180,6 @@ members = [
"modules/network",
"modules/synchronization",
"modules/task/task_macros",
"modules/futures",
"modules/log",
"examples/native",
"executables/calculator",
Expand Down
2 changes: 1 addition & 1 deletion drivers/native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies]
file_system = { workspace = true }
futures = { workspace = true }

graphics = { workspace = true, features = ["rendering_xrgb8888"] }
task = { workspace = true }
log = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions drivers/native/src/devices/window_screen/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<'a> DirectBaseOperations for ScreenDevice<'a> {
let data: &[RenderingColor] =
align_slice_to(buffer).ok_or(file_system::Error::InvalidParameter)?;

futures::block_on(self.0.draw(data)).unwrap();
task::block_on(self.0.draw(data)).unwrap();

Ok(size_of::<Self>() as _)
}
Expand All @@ -41,21 +41,21 @@ impl<'a> DirectBaseOperations for ScreenDevice<'a> {
.cast()
.ok_or(file_system::Error::InvalidParameter)?;

futures::block_on(self.0.set_drawing_area(*area)).unwrap();
task::block_on(self.0.set_drawing_area(*area)).unwrap();
}
GET_RESOLUTION => {
let resolution: &mut graphics::Point = argument
.cast()
.ok_or(file_system::Error::InvalidParameter)?;

*resolution = futures::block_on(self.0.get_resolution()).unwrap();
*resolution = task::block_on(self.0.get_resolution()).unwrap();
}
WAS_RESIZED => {
let was_resized: &mut bool = argument
.cast()
.ok_or(file_system::Error::InvalidParameter)?;

*was_resized = futures::block_on(self.0.was_resized()).unwrap();
*was_resized = task::block_on(self.0.was_resized()).unwrap();
}
_ => return Err(file_system::Error::UnsupportedOperation),
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/native/src/devices/window_screen/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ impl<'a> ApplicationHandler for Window<'a> {
.unwrap()
};

futures::block_on(self.inner_window.replace(window, pixels));
task::block_on(self.inner_window.replace(window, pixels));
}

fn window_event(&mut self, _: &ActiveEventLoop, _: WindowId, event: WindowEvent) {
match event {
WindowEvent::RedrawRequested => {
futures::block_on(self.inner_window.render()).unwrap();
task::block_on(self.inner_window.render()).unwrap();
}
WindowEvent::Resized(size) => {
let new_resolution = Point::new(size.width as i16, size.height as i16);

self.resolution = new_resolution;

futures::block_on(self.inner_window.resize(new_resolution)).unwrap();
task::block_on(self.inner_window.resize(new_resolution)).unwrap();
}
WindowEvent::KeyboardInput {
device_id: _,
Expand Down
2 changes: 1 addition & 1 deletion drivers/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ file_system = { workspace = true }
memory = { workspace = true }
graphics = { workspace = true, features = ["rendering_xrgb8888"] }
critical-section = { workspace = true, features = ["std"] }
futures = { workspace = true }
task = { workspace = true }
synchronization = { workspace = true }
log = { workspace = true }
shared = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion drivers/wasm/src/devices/drive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::string::{String, ToString};
use file_system::{DirectBaseOperations, Path, Size};
use futures::block_on;
use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock};
use task::block_on;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use web_sys::*;
Expand Down
2 changes: 1 addition & 1 deletion drivers/wasm/src/devices/graphics/canvas_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use core::slice;

use alloc::{boxed::Box, rc::Rc, string::String, vec::Vec};
use file_system::{DirectBaseOperations, DirectCharacterDevice, MountOperations, Size};
use futures::block_on;
use graphics::{Area, GET_RESOLUTION, Point, RenderingColor, SET_DRAWING_AREA, WAS_RESIZED};
use shared::align_slice_to;
use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock};
use task::block_on;
use wasm_bindgen::{Clamped, JsCast, JsValue, prelude::Closure};
use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement, ImageData};

Expand Down
2 changes: 1 addition & 1 deletion drivers/wasm/src/devices/graphics/mouse.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use alloc::{boxed::Box, string::String, sync::Arc};
use file_system::{DirectBaseOperations, DirectCharacterDevice, MountOperations, Size};
use futures::block_on;
use graphics::{InputData, Point, State};
use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock};
use task::block_on;
use wasm_bindgen::{JsCast, prelude::Closure};
use web_sys::{HtmlCanvasElement, MouseEvent, TouchEvent};

Expand Down
2 changes: 1 addition & 1 deletion executables/shell/graphical/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use xila::graphics::{self, EventKind, lvgl, theme};
use xila::shared::unix_to_human_time;
use xila::time;

const KEYBOARD_SIZE_RATIO: f64 = 4.0 / 1.0;
const KEYBOARD_SIZE_RATIO: f64 = 3.0 / 1.0;

pub struct Layout {
window: *mut lvgl::lv_obj_t,
Expand Down
2 changes: 1 addition & 1 deletion modules/abi/context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[dependencies]
task = { workspace = true }
futures = { workspace = true }

synchronization = { workspace = true }
file_system = { workspace = true }
log = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion modules/abi/context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ pub use file::*;

use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec};
use file_system::{Path, PathOwned};
use futures::block_on;
use smol_str::SmolStr;
use synchronization::{blocking_mutex::raw::CriticalSectionRawMutex, rwlock::RwLock};
use task::TaskIdentifier;
use task::block_on;
use unique_file::UniqueFileIdentifier;
use virtual_file_system::{SynchronousDirectory, SynchronousFile};

Expand Down
2 changes: 1 addition & 1 deletion modules/abi/definitions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ time = { workspace = true }
memory = { workspace = true }
network = { workspace = true }
synchronization = { workspace = true }
futures = { workspace = true }

log = { workspace = true }
abi_context = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion modules/abi/definitions/src/file_system/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::{
ptr::copy_nonoverlapping,
};
use file_system::{AccessFlags, CreateFlags, Flags, StateFlags, character_device};
use futures::block_on;
use task::block_on;
use virtual_file_system::{
Error, SynchronousDirectory, SynchronousFile, get_instance as get_file_system_instance,
};
Expand Down
2 changes: 1 addition & 1 deletion modules/abi/definitions/src/file_system/socket.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{XilaFileIdentifier, XilaFileSystemResult, into_u32};
use futures::block_on;
use task::block_on;
use task::get_instance as get_task_manager_instance;
use virtual_file_system::Error;

Expand Down
2 changes: 1 addition & 1 deletion modules/abi/definitions/src/memory/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

use core::ptr::null_mut;
use core::{ffi::c_void, ptr::NonNull};
use futures::block_on;
use log::warning;
use memory::CapabilityFlags;
use synchronization::blocking_mutex::raw::CriticalSectionRawMutex;
use synchronization::mutex::Mutex;
use task::block_on;

use crate::Allocated;

Expand Down
2 changes: 1 addition & 1 deletion modules/abi/definitions/src/task/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use core::ffi::c_int;
use core::ptr::null_mut;
use core::{ffi::c_void, time::Duration};

use futures::block_on;
use task::Manager;
use task::block_on;

use abi_context as context;

Expand Down
2 changes: 1 addition & 1 deletion modules/bindings/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ task = { workspace = true }
graphics = { workspace = true }
time = { workspace = true }
include_bytes_aligned = "0.1"
futures = { workspace = true }

log = { workspace = true }
#wit-bindgen = "0.34.0"

Expand Down
2 changes: 1 addition & 1 deletion modules/bindings/host/src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{
os::raw::c_void,
};

use futures::block_on;
pub use graphics::lvgl;
use task::block_on;

use task::TaskIdentifier;
use virtual_machine::{
Expand Down
2 changes: 1 addition & 1 deletion modules/bindings/utilities/src/additional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn get() -> TokenStream {
}

pub unsafe fn window_create() -> *mut lv_obj_t {
futures::block_on(
task::block_on(
graphics::get_instance().create_window()
).unwrap().into_raw()
}
Expand Down
2 changes: 1 addition & 1 deletion modules/bootsplash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2024"

[dependencies]
futures = { workspace = true }

graphics = { workspace = true }
2 changes: 1 addition & 1 deletion modules/executable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ file_system = { workspace = true }
virtual_file_system = { workspace = true }
task = { workspace = true }
users = { workspace = true }
futures = { workspace = true }

log = { workspace = true }

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion modules/executable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub use arguments_parser::*;
pub use building::*;
pub use error::*;
pub use file_system as exported_file_system;
pub use futures as exported_futures;
pub use standard::*;
pub use task as exported_task;
pub use traits::*;
Expand Down
2 changes: 1 addition & 1 deletion modules/file_system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ task = { workspace = true }
users = { workspace = true }
shared = { workspace = true }
synchronization = { workspace = true }
futures = { workspace = true }

embedded-io-async = { workspace = true }

[dev-dependencies]
Expand Down
7 changes: 0 additions & 7 deletions modules/futures/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion modules/futures/src/lib.rs

This file was deleted.

5 changes: 3 additions & 2 deletions modules/graphics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ synchronization = { workspace = true }
log = { workspace = true }
abi_declarations = { workspace = true }
internationalization = { workspace = true }
futures = { workspace = true }

task = { workspace = true }

[dev-dependencies]
drivers_native = { workspace = true }
Expand All @@ -25,7 +26,7 @@ drivers_shared = { workspace = true }
drivers_std = { workspace = true }
users = { workspace = true }
task = { workspace = true }
futures = { workspace = true }

abi_definitions = { workspace = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion modules/graphics/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use alloc::{
vec::Vec,
};
use file_system::DirectCharacterDevice;
use futures::block_on;
use synchronization::blocking_mutex::raw::CriticalSectionRawMutex;
use synchronization::mutex::{Mutex, MutexGuard};
use synchronization::{once_lock::OnceLock, rwlock::RwLock};
use task::block_on;

use core::{future::Future, mem::forget};

Expand Down
4 changes: 2 additions & 2 deletions modules/little_fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ users = { workspace = true }
time = { workspace = true }
littlefs2-sys = { version = "0.3.1", features = ["malloc"] }
synchronization = { workspace = true }
futures = { workspace = true }

log = { workspace = true }
abi_declarations = { workspace = true }

Expand All @@ -23,5 +23,5 @@ drivers_native = { workspace = true }
drivers_core = { workspace = true }
drivers_shared = { workspace = true }
drivers_std = { workspace = true }
futures = { workspace = true }

abi_definitions = { workspace = true }
11 changes: 9 additions & 2 deletions modules/log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,16 @@ impl Log for Logger {
static LOGGER_INSTANCE: OnceLock<Logger> = OnceLock::new();

pub fn initialize(logger: &'static dyn LoggerTrait) -> Result<(), log_external::SetLoggerError> {
let logger = LOGGER_INSTANCE.get_or_init(|| Logger(logger));
let log = LOGGER_INSTANCE.get_or_init(|| Logger(logger));

if set_logger(log).is_err() {
logger.log(&Record {
level: Level::Error,
target: "log",
arguments: format_args!("Logger has already been initialized."),
});
}

set_logger(logger).expect("Failed to set logger");
set_max_level(log_external::LevelFilter::Trace);
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion modules/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[dependencies]
file_system = { workspace = true }
futures = { workspace = true }

synchronization = { workspace = true }
time = { workspace = true }
embassy-net = { workspace = true, features = [
Expand Down
2 changes: 1 addition & 1 deletion modules/task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ embassy-executor = { workspace = true, default-features = false }
embassy-futures = { workspace = true }
smol_str = { version = "0.3" }
synchronization = { workspace = true }
futures = { workspace = true }


[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies]
embassy-time = { workspace = true, features = ["std"] }
Expand Down
13 changes: 11 additions & 2 deletions modules/task/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ use embassy_time::Timer;
pub use embassy_executor;
pub use environment_variable::*;
pub use error::*;
pub use futures;
pub use futures::yield_now;
pub use join_handle::*;
pub use manager::*;
pub use signal::*;
Expand All @@ -32,3 +30,14 @@ pub async fn sleep(duration: Duration) {

Timer::after(embassy_time::Duration::from_nanos(nano_seconds as u64)).await
}

#[cfg(target_arch = "wasm32")]
pub async fn yield_now() {
sleep(Duration::from_millis(10)).await
}
#[cfg(not(target_arch = "wasm32"))]
pub use embassy_futures::yield_now;

pub fn block_on<F: core::future::Future>(future: F) -> F::Output {
embassy_futures::block_on(future)
}
Loading