axklib
axklib — Small kernel-helper abstractions used across the ArceOS microkernel.
Overview
This crate exposes a tiny, no_std-compatible trait (Klib) that the platform/board layer must implement. The trait provides a handful of common kernel helpers such as:
- Memory mapping helpers
- Timing utilities (busy-wait)
- IRQ registration and enabling/disabling
The implementation is typically supplied by the platform layer (e.g., modules/axklib-impl) and consumed by drivers and other modules.
The crate also provides small convenience modules (mem, time, irq) that re-export the trait methods with shorter names to make call sites more ergonomic.
Usage
Add this to your Cargo.toml:
[]
= "0.2.0"
Example
// 1. Map 4K of device MMIO at physical address `paddr`
// Returns axerrno::AxResult<VirtAddr>
let vaddr = iomap?;
// 2. Busy-wait for 100 microseconds
busy_wait;
// 3. Register an IRQ handler
// Returns bool indicating success
register;
License
This project is licensed under either of
-
GNU General Public License, Version 3.0 or later (LICENSE-GPL or https://www.gnu.org/licenses/gpl-3.0.html )
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 )
-
Mulan Permissive Software License, Version 2.0 (LICENSE-MULAN or https://license.coscl.org.cn/MulanPSL2/ )
at your option.