Skip to content

Commit

Permalink
crates/examples/sel4cp/http-server: Factor out helper crates
Browse files Browse the repository at this point in the history
  • Loading branch information
nspin committed Aug 22, 2023
1 parent 740567c commit 5cbebd0
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 191 deletions.
26 changes: 14 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ members = [
"crates/examples/sel4cp/banscii/pds/pl011-driver/core",
"crates/examples/sel4cp/banscii/pds/pl011-driver/interface-types",
"crates/examples/sel4cp/hello/pds/hello",
"crates/examples/sel4cp/http-server/helpers/cpiofs",
"crates/examples/sel4cp/http-server/helpers/virtio-hal-impl",
"crates/examples/sel4cp/http-server/pds/server",
"crates/examples/sel4cp/http-server/pds/server/core",
"crates/examples/sel4cp/http-server/pds/server/cpiofs",
"crates/examples/sel4cp/http-server/pds/sp804-driver",
"crates/examples/sel4cp/http-server/pds/sp804-driver/core",
"crates/examples/sel4cp/http-server/pds/sp804-driver/interface-types",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "sel4cp-http-server-example-virtio-hal-impl"
version = "0.1.0"
authors = ["Nick Spinale <[email protected]>"]
edition = "2021"
license = "BSD-2-Clause"

[dependencies]
log = "0.4.17"
sel4-bounce-buffer-allocator = { path = "../../../../../sel4-bounce-buffer-allocator" }
sel4-immediate-sync-once-cell = { path = "../../../../../sel4-immediate-sync-once-cell" }
sel4-sync = { path = "../../../../../sel4-sync" }
virtio-drivers = { version = "0.5.0", default-features = false, features = ["alloc"] }

[dependencies.sel4-externally-shared]
path = "../../../../../sel4-externally-shared"
features = ["unstable", "alloc"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#![no_std]
#![feature(ptr_metadata)]
#![feature(slice_ptr_get)]
#![feature(strict_provenance)]

use core::alloc::Layout;
use core::ops::Range;
use core::ptr::{self, NonNull};
Expand All @@ -20,10 +25,10 @@ static BOUNCE_BUFFER_ALLOCATOR: GenericMutex<
Option<BounceBufferAllocator<Basic>>,
> = GenericMutex::new(PanickingMutexSyncOps::new(), None);

pub(crate) struct HalImpl;
pub struct HalImpl;

impl HalImpl {
pub(crate) fn init(dma_region_size: usize, dma_region_vaddr: usize, dma_region_paddr: usize) {
pub fn init(dma_region_size: usize, dma_region_vaddr: usize, dma_region_paddr: usize) {
DMA_REGION_VADDR_RANGE
.set(dma_region_vaddr..(dma_region_vaddr + dma_region_size))
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/examples/sel4cp/http-server/pds/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sel4-shared-ring-buffer-smoltcp = { path = "../../../../../sel4-shared-ring-buff
sel4-sync = { path = "../../../../../sel4-sync" }
sel4cp = { path = "../../../../../sel4cp", default-features = false, features = ["alloc"] }
sel4cp-http-server-example-server-core = { path = "./core", features = [] }
sel4cp-http-server-example-server-cpiofs = { path = "./cpiofs" }
sel4cp-http-server-example-server-cpiofs = { path = "../../helpers/cpiofs" }

[dependencies.sel4-async-single-threaded-executor]
path = "../../../../../sel4-async/single-threaded-executor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sel4-async-network = { path = "../../../../../../sel4-async/network" }
sel4-async-network-mbedtls = { path = "../../../../../../sel4-async/network/mbedtls" }
sel4-async-timers = { path = "../../../../../../sel4-async/timers" }
sel4-panicking-env = { path = "../../../../../../sel4-panicking/env" }
sel4cp-http-server-example-server-cpiofs = { path = "../cpiofs" }
sel4cp-http-server-example-server-cpiofs = { path = "../../../helpers/cpiofs" }

[dependencies.mbedtls]
git = "https://github.com/nspin/rust-mbedtls"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
license = "BSD-2-Clause"

[dependencies]
bitflags = "1.3"
log = "0.4.17"
sel4 = { path = "../../../../../sel4" }
sel4-bounce-buffer-allocator = { path = "../../../../../sel4-bounce-buffer-allocator" }
Expand All @@ -15,9 +14,8 @@ sel4-logging = { path = "../../../../../sel4-logging" }
sel4-shared-ring-buffer = { path = "../../../../../sel4-shared-ring-buffer" }
sel4-sync = { path = "../../../../../sel4-sync" }
sel4cp = { path = "../../../../../sel4cp", default-features = false }
sel4cp-http-server-example-virtio-hal-impl = { path = "../../helpers/virtio-hal-impl" }
virtio-drivers = { version = "0.5.0", default-features = false, features = ["alloc"] }
volatile = "0.5.1"
zerocopy = "0.6.1"

[dependencies.sel4-externally-shared]
path = "../../../../../sel4-externally-shared"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ use alloc::boxed::Box;
use alloc::collections::BTreeMap;
use core::ptr::NonNull;

use sel4_externally_shared::ExternallySharedRef;
use sel4_shared_ring_buffer::{RingBuffer, RingBuffers};
use sel4_shared_ring_buffer_block_io_types::{
BlockIORequest, BlockIORequestStatus, BlockIORequestType,
};
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler};

use virtio_drivers::{
device::blk::*,
transport::{
Expand All @@ -26,9 +19,14 @@ use virtio_drivers::{
},
};

mod hal_impl;
use sel4_externally_shared::ExternallySharedRef;
use sel4_shared_ring_buffer::{RingBuffer, RingBuffers};
use sel4_shared_ring_buffer_block_io_types::{
BlockIORequest, BlockIORequestStatus, BlockIORequestType,
};
use sel4cp::{memory_region_symbol, protection_domain, var, Channel, Handler};

use hal_impl::HalImpl;
use sel4cp_http_server_example_virtio_hal_impl::HalImpl;

const DEVICE: Channel = Channel::new(0);
const CLIENT: Channel = Channel::new(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
license = "BSD-2-Clause"

[dependencies]
bitflags = "1.3"
log = "0.4.17"
sel4 = { path = "../../../../../sel4" }
sel4-bounce-buffer-allocator = { path = "../../../../../sel4-bounce-buffer-allocator" }
Expand All @@ -15,10 +14,9 @@ sel4-logging = { path = "../../../../../sel4-logging" }
sel4-shared-ring-buffer = { path = "../../../../../sel4-shared-ring-buffer" }
sel4-sync = { path = "../../../../../sel4-sync" }
sel4cp = { path = "../../../../../sel4cp", default-features = false }
sel4cp-http-server-example-virtio-hal-impl = { path = "../../helpers/virtio-hal-impl" }
sel4cp-http-server-example-virtio-net-driver-interface-types = { path = "./interface-types" }
virtio-drivers = { version = "0.5.0", default-features = false, features = ["alloc"] }
volatile = "0.5.1"
zerocopy = "0.6.1"

[dependencies.sel4-externally-shared]
path = "../../../../../sel4-externally-shared"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ extern crate alloc;

use core::ptr::NonNull;

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

use virtio_drivers::{
device::net::*,
transport::{
Expand All @@ -22,6 +17,12 @@ use virtio_drivers::{
},
};

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

use sel4cp_http_server_example_virtio_hal_impl::HalImpl;
use sel4cp_http_server_example_virtio_net_driver_interface_types::*;

const DEVICE: Channel = Channel::new(0);
Expand All @@ -30,10 +31,6 @@ const CLIENT: Channel = Channel::new(1);
const NET_BUFFER_LEN: usize = 2048;
const NET_QUEUE_SIZE: usize = 16;

mod hal_impl;

use hal_impl::HalImpl;

#[protection_domain(
heap_size = 16 * 1024 * 1024,
)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ mk, localCrates, versions }:

mk {
package.name = "sel4cp-http-server-example-virtio-hal-impl";
dependencies = rec {
inherit (versions) log;

virtio-drivers = {
version = "0.5.0";
default-features = false;
features = [ "alloc" ];
};

sel4-externally-shared.features = [ "unstable" "alloc" ];
};
nix.local.dependencies = with localCrates; [
sel4-externally-shared
sel4-sync
sel4-immediate-sync-once-cell
sel4-bounce-buffer-allocator
];
}
Loading

0 comments on commit 5cbebd0

Please sign in to comment.