Zephyr Project API 4.5.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rtio_iodev_api Struct Reference

API that an RTIO IO device should implement. More...

#include <iodev.h>

Data Fields

void(* submit )(struct rtio_iodev_sqe *iodev_sqe)
 Submit to the iodev an entry to work on.
void(* cancel )(const struct rtio_iodev *iodev, struct rtio *r, rtio_sqe_handle_t handle)
 Attempt to actively cancel a previously submitted entry.

Detailed Description

API that an RTIO IO device should implement.

Field Documentation

◆ cancel

void(* rtio_iodev_api::cancel) (const struct rtio_iodev *iodev, struct rtio *r, rtio_sqe_handle_t handle)

Attempt to actively cancel a previously submitted entry.

Optional. When non-NULL, this is invoked when the submission handle names is being canceled, giving the iodev a chance to abort work it still owns (e.g. remove a not-yet-started entry from an internal queue, or stop an in-flight transfer). If the iodev still owned the entry and removed it, the iodev is responsible for completing it (typically rtio_iodev_sqe_err() with -ECANCELED). If the entry is not (or no longer) owned by the iodev, this must be a no-op.

The submission is passed as a handle rather than a pointer because it is not owned by the caller: the entry may complete and its pool slot be recycled at any point before this runs. An implementation serializes its own completion paths with a lock and resolves the handle with rtio_iodev_sqe_from_handle() while holding it, which both rejects a slot that has since been recycled (returning NULL) and keeps the entry from being completed underneath the hook.

A NULL hook means cancellation is best-effort: the canceled status (see rtio_iodev_sqe_is_canceled()) still stops chain continuation and re-queueing, but an entry already queued or in flight runs to its natural completion.

Parameters
iodevThe iodev the submission was dispatched to
rRTIO context that owns the submission
handleHandle of the submission being canceled

◆ submit

void(* rtio_iodev_api::submit) (struct rtio_iodev_sqe *iodev_sqe)

Submit to the iodev an entry to work on.

This call should be short in duration and most likely either enqueue or kick off an entry with the hardware.

Parameters
iodev_sqeSubmission queue entry

The documentation for this struct was generated from the following file: