|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RIIC backend for the ra8_io I2C-bus facade – thin shim over ra8_i2c. More...
#include "ra8_io_i2c_bus_riic.h"#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_i2c.h"#include "ra8_i2c_regs.h"#include "ra8_io_i2c_bus.h"#include "ra8_io_i2c_bus_internal.h"Go to the source code of this file.
Functions | |
| static ra8_err_t | internal_riic_write (void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop) |
| RIIC backend: controller write. | |
| static ra8_err_t | internal_riic_read (void *ctx, uint8_t addr, uint8_t *data, uint32_t len) |
| RIIC backend: controller read. | |
| static ra8_err_t | internal_riic_transfer (void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len) |
| RIIC backend: write-then-RESTART-then-read. | |
| ra8_err_t | ra8_io_i2c_bus_bind_riic (ra8_io_i2c_bus_t *bus, uint8_t channel) |
| Bind bus to RIIC channel channel. | |
Variables | |
| static const char *const | s_tag = "ra8_io_i2c_bus_riic" |
| Module log tag. | |
| static const ra8_io_i2c_bus_iface_t | s_riic_iface |
| RIIC backend vtable – every row forwards to ra8_i2c_*. | |
RIIC backend for the ra8_io I2C-bus facade – thin shim over ra8_i2c.
Implements ra8_io_i2c_bus_iface by forwarding to the classic RIIC polling driver (ra8_i2c.h), unmodified. The bound channel index travels in the handle context ((void*)(uintptr_t)channel), so the backend keeps no static state and multiple bound buses coexist. Argument validation (channel range, NULL buffers, zero lengths) stays with the wrapped driver, which also carries every HUM citation – no raw MMIO is touched here.
Definition in file ra8_io_i2c_bus_riic.c.
|
static |
RIIC backend: controller read.
Decodes the channel from the handle context and forwards to ra8_i2c_read, which always ends the transaction with STOP.
| [in] | ctx | Bound channel index, encoded as (void*)(uintptr_t). |
| [in] | addr | 7-bit peripheral address. |
| [out] | data | Destination buffer. |
| [in] | len | Byte count. |
| k_ra8_ok | Bytes received. |
| k_ra8_err_null_ptr | data NULL or bad channel. |
| k_ra8_err_invalid_arg | len is zero. |
| k_ra8_err_nack | Peripheral NACKed the address byte. |
Definition at line 101 of file ra8_io_i2c_bus_riic.c.
References ra8_i2c_read().
|
static |
RIIC backend: write-then-RESTART-then-read.
Decodes the channel from the handle context and forwards to ra8_i2c_transfer, which owns the repeated-START framing.
| [in] | ctx | Bound channel index, encoded as (void*)(uintptr_t). |
| [in] | addr | 7-bit peripheral address. |
| [in] | wr | Bytes to send first. |
| [in] | wr_len | Number of bytes to send. |
| [out] | rd | Destination buffer. |
| [in] | rd_len | Number of bytes to read. |
| k_ra8_ok | Both phases completed; STOP issued. |
| k_ra8_err_null_ptr | A required buffer was NULL or bad channel. |
| k_ra8_err_invalid_arg | Both lengths zero. |
| k_ra8_err_nack | Peripheral NACKed. |
Definition at line 136 of file ra8_io_i2c_bus_riic.c.
References ra8_i2c_transfer(), and RA8_INTERNAL.
|
static |
RIIC backend: controller write.
Decodes the channel from the handle context and forwards to ra8_i2c_write, whose send_stop flag matches the facade contract directly.
| [in] | ctx | Bound channel index, encoded as (void*)(uintptr_t). |
| [in] | addr | 7-bit peripheral address. |
| [in] | data | Bytes to send. |
| [in] | len | Byte count. |
| [in] | send_stop | true = STOP after payload; false = hold the bus. |
| k_ra8_ok | Payload transmitted. |
| k_ra8_err_null_ptr | data NULL with len > 0 or bad channel. |
| k_ra8_err_nack | Peripheral NACKed. |
| k_ra8_err_hw_timeout | TDRE / TEND poll timed out. |
Definition at line 67 of file ra8_io_i2c_bus_riic.c.
References ra8_i2c_write().
|
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.
| [in,out] | bus | Caller-owned handle to bind (non-NULL). |
| [in] | channel | RIIC channel index (0, 1 or 2). |
| k_ra8_ok | bus now dispatches to ra8_i2c_*. |
| k_ra8_err_null_ptr | bus was NULL. |
| k_ra8_err_invalid_arg | channel is out of range. |
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.
|
static |
RIIC backend vtable – every row forwards to ra8_i2c_*.
Definition at line 147 of file ra8_io_i2c_bus_riic.c.
Referenced by ra8_io_i2c_bus_bind_riic().
|
static |
Module log tag.
Definition at line 34 of file ra8_io_i2c_bus_riic.c.