os_metal_primitives 0.1.0

Dependency-free bare-metal primitives for Rust OS development: typed MMIO, registers, bitfields, port I/O, IRQ tables, and driver state patterns.
Documentation
# os_metal_primitives

`os_metal_primitives` is a **dependency-free**, `no_std`-first crate that provides small, strongly
typed building blocks for **bare-metal / OS kernel** development in Rust (edition **2024**).

This crate focuses on *low-level primitives* you can reuse across kernels and architectures:

- **Typed MMIO** registers with volatile reads/writes (`mmio::MmioCell`)
- **Bitfield** helpers and a compact declarative macro (`os_metal_primitives::bitfield!`)
- **Register access modes** (RO/WO/RW) and a register block helper macro (`os_metal_primitives::define_register_block!`)
- **Port I/O** wrapper types (`port_io::{Port8, Port16, Port32}`) via an architecture-provided trait
- **IRQ** types and a fixed-size, allocation-free dispatch table (`irq::IrqTable`)
- **Driver state** helpers for explicit driver lifecycles (`driver_state::DriverState`)

## Relationship with your other crates

This crate is intentionally **independent** and does not depend on:

- `os_kernel_foundry` (kernel architecture & boot orchestration)
- `os_dev_toolkit` (logging, diagnostics, fixed buffers, etc.)

Instead, it complements them by handling *different concerns*: typed hardware register access,
bit manipulation primitives, and small kernel-friendly patterns.

## Quick example: MMIO + bitfields

```rust
use os_metal_primitives::mmio::MmioCell;

os_metal_primitives::bitfield! {
    /// A tiny control register.
    pub struct Ctrl(u32) {
        /// Enable bit.
        pub const EN: 0,
        /// 3-bit mode field.
        pub field MODE: 8..=10,
    }
}

#[repr(C)]
pub struct DevRegs {
    pub ctrl: MmioCell<u32>,
}

fn enable_and_set_mode(regs: &DevRegs, mode: u32) {
    regs.ctrl.update(|raw| {
        let c = Ctrl::from_bits(raw)
            .with(Ctrl::EN)
            .set(Ctrl::MODE, mode);
        c.bits()
    });
}
```

## Documentation

- API docs: build locally with `cargo doc --open`
- Project docs: see the `docs/` directory, starting from `docs/MANUAL.md`

## License

MIT. See `LICENSE`.

### Attribution

This crate was created by an **AI assistant** based on an idea and requirements by **alisio85**.