31static const char*
const s_tag =
"ra8_io_i2c_bus";
67 if (bus->
iface ==
nullptr) {
89 return bus->
iface->
write(bus->
ctx, addr, data, len, send_stop);
241 out->
ctx = (
void*)(uintptr_t)bus;
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Injected I2C-bus seam consumed by Ring-3 I2C device drivers.
static ra8_err_t internal_ops_transfer(void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Seam trampoline – forward a combined transfer into the bound bus.
ra8_err_t ra8_io_i2c_bus_as_ops(const ra8_io_i2c_bus_t *bus, ra8_i2c_bus_ops_t *out)
Expose a bound bus through the Ring-3 seam ra8_i2c_bus_ops_t.
static ra8_err_t internal_ops_write(void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop)
Seam trampoline – forward a controller write into the bound bus.
static ra8_err_t internal_ops_read(void *ctx, uint8_t addr, uint8_t *data, uint32_t len)
Seam trampoline – forward a controller read into the bound bus.
ra8_err_t ra8_io_i2c_bus_write(const ra8_io_i2c_bus_t *bus, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop)
Controller write of len bytes to 7-bit address addr.
ra8_err_t ra8_io_i2c_bus_read(const ra8_io_i2c_bus_t *bus, uint8_t addr, uint8_t *data, uint32_t len)
Controller read of len bytes from 7-bit address addr.
ra8_err_t ra8_io_i2c_bus_transfer(const ra8_io_i2c_bus_t *bus, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Combined write-then-RESTART-then-read in one bus transaction.
static ra8_err_t internal_validate(const ra8_io_i2c_bus_t *bus)
Reject a handle that is NULL or has no backend bound.
ra8_io I2C-bus facade – one controller-transfer vtable over thechip's two I2C implementations.
Internal vtable type for the ra8_io I2C-bus facade.
Caller-filled I2C controller-transfer seam (write / read / write-then-read).
ra8_err_t(* read)(void *ctx, uint8_t addr, uint8_t *data, uint32_t len)
Controller read of len bytes from 7-bit address addr.
void * ctx
Opaque cookie handed to every callback (binder-owned).
ra8_err_t(* transfer)(void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Combined write-then-RESTART-then-read in one transaction.
ra8_err_t(* write)(void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop)
Controller write of len bytes to 7-bit address addr.
ra8_err_t(* read)(void *ctx, uint8_t addr, uint8_t *data, uint32_t len)
Controller read; always ends with STOP.
ra8_err_t(* transfer)(void *ctx, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Write-then-RESTART-then-read combined transaction.
ra8_err_t(* write)(void *ctx, uint8_t addr, const uint8_t *data, uint32_t len, bool send_stop)
Controller write; send_stop false holds the bus.
Caller-allocated I2C-bus handle binding a backend to its context.
const ra8_io_i2c_bus_iface_t * iface
Bound backend vtable (private).
void * ctx
Backend-private context (private).