ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_i2c_internal.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#include <stdint.h>
20
21#include "ra8_attributes.h"
22#include "ra8_i2c.h"
23#include "ra8_i2c_regs.h"
24
56bool priv_ra8_i2c_internal_clk_invalid(uint32_t bus_hz, uint32_t pclkb_hz);
57
71extern const char* const g_i2c_tag;
72
106
122
123/* =============================================================================
124 * Target (peripheral) role -- pure decision predicates promoted to TU-external
125 * linkage so their compound decisions can be exercised under MC/DC. Production
126 * callers live in ``ra8_i2c_peripheral.c``; the only out-of-TU consumers are the
127 * host tests under ``tests/``.
128 * =============================================================================
129 */
130
163bool priv_ra8_i2c_internal_peripheral_poll_done(uint8_t icsr1, uint8_t icsr2);
164
198 uint32_t received,
199 uint32_t capacity);
200
243 uint8_t* buf,
244 uint32_t capacity,
245 uint32_t* out_count);
246
278
311bool priv_ra8_i2c_internal_peripheral_tx_continue(uint8_t icsr2, uint32_t sent, uint32_t len);
312
313#ifdef __cplusplus
314}
315#endif
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_i2c_state_t s_i2c_state[k_ra8_i2c_channel_count]
Per-channel state table indexed by channel.
Definition ra8_i2c.c:132
const char *const g_i2c_tag
Log tag for this driver, shared with ra8_i2c_config.c.
Definition ra8_i2c.c:65
I2C Bus Interface (IIC) controller driver – polling mode.
void(* ra8_i2c_peripheral_event_fn_t)(void *ctx, ra8_i2c_peripheral_event_t event)
Address-match callback fired by ra8_i2c_peripheral_dispatch.
Definition ra8_i2c.h:462
bool priv_ra8_i2c_internal_peripheral_tx_continue(uint8_t icsr2, uint32_t sent, uint32_t len)
Transmit-loop predicate: keep sending while no NACK and data remains.
bool priv_ra8_i2c_internal_peripheral_poll_done(uint8_t icsr1, uint8_t icsr2)
Poll-exit predicate: an own-address match or a STOP was observed.
bool priv_ra8_i2c_internal_peripheral_rx_continue(uint8_t icsr2, uint32_t received, uint32_t capacity)
Receive-loop predicate: keep draining while no STOP and room remains.
bool priv_ra8_i2c_internal_clk_invalid(uint32_t bus_hz, uint32_t pclkb_hz)
Pure predicate: either clock argument is zero.
Definition ra8_i2c.c:114
ra8_err_t priv_ra8_i2c_internal_target_drain_rx(volatile r_i2c_regs_t *reg, uint8_t *buf, uint32_t capacity, uint32_t *out_count)
Drain controller-write data bytes from ICDRR into buf.
bool priv_ra8_i2c_internal_peripheral_tx_done(uint8_t icsr2)
Transmit-completion predicate: the controller ended the read.
I2C Bus Interface (IIC) register layout for the Renesas RA8D2.
@ k_ra8_i2c_channel_count
HUM Ch 39.1, p 2367 (3 channels).
Memory-mapped register block for one IIC channel.
Per-channel driver state shared by both I2C translation units.
void * peripheral_ctx
Opaque context passed to peripheral_handler.
bool bus_held
True when the previous write returned with send_stop=false so the next call must inject a repeated-ST...
bool peripheral_active
True between ra8_i2c_peripheral_init and ra8_i2c_peripheral_deinit – own-address matching is armed an...
bool initialized
Tracks ra8_i2c_init / ra8_i2c_deinit.
ra8_i2c_peripheral_event_fn_t peripheral_handler
Address-match callback fired by ra8_i2c_peripheral_dispatch; NULL when no handler is attached.