Skip to content

Commit

Permalink
crates/sel4cp: Flatten public API module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
nspin committed Aug 26, 2023
1 parent a3467ff commit 4c2ffc7
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 22 deletions.
4 changes: 1 addition & 3 deletions crates/examples/sel4cp/banscii/pds/artist/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ use sel4_externally_shared::{
access::{ReadOnly, ReadWrite},
ExternallySharedRef,
};
use sel4cp::memory_region::memory_region_symbol;
use sel4cp::message::MessageInfo;
use sel4cp::{protection_domain, Channel, Handler};
use sel4cp::{memory_region_symbol, protection_domain, Channel, Handler, MessageInfo};
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use banscii_artist_interface_types::*;
Expand Down
4 changes: 1 addition & 3 deletions crates/examples/sel4cp/banscii/pds/assistant/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ use sel4_externally_shared::{
access::{ReadOnly, ReadWrite},
ExternallySharedRef,
};
use sel4cp::memory_region::memory_region_symbol;
use sel4cp::message::MessageInfo;
use sel4cp::{protection_domain, Channel, Handler};
use sel4cp::{memory_region_symbol, protection_domain, Channel, Handler, MessageInfo};
use sel4cp_message::{MessageInfoExt as _, NoMessageLabel, NoMessageValue, StatusMessageLabel};

use banscii_artist_interface_types as artist;
Expand Down
3 changes: 1 addition & 2 deletions crates/examples/sel4cp/banscii/pds/pl011-driver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use heapless::Deque;

use sel4cp::message::MessageInfo;
use sel4cp::{memory_region_symbol, protection_domain, Channel, Handler};
use sel4cp::{memory_region_symbol, protection_domain, Channel, Handler, MessageInfo};
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use banscii_pl011_driver_core::Driver;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sel4cp::message::MessageInfo;
use sel4cp::MessageInfo;
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use sel4cp_http_server_example_virtio_net_driver_interface_types::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sel4cp::message::MessageInfo;
use sel4cp::MessageInfo;
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use sel4cp_http_server_example_sp804_driver_interface_types::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use core::time::Duration;

use sel4cp::message::MessageInfo;
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler};
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler, MessageInfo};
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use sel4cp_http_server_example_sp804_driver_core::Driver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use virtio_drivers::{

use sel4_externally_shared::ExternallySharedRef;
use sel4_shared_ring_buffer::{RingBuffer, RingBuffers};
use sel4cp::message::MessageInfo;
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler};
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler, MessageInfo};
use sel4cp_message::{MessageInfoExt as _, NoMessageValue, StatusMessageLabel};

use sel4cp_http_server_example_virtio_hal_impl::HalImpl;
Expand Down
4 changes: 1 addition & 3 deletions crates/sel4cp/message/postcard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use core::mem;

use serde::{Deserialize, Serialize};

use sel4cp::message::{
with_msg_bytes, with_msg_bytes_mut, MessageInfo, MessageLabel, MessageRegisterValue,
};
use sel4cp::{with_msg_bytes, with_msg_bytes_mut, MessageInfo, MessageLabel, MessageRegisterValue};

pub fn send<T: Serialize>(label: impl Into<MessageLabel>, val: T) -> MessageInfo {
try_send(label, val).unwrap()
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4cp/message/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::mem;
use num_enum::{IntoPrimitive, TryFromPrimitive};
use zerocopy::{AsBytes, FromBytes, Unalign};

use sel4cp::message::*;
use sel4cp::{with_msg_bytes, with_msg_bytes_mut, MessageInfo, MessageLabel, MessageRegisterValue};

pub trait MessageInfoExt {
fn _msg_info(&self) -> &MessageInfo;
Expand Down
9 changes: 7 additions & 2 deletions crates/sel4cp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,21 @@ mod cspace;
mod entry;
mod env;
mod handler;
mod memory_region;
mod message;

pub mod memory_region;
pub mod message;
pub mod panicking;

pub use cspace::{
Channel, DeferredAction, DeferredActionInterface, DeferredActionSlot, IrqAckError,
};
pub use env::{pd_is_passive, pd_name};
pub use handler::{Handler, NullHandler};
pub use memory_region::{cast_memory_region_checked, cast_memory_region_to_slice_checked};
pub use message::{
get_mr, set_mr, with_msg_bytes, with_msg_bytes_mut, with_msg_regs, with_msg_regs_mut,
MessageInfo, MessageLabel, MessageRegisterValue,
};

/// Declares the initialization function, stack size, and, optionally, heap and heap size.
///
Expand Down
2 changes: 0 additions & 2 deletions crates/sel4cp/src/memory_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ macro_rules! memory_region_symbol {
}};
}

pub use memory_region_symbol;

pub fn cast_memory_region_checked<T: Sized>(bytes_ptr: NonNull<[u8]>) -> NonNull<T> {
let ptr = bytes_ptr.cast::<T>();
assert!(ptr.as_ptr().is_aligned());
Expand Down

0 comments on commit 4c2ffc7

Please sign in to comment.