ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_i2c_bus_riic.h File Reference

RIIC backend binder for the ra8_io I2C-bus facade. More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_io_i2c_bus.h"
Include dependency graph for ra8_io_i2c_bus_riic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ra8_err_t ra8_io_i2c_bus_bind_riic (ra8_io_i2c_bus_t *bus, uint8_t channel)
 Bind bus to RIIC channel channel.

Detailed Description

RIIC backend binder for the ra8_io I2C-bus facade.

Tag
[Ring 4 / PAL] {World: NS}

Binds a caller-owned ra8_io_i2c_bus_t to a classic RIIC channel via thin trampolines to ra8_i2c_write / ra8_i2c_read / ra8_i2c_transfer (ra8_i2c.h, unmodified). The channel must already be initialised through ra8_i2c_init – the facade owns transfers only, never bring-up.

Since
0.1.0

Definition in file ra8_io_i2c_bus_riic.h.

Function Documentation

◆ ra8_io_i2c_bus_bind_riic()

ra8_err_t ra8_io_i2c_bus_bind_riic ( ra8_io_i2c_bus_t * bus,
uint8_t channel )
nodiscard

Bind bus to RIIC channel channel.

Installs the RIIC trampoline vtable and records the channel in the handle context. No hardware is touched: initialise the channel with ra8_i2c_init(channel, ...) (before or after binding) and route the SCL/SDA pins yourself.

Parameters
[in,out]busCaller-owned handle to bind (non-NULL).
[in]channelRIIC channel index (0, 1 or 2).
Returns
ra8_err_t Error code.
Return values
k_ra8_okbus now dispatches to ra8_i2c_*.
k_ra8_err_null_ptrbus was NULL.
k_ra8_err_invalid_argchannel is out of range.
Precondition
bus points to writable storage.
channel < 3 (the RA8D2 has IIC0..IIC2).
Postcondition
On success bus->iface is non-NULL and every ra8_io_i2c_bus_* call forwards to RIIC channel channel.
On failure bus is left unmodified.
Note
Thread-safe (writes only the caller's handle).
See also
ra8_io_i2c_bus_bind_i3c_compat The I3C I2C-compatibility twin.
Since
0.1.0

Definition at line 153 of file ra8_io_i2c_bus_riic.c.

References ra8_io_i2c_bus_t::ctx, ra8_io_i2c_bus_t::iface, k_ra8_err_invalid_arg, k_ra8_i2c_channel_count, k_ra8_ok, RA8_CHECK_NULL_PTR, s_riic_iface, and s_tag.