Skip to main content

Crate axklib

Crate axklib 

Source
Expand description

axklib — small kernel-helper abstractions used across the microkernel

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, and IRQ registration. The implementation is supplied by the platform (see 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.

Example usage:

// map 4K of device MMIO at physical address `paddr`
let vaddr = axklib::mem::iomap(paddr, 0x1000)?;

// busy-wait for 100 microseconds
axklib::time::busy_wait(core::time::Duration::from_micros(100));

// request a shared IRQ action
let handle = axklib::irq::request_shared(32, my_irq_handler, data)?;

Modules§

dma
irq
Convenience re-exports for IRQ operations.
klib
Module generated by trait-ffi.
mem
Convenience re-export for memory IO mapping.
mmio
time
Convenience re-export for busy-wait timing.

Macros§

impl_trait
Implement the extern trait for a type.

Structs§

AxError
The error type used by ArceOS.
IrqContext
Context passed to IRQ handlers.
IrqCpuId
A logical CPU id.
IrqCpuMask
A compact CPU mask for low-level IRQ affinity.
IrqHandle
Token returned from request and used for later lifecycle operations.
IrqNumber
A platform IRQ number.
IrqOutcome
Aggregated dispatch result.
IrqRequest
Request parameters for an IRQ action.
IrqStatus
IRQ status snapshot.
PhysAddr
A physical memory address.
VirtAddr
A virtual memory address.

Enums§

IrqAffinity
Hardware routing preference for an IRQ line.
IrqAutoEnable
Whether an IRQ action should be enabled after registration.
IrqError
IRQ framework errors.
IrqExecution
Execution contract for an IRQ action.
IrqReturn
Return value from a raw IRQ handler.
IrqScope
IRQ registration scope.
IrqShareMode
Whether an IRQ line is exclusive or shared.

Traits§

Klib
The kernel helper trait that platform implementations must provide.

Type Aliases§

AxResult
A specialized Result type with AxError as the error type.
BoxedIrqHandler
Boxed IRQ handler ABI.
RawIrqHandler
Raw IRQ handler ABI.

Attribute Macros§

impl_extern_trait
Helper macro to implement the extern trait for a type. Implements an extern trait for a type and generates corresponding C function exports.