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.
- IrqCpu
Id - A logical CPU id.
- IrqCpu
Mask - 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.
- Phys
Addr - A physical memory address.
- Virt
Addr - A virtual memory address.
Enums§
- IrqAffinity
- Hardware routing preference for an IRQ line.
- IrqAuto
Enable - 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.
- IrqShare
Mode - 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
Resulttype withAxErroras the error type. - Boxed
IrqHandler - Boxed IRQ handler ABI.
- Concurrent
Boxed IrqHandler - 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.