42static const char*
s_tag =
"IICBP";
48typedef enum : uint32_t {
57typedef enum : uint32_t {
87 if ((reg->
NTST & mask) == mask) {
127 if (reg ==
nullptr) {
141 if (reg ==
nullptr) {
144 if ((len > 0U) && (data ==
nullptr)) {
148 for (uint32_t i = 0U; i < len; ++i) {
151 "ra8_i3c_i2c_peripheral_send: TDBEF0 wait");
152 reg->
NTDTBP0 = (uint32_t)data[i];
160 if (reg ==
nullptr) {
163 if ((len > 0U) && (buf ==
nullptr)) {
167 for (uint32_t i = 0U; i < len; ++i) {
170 "ra8_i3c_i2c_peripheral_receive: RDBFF0 wait");
180 if (reg ==
nullptr) {
183 const uint32_t ntst = reg->
NTST;
184 const uint32_t bst = reg->
BST;
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_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#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_invalid_arg
Invalid function argument.
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
@ 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.
static ra8_err_t internal_wait_ntst(volatile const r_i3c_i2c_regs_t *reg, uint32_t mask)
Bounded wait until mask bits set in NTST.
ra8_err_t ra8_i3c_i2c_peripheral_status(uint8_t channel, uint8_t *out_mask)
Read latched peripheral-side status mask.
ra8_i3c_i2c_peripheral_bits_t
Local register-bit positions / masks used by this driver.
@ k_ra8_i3c_i2c_peripheral_msk_ntst_rdbff0
NTST.RDBFF0.
@ k_ra8_i3c_i2c_peripheral_byte_mask
NTDTBP0 low-byte mask.
@ k_ra8_i3c_i2c_peripheral_msk_ntst_tdbef0
NTST.TDBEF0.
@ k_ra8_i3c_i2c_peripheral_msk_svctl_gcae
SVCTL.GCAE.
@ k_ra8_i3c_i2c_peripheral_msdvad_shift_dvad
Address shifted left 1.
ra8_err_t ra8_i3c_i2c_peripheral_send(uint8_t channel, const uint8_t *data, uint32_t len)
Push len bytes into NTDTBP0 in response to a controller-read.
ra8_err_t ra8_i3c_i2c_peripheral_open(uint8_t channel, const ra8_i3c_i2c_peripheral_cfg_t *cfg)
Open a channel as an IIC_B peripheral.
ra8_i3c_i2c_peripheral_internal_t
Internal tunables.
@ k_ra8_i3c_i2c_peripheral_spin_budget
Bounded poll iterations.
@ k_ra8_i3c_i2c_peripheral_max_addr_7b
7-bit address ceiling.
ra8_err_t ra8_i3c_i2c_peripheral_receive(uint8_t channel, uint8_t *buf, uint32_t len)
Drain len bytes from NTDTBP0 after a controller-write.
ra8_err_t ra8_i3c_i2c_peripheral_close(uint8_t channel)
Close the peripheral channel.
IIC_B (I3C in I2C-only mode) peripheral driver – mirrors FSP r_iic_b_peripheral.
@ k_ra8_i3c_i2c_peripheral_status_nack
BST.NACKDF set.
@ k_ra8_i3c_i2c_peripheral_status_stop
BST.SPCNDDF set.
@ k_ra8_i3c_i2c_peripheral_status_tx_empty
NTST.TDBEF0 set.
@ k_ra8_i3c_i2c_peripheral_status_rx_full
NTST.RDBFF0 set.
@ k_ra8_i3c_i2c_peripheral_status_aas
Address matched.
IIC_B (I3C-based I2C) register layout for the Renesas RA8D2.
static volatile r_i3c_i2c_regs_t * i3c_i2c_regs(uint8_t channel)
Get a pointer to the IIC_B / I3C channel channel.
@ k_ra8_i3c_i2c_msk_bst_nackdf
HUM 40.2 BST.NACKDF, p 2482.
@ k_ra8_i3c_i2c_msk_bst_spcnddf
HUM 40.2 BST.SPCNDDF, p 2482.
@ k_ra8_i3c_i2c_msk_bctl_buse
HUM 40.2 BCTL.BUSE, p 2454.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
#define ra8_log_error(tag, message)
RA8 log error.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
ra8_err_t ra8_mstp_disable(ra8_mstp_t id)
Reference-counted "gate this peripheral" request.
Module Stop Control (MSTP) register layout for the Renesas RA8D2.
@ k_ra8_mstp_i3c
MSTPB4 I3C.
Memory-mapped register block for one IIC_B / I3C channel.
volatile uint32_t NTST
+0x1E0 Normal Transfer Status (HUM 40.2, p 2486).
volatile uint32_t BST
+0x1D0 Bus Status (HUM 40.2, p 2482).
volatile uint32_t BCTL
+0x014 Bus Control (HUM 40.2, p 2454).
volatile uint32_t MSDVAD
+0x018 Controller Device Address (HUM 40.2, p 2455).
volatile uint32_t RSTCTL
+0x020 Reset Control (HUM 40.2, p 2456).
volatile uint32_t SVCTL
+0x064 Peripheral Control (HUM 40.2, p 2461).
volatile uint32_t NTDTBP0
+0x158 Normal Tx/Rx Data Buffer 0 (HUM 40.2, p 2476).
Configuration descriptor for ra8_i3c_i2c_peripheral_open.
uint8_t general_call
Non-zero -> answer general-call address.
uint8_t peripheral_addr_7b
7-bit own address.