ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_periph_i2c_internal.h File Reference

Module-private interfaces shared by the board_periph_i2c TUs. More...

#include <stdint.h>
#include "ra8_attributes.h"
Include dependency graph for board_periph_i2c_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  i2c_devices_const_t : uint32_t { k_i3c_dev_byte_mask = 0xFFU }
 Byte-lane constants shared across the bus + device TUs. More...

Functions

void priv_i2c_device_register (uint8_t addr_7b, void(*wr)(void *, uint8_t), uint32_t(*rd)(void *, uint8_t *, uint32_t), void(*stop)(void *), void *ctx)
 Register a device model in the first free bus slot (drop if full).
void priv_board_i2c_imu_fuel_reset (void)
 Re-lay the IMU + fuel-gauge register files (block reset path).
void priv_board_i2c_imu_fuel_register (void)
 Register the LSM6DSO + MAX17048 devices on the modelled bus.
uint32_t priv_board_i2c_imu_reads (void)
 IMU register reads answered this run (report telemetry).

Detailed Description

Module-private interfaces shared by the board_periph_i2c TUs.

The I3C-in-I2C-mode bus model and its attached device models are one logical module split across two translation units: the controller + GT911 touch model (board_periph_i2c.c) and the LSM6DSO IMU + MAX17048 fuel-gauge devices (board_periph_i2c_devices.c). The bus-side device registry and the device-side reset/register/telemetry entry points cross here.

Since
0.1.0

Definition in file board_periph_i2c_internal.h.

Enumeration Type Documentation

◆ i2c_devices_const_t

enum i2c_devices_const_t : uint32_t

Byte-lane constants shared across the bus + device TUs.

Enumerator
k_i3c_dev_byte_mask 

One-byte mask for register-file lanes.

Definition at line 28 of file board_periph_i2c_internal.h.

Function Documentation

◆ priv_board_i2c_imu_fuel_register()

void priv_board_i2c_imu_fuel_register ( void )

Register the LSM6DSO + MAX17048 devices on the modelled bus.

Returns
Nothing.
Precondition
The registry was just cleared by the block reset.
priv_board_i2c_imu_fuel_reset() ran (register files are laid).
Postcondition
Both devices answer their 7-bit addresses.
Note
Not thread-safe; single-threaded reset path only.
Since
0.1.0

Register the lsm6dso + max17048 devices on the modelled bus; this step is contained within the board periph I2C model and uses bounded caller or module-owned storage.

Postcondition
Ownership of caller-supplied storage is unchanged.

Register the LSM6DSO + MAX17048 devices on the modelled bus.

Definition at line 353 of file board_periph_i2c_devices.c.

References internal_fuelgauge_read(), internal_fuelgauge_stop(), internal_fuelgauge_write(), internal_lsm6dso_read(), internal_lsm6dso_stop(), internal_lsm6dso_write(), k_lsm6dso_addr_7b, k_max17048_addr_7b, priv_i2c_device_register(), s_fuelgauge, and s_lsm6dso.

Referenced by internal_i3c_reset().

◆ priv_board_i2c_imu_fuel_reset()

void priv_board_i2c_imu_fuel_reset ( void )

Re-lay the IMU + fuel-gauge register files (block reset path).

Returns
Nothing.
Precondition
The block reset is re-initialising the bus devices.
The CLI battery state (if any) was already applied.
Postcondition
WHO_AM_I / VCELL / SOC / VERSION / CRATE read their seeded values.
Note
Not thread-safe; single-threaded reset path only.
Since
0.1.0

Re-lay the imu + fuel-gauge register files (block reset path); this step is contained within the board periph I2C model and uses bounded caller or module-owned storage.

Postcondition
Ownership of caller-supplied storage is unchanged.

Re-lay the IMU + fuel-gauge register files (block reset path).

Definition at line 345 of file board_periph_i2c_devices.c.

References internal_fuelgauge_seed(), internal_lsm6dso_reset_regs(), s_fuelgauge, and s_lsm6dso.

Referenced by internal_i3c_reset().

◆ priv_board_i2c_imu_reads()

uint32_t priv_board_i2c_imu_reads ( void )

IMU register reads answered this run (report telemetry).

Returns
The LSM6DSO read counter.
Return values
0No IMU read was served.
Precondition
None.
None.
Postcondition
No state is modified.
Note
Not thread-safe; the emulator is single-threaded host-side.
Since
0.1.0

Imu register reads answered this run (report telemetry); this step is contained within the board periph I2C model and uses bounded caller or module-owned storage.

Postcondition
Ownership of caller-supplied storage is unchanged.

IMU register reads answered this run (report telemetry).

Definition at line 370 of file board_periph_i2c_devices.c.

References s_lsm6dso.

Referenced by internal_i3c_report().

◆ priv_i2c_device_register()

void priv_i2c_device_register ( uint8_t addr_7b,
void(* wr )(void *, uint8_t),
uint32_t(* rd )(void *, uint8_t *, uint32_t),
void(* stop )(void *),
void * ctx )

Register a device model in the first free bus slot (drop if full).

Parameters
[in]addr_7b7-bit I2C address the device answers.
[in]wrWrite-phase byte sink (register pointer / config).
[in]rdRead-phase burst source.
[in]stopSTOP-condition notification.
[in]ctxDevice state handed back to every callback.
Returns
Nothing.
Precondition
The registry has a free slot (drops silently when full).
The callbacks and ctx outlive the run.
Postcondition
The device answers address phases at addr_7b.
Note
Not thread-safe; call from reset/registration paths only.
Since
0.1.0

Definition at line 280 of file board_periph_i2c.c.

References k_i3c_dev_max, and s_i2c_dev.

Referenced by internal_i3c_reset(), and priv_board_i2c_imu_fuel_register().