starina_api/lib.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
//! Starina standard library for applications.
//!
//! This is [`libstd`](https://doc.rust-lang.org/std/) in Starina. All components
//! except the kernel use this library.
//!
//! # APIs you should to know
//!
//! Here are the most frequently used APIs that you will encounter first:
//!
//! - [`info!`], [`warn!`], [`error!`], [`debug!`], [`trace!`]: Logging macros.
//! - [`Channel`](channel::Channel): A channel for inter-process communication.
//! - [`Environ`](environ::Environ): Environment variables in Starina.
//!
//! ## Server APIs
//!
//! Servers are long-running processes that provide services to clients, such as
//! device drivers, filesystem drivers, TCP/IP stack, and so on.
//!
//! - [`Mainloop`](mainloop::Mainloop): An event loop for applications.
//!
//! ## Device driver APIs
//!
//! In Starina, device drivers are servers with the hardware access. To control the
//! hardware conveniently, Starina provides the following APIs:
//!
//! - [`MappedFolio`](folio::MappedFolio): A physically-contiguous memory region for DMA/MMIO access.
//! - [`Interrupt`](interrupt::Interrupt): Hardware interrupt handling.
//! - `starina_driver_utils::mmio`: Type-safe MMIO access.
//! - `starina_driver_utils::DmaBufferPool`: The DMA buffer pool allocator.
//!
//! # Prelude
//!
//! The [`prelude`] module contains the most common types and traits that you'll
//! use in Starina programs. Here is an idiomatic way to import the prelude:
//!
//! ```
//! use starina_api::prelude::*;
//! ```
#![no_std]
#![feature(start)]
extern crate alloc;
mod allocator;
mod arch;
mod panic;
mod start;
pub mod channel;
pub mod environ;
pub mod folio;
pub mod handle;
pub mod interrupt;
pub mod log;
pub mod mainloop;
pub mod poll;
pub mod prelude;
pub mod print;
pub mod signal;
pub mod syscall;
pub mod vmspace;
/// Embeds the code generated by `starina_autogen` crate.
#[macro_export]
macro_rules! autogen {
() => {
include!(concat!(env!("OUT_DIR"), "/autogen.rs"));
};
}
/// Synchronization primitives such as `Arc` and `Weak`.
pub mod sync {
pub use alloc::sync::Arc;
pub use alloc::sync::Weak;
}
/// Collections. `HashMap`, `HashSet`, `VecDeque`, `BinaryHeap`, and more.
pub mod collections {
pub use alloc::collections::*;
pub use hashbrown::hash_map;
pub use hashbrown::hash_set;
pub use hashbrown::HashMap;
pub use hashbrown::HashSet;
}
/// Starina types.
pub use starina_types as types;