et-abi 0.1.0

Shared host/device ABI types (kernel launch arguments) for et-rs / ET-SoC-1
Documentation

et-abi

Shared host/device ABI types for the Esperanto ET-SoC-1, used by the et-rs host driver and the et-k-rs device-side kernel library.

A kernel launch passes its arguments by pointer: the host stages an argument struct in device memory and the firmware delivers its address to the kernel (in register a0). This crate defines those argument structs once, so the host launcher and the device kernel cannot drift on field order, sizes, or padding.

Because both the host (x86-64) and the device (RV64) are little-endian, the in-memory #[repr(C)] layout is the wire layout: the host takes the struct's bytes with [DeviceArgs::as_bytes] and the kernel reinterprets the pointer with [DeviceArgs::from_ptr]. No serialisation step is involved.

The crate is no_std with no dependencies, so it builds for the host and for the riscv64imac-unknown-none-elf device target alike.

use et_abi::{DeviceArgs, ReduceArgs};

// Host: build the args the kernel will read.
let args = ReduceArgs { input: 0x8005_0000, out: 0x8006_0000, n: 1024, n_harts: 64 };
let bytes: &[u8] = args.as_bytes();

// Device: recover them from the pointer the firmware passed in a0.
// let args = unsafe { ReduceArgs::from_ptr(a0 as *const u8) };

Licence

Apache-2.0.