67typedef enum : uint8_t {
107typedef enum : uint8_t {
152typedef enum : uint8_t {
185typedef enum : uint8_t {
275ra8_i3c_write(uint8_t channel, uint8_t addr,
const uint8_t* data, uint32_t len,
bool restart);
304ra8_i3c_read(uint8_t channel, uint8_t addr, uint8_t* buf, uint32_t len,
bool restart);
599 uint8_t target_count);
651ra8_i3c_send_ccc(uint8_t ccc, uint8_t target_addr,
const uint8_t* payload, uint8_t len);
673ra8_i3c_recv_ccc(uint8_t ccc, uint8_t target_addr, uint8_t* buf, uint8_t max_len, uint8_t* got_len);
787typedef enum : uint8_t {
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t ra8_i3c_exit_stop(void)
Exit MSTP-gated stop (native mode).
ra8_err_t ra8_i3c_target_open(uint8_t static_addr)
Enter peripheral (target) mode (native mode).
ra8_err_t ra8_i3c_read(uint8_t channel, uint8_t addr, uint8_t *buf, uint32_t len, bool restart)
Read len bytes from addr.
ra8_err_t ra8_i3c_get_status(uint32_t *out_mask)
Read the native INST status register (native mode).
ra8_err_t ra8_i3c_transfer(uint8_t channel, uint8_t addr, const uint8_t *wr, uint32_t wr_len, uint8_t *rd, uint32_t rd_len)
Write-then-read with repeated-START framing (I2C mode).
ra8_i3c_err_t
Latched error bits returned by ra8_i3c_get_errors (I2C mode).
@ k_ra8_i3c_err_timeout
Bus timeout (BST.TODF).
@ k_ra8_i3c_err_arb_lost
Arbitration lost (BST.ALF).
@ k_ra8_i3c_err_nack
NACK received (BST.NACKDF).
@ k_ra8_i3c_err_none
No latched error.
ra8_err_t ra8_i3c_send_ccc(uint8_t ccc, uint8_t target_addr, const uint8_t *payload, uint8_t len)
Generic CCC send – broadcast or directed write (native mode).
ra8_err_t ra8_i3c_peripheral_send(uint8_t channel, const uint8_t *data, uint32_t len)
Queue bytes for the controller to read (responder mode).
ra8_err_t ra8_i3c_clear_status(uint32_t mask)
Clear native INST status bits (native mode).
void ra8_i3c_dispatch(uint8_t channel)
Snapshot status and fire the channel's callback.
ra8_err_t ra8_i3c_deinit(uint8_t channel)
Tear down an I3C channel and gate the peripheral.
ra8_err_t ra8_i3c_peripheral_receive(uint8_t channel, uint8_t *buf, uint32_t len)
Read bytes the controller wrote (responder mode).
ra8_err_t ra8_i3c_enter_stop(void)
Put native I3C0 into MSTP-gated stop (native mode).
ra8_err_t ra8_i3c_peripheral_status(uint8_t channel, uint8_t *out_mask)
Read the latched responder-mode status (responder mode).
ra8_err_t ra8_i3c_set_dynamic_address(uint8_t static_addr, uint8_t dynamic_addr)
Issue SETDASA to assign one target a dynamic address (native mode).
ra8_err_t ra8_i3c_bus_enable(bool enable)
Enable/disable bus-primary operation via BCTL.BUSE (native mode).
ra8_err_t ra8_i3c_dynamic_address_assign(ra8_i3c_daa_target_t *targets, uint8_t target_count)
Issue ENTDAA to enumerate I3C targets (native mode).
ra8_i3c_mode_t
Operating mode selected per channel at ra8_i3c_init.
@ k_ra8_i3c_mode_native
Native MIPI I3C (DAA/CCC/SDR/HDR/IBI).
@ k_ra8_i3c_mode_i2c
Legacy I2C-compatibility controller.
ra8_err_t ra8_i3c_attach_handler(uint8_t channel, ra8_i3c_event_fn_t fn, void *ctx)
Attach an event callback for a channel.
ra8_err_t ra8_i3c_ibi_enable(uint8_t target_addr)
Enable inbound IBI capture for a target (native mode).
ra8_err_t ra8_i3c_abort(uint8_t channel)
Abort an in-flight I2C transfer and release the bus (I2C mode).
ra8_i3c_ibi_type_t
Type encoded in an IBI status descriptor (native mode).
@ k_ra8_i3c_ibi_type_main_request
Mainship request.
@ k_ra8_i3c_ibi_type_interrupt
Peripheral-initiated IBI.
@ k_ra8_i3c_ibi_type_hot_join
Hot-join request.
ra8_err_t ra8_i3c_scan(uint8_t channel, uint8_t addr, bool *out_acked)
Probe whether a 7-bit address acknowledges (I2C mode).
ra8_err_t ra8_i3c_ibi_read(ra8_i3c_ibi_t *out_ibi)
Drain one inbound IBI from NIBIQP (native mode).
void(* ra8_i3c_event_fn_t)(void *ctx, uint32_t status)
Event callback fired by ra8_i3c_dispatch.
ra8_i3c_hdr_mode_t
HDR transfer-mode selector for ra8_i3c_set_hdr_mode (native).
@ k_ra8_i3c_hdr_mode_sdr
Plain SDR transfer (default).
@ k_ra8_i3c_hdr_mode_ts
HDR-TS.
@ k_ra8_i3c_hdr_mode_ddr
HDR-DDR.
ra8_err_t ra8_i3c_recv_ccc(uint8_t ccc, uint8_t target_addr, uint8_t *buf, uint8_t max_len, uint8_t *got_len)
Generic CCC receive – directed read (native mode).
ra8_err_t ra8_i3c_set_address(uint32_t addr)
Programme the primary dynamic address (native mode).
ra8_err_t ra8_i3c_write(uint8_t channel, uint8_t addr, const uint8_t *data, uint32_t len, bool restart)
Write len bytes to addr.
ra8_err_t ra8_i3c_ibi_drain(ra8_i3c_ibi_t *ibi)
Pop one inbound IBI (alias of ra8_i3c_ibi_read, native mode).
ra8_err_t ra8_i3c_set_hdr_mode(uint8_t target_addr, ra8_i3c_hdr_mode_t mode)
Programme the NCMDQP transfer-mode field for a target (native mode).
ra8_i3c_peripheral_status_t
Latched responder-mode event bits from ra8_i3c_peripheral_status.
@ k_ra8_i3c_peripheral_status_rx_full
Receive buffer full.
@ k_ra8_i3c_peripheral_status_idle
No latched event.
@ k_ra8_i3c_peripheral_status_tx_empty
Transmit buffer empty.
@ k_ra8_i3c_peripheral_status_aas
Address matched.
@ k_ra8_i3c_peripheral_status_stop
STOP detected.
@ k_ra8_i3c_peripheral_status_nack
NACK detected.
ra8_err_t ra8_i3c_get_errors(uint8_t channel, uint8_t *out_mask)
Read the latched I2C error mask (I2C mode).
ra8_err_t ra8_i3c_peripheral_open(uint8_t channel, const ra8_i3c_peripheral_cfg_t *cfg)
Open a channel in I2C-compat responder mode.
ra8_err_t ra8_i3c_clear_errors(uint8_t channel)
Clear latched I2C error bits (I2C mode).
ra8_err_t ra8_i3c_reset_dynamic_addresses(void)
Issue RSTDAA to clear all dynamic addresses (native mode).
ra8_err_t ra8_i3c_init(uint8_t channel, const ra8_i3c_cfg_t *cfg)
Initialise an I3C channel in the configured mode.
ra8_err_t ra8_i3c_peripheral_close(uint8_t channel)
Close responder mode on a channel.
ra8_err_t ra8_i3c_set_clock(uint8_t channel, uint32_t bus_hz, uint32_t pclka_hz)
Re-programme the I2C bit rate (I2C mode).
Per-channel bring-up configuration for ra8_i3c_init.
uint32_t bus_hz
Target bus clock in Hz (I2C mode).
ra8_i3c_mode_t mode
Operating mode for this channel.
uint32_t pclka_hz
Source clock for the bit-rate calc (I2C).
One target entry filled in by ENTDAA (native mode).
uint8_t pid[6]
48-bit Provisional ID (BE order).
uint8_t bcr
Bus Characteristic Register byte.
uint8_t dcr
Device Characteristic Register byte.
uint8_t dynamic_address
Address assigned to this target.
Decoded IBI inbound descriptor (native mode).
uint8_t payload[8]
Up to 8 bytes of payload.
uint8_t payload_len
Bytes that follow in payload[].
ra8_i3c_ibi_type_t type
IBI / HJ / MR classification.
uint8_t address
Originating dynamic address.
uint8_t last
1 if this is the final fragment.
Bring-up configuration for I2C-compat responder mode.
uint8_t peripheral_addr_7b
7-bit own address.
uint8_t general_call
Non-zero -> answer general-call address.