Skip to main content

Module ipc

Module ipc 

Source
Available on crate feature unstable only.
Expand description

§Inter-Processor Call (IPC)

§Overview

Ipc::post queues a run of an IpcRequest on a CPU, then raises that CPU’s IPC interrupt. The interrupt handler calls the function of each queued request at Priority::min, in post order.

A post never waits. It returns a Ticket, and Ticket::wait waits for the run with a deadline. A busy CPU does not block the poster.

A request has at most one pending run. A post of a pending request joins that run. IpcRequest lists the rules for the function.

§Configuration

The HAL reserves FROM_CPU_INTR0 and FROM_CPU_INTR1 for this path. crate::init installs the handler on the PRO CPU. The start of the APP CPU installs the handler on that CPU.

§Examples

§Run a Function on the PRO CPU

use esp_hal::{
    interrupt::ipc::{Ipc, IpcRequest},
    system::Cpu,
};

extern "C" fn on_cpu() {
    // Runs on the selected CPU at minimum interrupt priority.
}

static ON_CPU: IpcRequest = IpcRequest::new(on_cpu);

let ipc = Ipc::new(peripherals.IPC);
let ticket = ipc.post(Cpu::ProCpu, &ON_CPU)?;
ticket.wait(Instant::now() + Duration::from_millis(10))?;

Structs§

Ipc
Handle that posts requests to a CPU through the IPC interrupt.
IpcRequest
A function that Ipc::post runs on a CPU, and the state of its runs.
Ticket
A run that Ipc::post queued or joined.

Enums§

IpcError
An error of an IPC post or wait.