Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pulse_io.h File Reference

Main header file for the Pulse IO subsystem API. More...

#include <errno.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/rtio/rtio.h>
#include <zephyr/sys/util.h>
#include <zephyr/syscalls/pulse_io.h>

Go to the source code of this file.

Data Structures

struct  pulse_symbol
 One symbol of a pulse stream. More...
struct  pulse_cell
 One cell of a fixed-period pulse stream. More...
struct  pulse_io_caps
 Per-instance capability descriptor. More...
struct  pulse_io_config
 Channel configuration. More...
struct  pulse_io_tx_req
 TX submission descriptor. More...
struct  pulse_io_rx_req
 RX submission descriptor. More...
struct  pulse_io_driver_api
 Driver vtable. More...
struct  pulse_io_bit_template
 Per-bit template used by pulse_io_encode_bytes. More...
struct  pulse_io_encoder_api
 Encoder vtable: protocol bytes to pulse symbols. More...
struct  pulse_io_decoder_api
 Decoder vtable: pulse symbols to protocol bytes. More...

Enumerations

enum  pulse_io_mode { PULSE_IO_MODE_SYMBOL = BIT(0) , PULSE_IO_MODE_CELL = BIT(1) }
 Pulse stream submission modes. More...
enum  pulse_io_dir { PULSE_IO_DIR_TX , PULSE_IO_DIR_RX }
 Direction of a configured channel. More...

Functions

int pulse_io_get_capabilities (const struct device *dev, struct pulse_io_caps *caps)
 Query backend capabilities.
int pulse_io_channel_get (const struct device *dev, uint8_t channel_idx, struct pulse_io_channel **chan)
 Reserve a channel for exclusive use.
int pulse_io_channel_release (const struct device *dev, struct pulse_io_channel *chan)
 Release a channel previously obtained via pulse_io_channel_get.
int pulse_io_channel_configure (const struct device *dev, struct pulse_io_channel *chan, const struct pulse_io_config *cfg)
 Configure a reserved channel.
int pulse_io_transmit_sync (const struct device *dev, struct pulse_io_channel *chan, const struct pulse_io_tx_req *req, k_timeout_t timeout)
 Blocking transmit.
int pulse_io_receive_sync (const struct device *dev, struct pulse_io_channel *chan, const struct pulse_io_rx_req *req, size_t *count, k_timeout_t timeout)
 Blocking receive.
int pulse_io_stop (const struct device *dev, struct pulse_io_channel *chan)
 Stop any in-flight transmit or receive on the channel.
Encoder helpers (pre-expansion)

v1 ships pre-expansion helpers only: each call expands a protocol payload into a fully-resolved pulse_symbol array which the caller then submits via pulse_io_transmit_sync or the RTIO path.

A future revision may add a streaming variant that consumes payload incrementally from the TX ISR; that path will be additive and will not change the entry points defined here.

int pulse_io_encode_bytes (const struct pulse_io_bit_template *tmpl, const uint8_t *bytes, size_t nbytes, struct pulse_symbol *out, size_t out_cap, size_t *produced)
 Expand a byte stream into pulse symbols using a bit template.
RTIO integration

A backend may expose an RTIO submit path plus protocol encoder and decoder vtables, mirroring the sensor subsystem.

With these the userspace and asynchronous I/O machinery is provided by RTIO: the client encodes a payload into a symbol buffer, submits it through an RTIO queue, and decodes any captured reply.

int pulse_io_get_encoder (const struct device *dev, const struct pulse_io_encoder_api **api)
 Fetch the backend encoder vtable.
int pulse_io_get_decoder (const struct device *dev, const struct pulse_io_decoder_api **api)
 Fetch the backend decoder vtable.
int pulse_io_decode_bytes (const struct pulse_io_bit_template *tmpl, uint32_t tolerance_ticks, const struct pulse_symbol *in, size_t nsyms, uint8_t *out, size_t out_cap, size_t *produced)
 Default symbol-stream decoder.

Detailed Description

Main header file for the Pulse IO subsystem API.