45static const char*
s_tag =
"IIC_B";
51typedef enum : uint32_t {
102 if (reg ==
nullptr) {
143 const uint32_t bst = reg->
BST;
144 const bool transfer_done =
146#if defined(RA8_OFF_TARGET) && defined(UNIT_TEST)
148 const bool observed = ra8_fake_mmio_poll(®->
BST, i, transfer_done);
150 const bool observed = transfer_done;
174 if (reg ==
nullptr) {
184 if (reg ==
nullptr) {
192 reg->
BST = reg->
BST & ~k_ra8_i3c_i2c_err_clear_mask;
204 if (reg ==
nullptr) {
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_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.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Bounded wait-flag primitives for RA8D2 HAL drivers.
void priv_i3c_i2c_start(volatile r_i3c_i2c_regs_t *reg)
Issue a START condition.
bool priv_i3c_i2c_should_dispatch(uint8_t mask, const void *cb)
Pure dispatch-callback predicate – see header for full contract.
ra8_i3c_i2c_state_t s_iic_b_state[k_ra8_i3c_i2c_channel_count]
Per-channel state table indexed by channel.
void priv_i3c_i2c_clear_bst(volatile r_i3c_i2c_regs_t *reg)
Clear all latched bus-status flags ahead of a new transaction.
ra8_err_t priv_i3c_i2c_send_address(volatile r_i3c_i2c_regs_t *reg, uint8_t address_byte)
Send a single address byte and wait for TDBEF0 to be ready for the next slot.
void priv_i3c_i2c_stop(volatile r_i3c_i2c_regs_t *reg)
Issue a STOP condition.
IIC_B (I3C unified IP, I2C-only mode) controller driver.
@ k_ra8_i3c_i2c_err_timeout
BST.TODF set.
@ k_ra8_i3c_i2c_err_nack
BST.NACKDF set.
@ k_ra8_i3c_i2c_err_none
No latched error.
@ k_ra8_i3c_i2c_err_arb_lost
BST.ALF set.
void(* ra8_i3c_i2c_complete_fn_t)(void *ctx, uint8_t err_mask)
Transfer-complete / error callback signature.
ra8_err_t ra8_i3c_i2c_abort(uint8_t channel)
Cancel any in-flight transaction and return the channel to idle.
internal_i3c_i2c_control_t
Implementation constants for the control-plane TU.
@ k_ra8_i3c_i2c_ctrl_poll_limit
Generic spin budget for status-flag polls.
@ k_ra8_i3c_i2c_ctrl_addr_shift
Shift count to convert a 7-bit address into the on-the-wire byte.
@ k_ra8_i3c_i2c_ctrl_addr_rw_write
R/W bit value for a write transaction (0 in LSB).
ra8_err_t ra8_i3c_i2c_get_errors(uint8_t channel, uint8_t *out_mask)
Read latched error flags from BST (AL / NACKDF / TODF).
static uint8_t internal_i3c_i2c_decode_errors(uint32_t bst)
Decode latched BST error bits into a k_ra8_i3c_i2c_err_* mask.
ra8_err_t ra8_i3c_i2c_attach_handler(uint8_t channel, ra8_i3c_i2c_complete_fn_t fn, void *ctx)
Attach a completion / error callback for the channel.
ra8_err_t ra8_i3c_i2c_clear_errors(uint8_t channel)
Clear latched error flags in BST.
void ra8_i3c_i2c_dispatch_eri(uint8_t channel)
Dispatch the bus-error IRQ source.
ra8_err_t ra8_i3c_i2c_scan(uint8_t channel, uint8_t target_7b, bool *out_acked)
Probe whether a 7-bit address ACKs.
Test-access surface for ra8_i3c_i2c internal helpers (MC/DC).
IIC_B (I3C-based I2C) register layout for the Renesas RA8D2.
@ k_ra8_i3c_i2c_channel_count
HUM Ch 40.1.1, p 2445.
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_bie_nackdie
HUM 40.2 BIE.NACKDIE, p 2484.
@ k_ra8_i3c_i2c_msk_bie_tendie
HUM 40.2 BIE.TENDIE, p 2484.
@ k_ra8_i3c_i2c_msk_ntie_tdbeie0
HUM 40.2 NTIE.TDBEIE0, p 2488.
@ k_ra8_i3c_i2c_msk_bst_nackdf
HUM 40.2 BST.NACKDF, p 2482.
@ k_ra8_i3c_i2c_msk_bie_alie
HUM 40.2 BIE.ALIE, p 2484.
@ k_ra8_i3c_i2c_msk_bst_tendf
HUM 40.2 BST.TENDF, p 2482.
@ k_ra8_i3c_i2c_msk_bst_alf
HUM 40.2 BST.ALF, p 2482.
@ k_ra8_i3c_i2c_msk_bst_todf
HUM 40.2 BST.TODF, p 2482.
@ k_ra8_i3c_i2c_msk_ntie_rdbfie0
HUM 40.2 NTIE.RDBFIE0, p 2488.
@ k_ra8_i3c_i2c_msk_bie_todie
HUM 40.2 BIE.TODIE, p 2484.
Memory-mapped register block for one IIC_B / I3C channel.
volatile uint32_t BST
+0x1D0 Bus Status (HUM 40.2, p 2482).
volatile uint32_t NTIE
+0x1E8 Normal Xfer Interrupt Enable (HUM 40.2, p 2488).
volatile uint32_t BIE
+0x1D8 Bus Interrupt Enable (HUM 40.2, p 2484).