|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Test-access surface for ra8_i3c_i2c internal helpers (MC/DC). More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_err.h"#include "ra8_i3c_i2c.h"#include "ra8_i3c_i2c_regs.h"Go to the source code of this file.
Data Structures | |
| struct | ra8_i3c_i2c_state_t |
| Per-channel dispatch state shared across the driver's TUs. More... | |
Functions | |
| void | priv_i3c_i2c_start (volatile r_i3c_i2c_regs_t *reg) |
| Issue a START condition on the given channel registers. | |
| void | priv_i3c_i2c_stop (volatile r_i3c_i2c_regs_t *reg) |
| Issue a STOP condition and clear the prior STOP-detect flag. | |
| 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 readiness. | |
| bool | priv_i3c_i2c_len_buf_invalid (uint32_t len, const void *buf) |
| Pure predicate: non-zero length AND a NULL buffer pointer. | |
| bool | priv_i3c_i2c_should_dispatch (uint8_t mask, const void *cb) |
| Pure predicate: non-zero error mask AND a non-NULL callback. | |
Variables | |
| ra8_i3c_i2c_state_t | s_iic_b_state [k_ra8_i3c_i2c_channel_count] |
| Per-channel state table indexed by channel. | |
Test-access surface for ra8_i3c_i2c internal helpers (MC/DC).
Declares caller-invisible IIC_B state and cross-translation-unit transaction helpers used by the public compatibility API.
Definition in file ra8_i3c_i2c_internal.h.
| void priv_i3c_i2c_clear_bst | ( | volatile r_i3c_i2c_regs_t * | reg | ) |
Clear all latched bus-status flags ahead of a new transaction.
Shared BST scrub used before every transaction. Promoted to TU-external linkage so the control-plane TU (abort / scan) and the data-path TU can both clear the latched flags.
| [in] | reg | Channel register block (non-NULL). |
reg points to a valid IIC_B register block. ra8_i3c_i2c_init. BST flags are cleared (W0C). See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| [in] | reg | See header declaration for direction and constraints. |
< RA8 I3C I2C bst clear mask.
Definition at line 347 of file ra8_i3c_i2c.c.
References r_i3c_i2c_regs_t::BST, k_ra8_i3c_i2c_msk_bst_alf, k_ra8_i3c_i2c_msk_bst_nackdf, k_ra8_i3c_i2c_msk_bst_spcnddf, k_ra8_i3c_i2c_msk_bst_stcnddf, k_ra8_i3c_i2c_msk_bst_tendf, and k_ra8_i3c_i2c_msk_bst_todf.
Referenced by internal_i3c_i2c_finalize(), ra8_i3c_i2c_abort(), ra8_i3c_i2c_read(), ra8_i3c_i2c_scan(), and ra8_i3c_i2c_write().
| bool priv_i3c_i2c_len_buf_invalid | ( | uint32_t | len, |
| const void * | buf ) |
Pure predicate: non-zero length AND a NULL buffer pointer.
Reusable for both the (tx_len != 0 && tx == NULL) and (rx_len != 0 && rx == NULL) checks at libs/ra8_hal/src/ra8_i3c_i2c.c lines 973 and 976 inside ra8_i3c_i2c_read.
| [in] | len | Length in bytes (zero means "not used"). |
| [in] | buf | Buffer pointer (NULL means "not provided"). |
| true | Caller must return k_ra8_err_null_ptr. |
| false | Combination is valid. |
Pure predicate: non-zero length AND a NULL buffer pointer.
Promoted helper so the line-976 AND can be driven under MC/DC.
| [in] | len | Length in bytes. |
| [in] | buf | Buffer pointer. |
| true | Caller returns null-ptr error. |
| false | Combination is OK. |
Definition at line 76 of file ra8_i3c_i2c.c.
Referenced by ra8_i3c_i2c_transfer().
| 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 readiness.
Shared address-phase helper. Promoted to TU-external linkage so the control-plane TU (ra8_i3c_i2c_scan) and the data-path TU can both push the pre-shifted address byte and forward timeout / NACK detection.
| [in] | reg | Channel registers (non-NULL). |
| [in] | address_byte | Pre-shifted 7-bit address with the R/W bit set. |
| k_ra8_ok | Address byte written, TDBEF0 ready. |
| k_ra8_err_hw_timeout | TDBEF0 never set within the poll budget. |
reg points to a valid IIC_B register block. NTDTBP0. Send a single address byte and wait for TDBEF0 readiness.
| [in] | reg | Channel registers. |
| [in] | address_byte | Pre-shifted address with R/W bit. |
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| k_ra8_ok | Success path. |
| k_ra8_err_invalid_arg | Caller violated a precondition. |
Definition at line 380 of file ra8_i3c_i2c.c.
References internal_i3c_i2c_wait_ntst(), k_ra8_i3c_i2c_msk_ntst_tdbef0, k_ra8_ok, and r_i3c_i2c_regs_t::NTDTBP0.
Referenced by ra8_i3c_i2c_read(), ra8_i3c_i2c_scan(), and ra8_i3c_i2c_write().
| bool priv_i3c_i2c_should_dispatch | ( | uint8_t | mask, |
| const void * | cb ) |
Pure predicate: non-zero error mask AND a non-NULL callback.
Promoted from the inline AND at libs/ra8_hal/src/ra8_i3c_i2c.c inside ra8_i3c_i2c_dispatch_eri.
| [in] | mask | Bitmask of pending error sources. |
| [in] | cb | Callback pointer (NULL when none registered). |
| true | Caller must invoke cb. |
| false | Skip the callback. |
Pure predicate: non-zero error mask AND a non-NULL callback.
Promoted helper so the line-1235 AND can be driven under MC/DC.
| [in] | mask | Bitmask of pending error sources. |
| [in] | cb | Callback pointer. |
| true | Caller invokes cb. |
| false | Skip callback. |
Definition at line 96 of file ra8_i3c_i2c.c.
Referenced by ra8_i3c_i2c_dispatch_eri().
| void priv_i3c_i2c_start | ( | volatile r_i3c_i2c_regs_t * | reg | ) |
Issue a START condition on the given channel registers.
Shared START helper writing CNDCTL.STCND. Promoted to TU-external linkage so the control-plane TU (ra8_i3c_i2c_scan) and the data-path TU can both issue it.
| [in] | reg | Channel register block (non-NULL). |
reg points to a valid IIC_B register block. ra8_i3c_i2c_init. CNDCTL.STCND is set, requesting a START on the bus. Issue a START condition on the given channel registers.
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
| [in] | reg | See header declaration for direction and constraints. |
Definition at line 277 of file ra8_i3c_i2c.c.
References r_i3c_i2c_regs_t::CNDCTL, and k_ra8_i3c_i2c_msk_cndctl_stcnd.
Referenced by internal_i3c_i2c_open_phase(), and ra8_i3c_i2c_scan().
| void priv_i3c_i2c_stop | ( | volatile r_i3c_i2c_regs_t * | reg | ) |
Issue a STOP condition and clear the prior STOP-detect flag.
Shared STOP helper writing CNDCTL.SPCND after a W0C clear of BST.SPCNDDF. Promoted to TU-external linkage so the control-plane TU (abort / scan) and the data-path TU can both issue it.
| [in] | reg | Channel register block (non-NULL). |
reg points to a valid IIC_B register block. ra8_i3c_i2c_init. CNDCTL.SPCND is set, requesting a STOP on the bus. BST.SPCNDDF flag is cleared.Issue a STOP condition and clear the prior STOP-detect flag.
Mirrors FSP's stop-on-completion path (its RXI read + TEI end handlers). SPCNDDF is left for the ERI dispatcher to observe; the polling helpers don't gate on it because the synchronous flow is already past the data phase by the time we get here.
HUM Ch 40.2.32 "CNDCTL : Condition Control Register" p 2479
| [in] | reg | See header declaration for direction and constraints. |
Definition at line 325 of file ra8_i3c_i2c.c.
References r_i3c_i2c_regs_t::BST, r_i3c_i2c_regs_t::CNDCTL, k_ra8_i3c_i2c_msk_bst_spcnddf, and k_ra8_i3c_i2c_msk_cndctl_spcnd.
Referenced by internal_i3c_i2c_finalize(), ra8_i3c_i2c_abort(), ra8_i3c_i2c_read(), ra8_i3c_i2c_scan(), and ra8_i3c_i2c_write().
|
extern |
Per-channel state table indexed by channel.
The ra8_i3c_i2c_state_t type and the matching extern declaration live in ra8_i3c_i2c_internal.h so the control-plane TU (ra8_i3c_i2c_control.c) can share this single definition.
Defined in ra8_i3c_i2c.c; the control-plane TU (abort / scan / attach_handler / dispatch_eri) reads and updates the held-bus and callback fields through this extern declaration.
ra8_i3c_i2c.c; do not define elsewhere. Definition at line 132 of file ra8_i3c_i2c.c.
Referenced by internal_i3c_i2c_finalize(), ra8_i3c_i2c_abort(), ra8_i3c_i2c_attach_handler(), ra8_i3c_i2c_deinit(), ra8_i3c_i2c_dispatch_eri(), ra8_i3c_i2c_init(), ra8_i3c_i2c_read(), and ra8_i3c_i2c_write().