Crates.io | rvvm |
lib.rs | rvvm |
version | 0.2.5 |
source | src |
created_at | 2023-01-01 17:19:36.950286 |
updated_at | 2023-01-02 07:19:07.145363 |
description | idiomatic RVVM Rust bindings |
homepage | |
repository | https://github.com/RVVM-rs/rvvm |
max_upload_size | |
id | 748954 |
size | 60,935 |
Safe Rust bindings to the RVVM's public API.
Provides the Rust-idiomatic interface to the RVVM public API.
use rvvm::prelude::*;
#[type_handler(ty = "()")]
fn on_reset(dev: &Device<()>) {
println!("Reset");
}
#[type_handler(ty = "()")]
fn on_update(dev: &Device<()>) {
println!("Update");
}
#[on_remove(ty = "()")]
fn on_remove(dev: &mut Device<()>) {
println!("I'm being removed");
}
fn main() {
// Creates the RVVM instance with the 4KB of memory and 1
// hart, see `rvvm::builders::instance::InstanceBuilder`
// documentation for more detailed information or use the
// `rvvm::instance::Instance::new` for direct creation
let mut instance = Instance::builder().build();
let test_type =
DeviceType::custom("Test", on_remove, on_update, on_reset);
let test_dev = Device::builder()
.address(0x1024)
.size(1024)
.device_type(test_type)
.op_size(1..=1) // inclusive range [from; to]
.data(()) // Data for ZST types will not be allocated, but dropped
.build();
let handle: DeviceHandle<()> = instance
.try_attach_device(test_dev)
.expect("Failed to attach MMIO device");
dbg!(handle);
}
Virtual machine creation
RAM read/writes
Sound (in terms of safety) and type-safe api for devices
Flattened device tree library bindings
Access to the virtual machine's FDT
pause
/start
/powered_on
APIs
loading kernel/bootrom/dtb
Run virtual machine's event loop
PLIC/i2c
Userland API
DMA
Test UART
device
rvvm-sys features (like fdt, jit or smth)
Possibly I've lost something, so the list will be supplemented/updated.