Skip to main content

Module qemu_shm

Module qemu_shm 

Source
Expand description

embassy-net driver for the QEMU MPS2-AN500 shared-memory Ethernet transport.

Frames flow guest ↔ host through /dev/shm/ove-net via ARM semihosting; the host-side bridge (config/scripts/qemu-net-bridge.py) converts to/from a Linux TAP interface.

The driver polls (no interrupt) — receive() returns frames already delivered to the SHM ring and registers the embassy-net waker so a background timer task can re-poll. For a typical app, spawn a small poller alongside the embassy-net Runner:

#[embassy_executor::task]
async fn poll_task() {
    loop {
        embassy_time::Timer::after_millis(10).await;
        ove::async_net::qemu_shm::wake_poll();
    }
}

Structs§

QemuShmDriver
Driver state — owns a single RX frame buffer to keep storage small. The C side serialises ring access; a single in-flight frame at a time is fine for the SHM transport’s throughput envelope.
QemuShmRx
RX token — wraps a stack-local frame buffer the runner reads from.
QemuShmTx
TX token — owns a stack-local frame buffer the runner fills, then the consume() closure flushes to the SHM ring.

Constants§

MTU
Max Ethernet frame size — matches NET_SHM_MTU in the C header.

Functions§

wake_poll
Wake the embassy-net runner to re-poll the RX ring. Call this periodically (e.g. from a 10 ms timer task) to drive frame delivery.