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 irq = axklib::irq::try_legacy_irq(32)?;
let handle = axklib::irq::request_shared(irq, my_irq_handler)?;

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.
IrqId
A framework IRQ id, scoped by controller domain.
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.

Constants§

LEGACY_IRQ_DOMAIN
Compatibility IRQ domain used while non-domainized callers migrate.

Traits§

Klib
The kernel helper trait that platform implementations must provide.

Functions§

IrqNumber
Legacy constructor kept only for upper-layer compatibility.
legacy_irq
Compatibility constructor for legacy numeric IRQ users.
legacy_irq_raw
Returns the legacy raw IRQ number when this id is in the legacy domain.
try_legacy_irq
Creates a legacy IRQ id without truncating the raw IRQ number.

Type Aliases§

AxResult
A specialized Result type with AxError as the error type.
BoxedIrqHandler
Boxed IRQ handler ABI.
ConcurrentBoxedIrqHandler
Boxed IRQ handler ABI for callbacks that may run concurrently.

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.