|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
IIC_B (I3C in I2C-only mode) peripheral driver – mirrors FSP r_iic_b_peripheral. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_i3c_i2c_peripheral_cfg_t |
| Configuration descriptor for ra8_i3c_i2c_peripheral_open. More... | |
Enumerations | |
| enum | ra8_i3c_i2c_peripheral_status_t : uint8_t { k_ra8_i3c_i2c_peripheral_status_idle = 0x00U , k_ra8_i3c_i2c_peripheral_status_aas = 0x01U , k_ra8_i3c_i2c_peripheral_status_rx_full = 0x02U , k_ra8_i3c_i2c_peripheral_status_tx_empty = 0x04U , k_ra8_i3c_i2c_peripheral_status_stop = 0x08U , k_ra8_i3c_i2c_peripheral_status_nack = 0x10U } |
| Peripheral-side status mask. More... | |
Functions | |
| 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_err_t | ra8_i3c_i2c_peripheral_close (uint8_t channel) |
| Close the peripheral channel. | |
| 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_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_status (uint8_t channel, uint8_t *out_mask) |
| Read latched peripheral-side status mask. | |
IIC_B (I3C in I2C-only mode) peripheral driver – mirrors FSP r_iic_b_peripheral.
Peripheral-side companion to ra8_i3c_i2c (controller). The IIC_B block is documented in HUM Ch 40 "I3C Bus Interface (I3C)" pages 2445..2701. In peripheral mode the host bus controller addresses this device via its 7-bit MTAR / SDA address; matching transactions raise NTST.RDBFF0 / TDBEF0 and the polling helpers below drain or refill NTDTBP0 accordingly.
Public surface (mirrors FSP R_IIC_B_PERIPHERAL_*):
Definition in file ra8_i3c_i2c_peripheral.h.
| enum ra8_i3c_i2c_peripheral_status_t : uint8_t |
Peripheral-side status mask.
Definition at line 60 of file ra8_i3c_i2c_peripheral.h.
|
nodiscard |
Close the peripheral channel.
| [in] | channel | Channel index. |
| k_ra8_ok | Channel torn down. |
| k_ra8_err_invalid_arg | Channel out of range. |
Definition at line 124 of file ra8_i3c_i2c_peripheral.c.
References r_i3c_i2c_regs_t::BCTL, i3c_i2c_regs(), k_ra8_err_invalid_arg, k_ra8_mstp_i3c, r_i3c_i2c_regs_t::MSDVAD, ra8_mstp_disable(), and r_i3c_i2c_regs_t::SVCTL.
Referenced by ra8_i3c_peripheral_close().
|
nodiscard |
Open a channel as an IIC_B peripheral.
| [in] | channel | Channel index (only 0 valid on RA8D2). |
| [in] | cfg | Configuration descriptor (non-NULL). |
| k_ra8_ok | Channel up; address programmed. |
| k_ra8_err_null_ptr | cfg is NULL. |
| k_ra8_err_invalid_arg | Channel/address out of range. |
Definition at line 94 of file ra8_i3c_i2c_peripheral.c.
References r_i3c_i2c_regs_t::BCTL, ra8_i3c_i2c_peripheral_cfg_t::general_call, i3c_i2c_regs(), k_ra8_err_invalid_arg, k_ra8_i3c_i2c_msk_bctl_buse, k_ra8_i3c_i2c_peripheral_max_addr_7b, k_ra8_i3c_i2c_peripheral_msdvad_shift_dvad, k_ra8_i3c_i2c_peripheral_msk_svctl_gcae, k_ra8_mstp_i3c, k_ra8_ok, r_i3c_i2c_regs_t::MSDVAD, ra8_i3c_i2c_peripheral_cfg_t::peripheral_addr_7b, RA8_CHECK_NULL_PTR, ra8_log_error, ra8_log_info_val, ra8_mstp_enable(), r_i3c_i2c_regs_t::RSTCTL, s_tag, and r_i3c_i2c_regs_t::SVCTL.
Referenced by ra8_i3c_peripheral_open().
|
nodiscard |
Drain len bytes from NTDTBP0 after a controller-write.
| [in] | channel | Channel index. |
| [out] | buf | Destination buffer (non-NULL when len > 0). |
| [in] | len | Byte count. |
| k_ra8_ok | All bytes consumed. |
| k_ra8_err_null_ptr | buf is NULL with non-zero len. |
| k_ra8_err_invalid_arg | Channel out of range. |
| k_ra8_err_hw_timeout | RDBFF0 wait exhausted spin budget. |
Definition at line 157 of file ra8_i3c_i2c_peripheral.c.
References i3c_i2c_regs(), internal_wait_ntst(), k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_i3c_i2c_peripheral_byte_mask, k_ra8_i3c_i2c_peripheral_msk_ntst_rdbff0, k_ra8_ok, r_i3c_i2c_regs_t::NTDTBP0, ra8_log_error, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_i3c_peripheral_receive().
|
nodiscard |
Push len bytes into NTDTBP0 in response to a controller-read.
| [in] | channel | Channel index. |
| [in] | data | Buffer (non-NULL when len > 0). |
| [in] | len | Byte count. |
| k_ra8_ok | All bytes loaded. |
| k_ra8_err_null_ptr | data is NULL with non-zero len. |
| k_ra8_err_invalid_arg | Channel out of range. |
| k_ra8_err_hw_timeout | TDBEF0 wait exhausted spin budget. |
Definition at line 138 of file ra8_i3c_i2c_peripheral.c.
References i3c_i2c_regs(), internal_wait_ntst(), k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_i3c_i2c_peripheral_msk_ntst_tdbef0, k_ra8_ok, r_i3c_i2c_regs_t::NTDTBP0, ra8_log_error, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_i3c_peripheral_send().
|
nodiscard |
Read latched peripheral-side status mask.
| [in] | channel | Channel index. |
| [out] | out_mask | OR of k_ra8_i3c_i2c_peripheral_status_* bits (non-NULL). |
| k_ra8_ok | Snapshot populated. |
| k_ra8_err_null_ptr | out_mask is NULL. |
| k_ra8_err_invalid_arg | Channel out of range. |
Definition at line 176 of file ra8_i3c_i2c_peripheral.c.
References r_i3c_i2c_regs_t::BST, i3c_i2c_regs(), k_ra8_err_invalid_arg, k_ra8_i3c_i2c_msk_bst_nackdf, k_ra8_i3c_i2c_msk_bst_spcnddf, k_ra8_i3c_i2c_peripheral_msk_ntst_rdbff0, k_ra8_i3c_i2c_peripheral_msk_ntst_tdbef0, k_ra8_i3c_i2c_peripheral_status_aas, k_ra8_i3c_i2c_peripheral_status_nack, k_ra8_i3c_i2c_peripheral_status_rx_full, k_ra8_i3c_i2c_peripheral_status_stop, k_ra8_i3c_i2c_peripheral_status_tx_empty, k_ra8_ok, r_i3c_i2c_regs_t::MSDVAD, r_i3c_i2c_regs_t::NTST, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by ra8_i3c_peripheral_status().