Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
I3C Address-related Helper Code

I3C Address-related Helper Code. More...

Data Structures

struct  i3c_addr_slots
 Structure to keep track of addresses on I3C bus. More...
 

Macros

#define I3C_BROADCAST_ADDR   0x7E
 Broadcast Address on I3C bus.
 
#define I3C_MAX_ADDR   0x7F
 Maximum value of device addresses.
 

Enumerations

enum  i3c_addr_slot_status {
  I3C_ADDR_SLOT_STATUS_FREE = 0U , I3C_ADDR_SLOT_STATUS_RSVD , I3C_ADDR_SLOT_STATUS_I3C_DEV , I3C_ADDR_SLOT_STATUS_I2C_DEV ,
  I3C_ADDR_SLOT_STATUS_MASK = 0x03U
}
 Enum to indicate whether an address is reserved, has I2C/I3C device attached, or no device attached. More...
 

Functions

int i3c_addr_slots_init (const struct device *dev)
 Initialize the I3C address slots struct.
 
void i3c_addr_slots_set (struct i3c_addr_slots *slots, uint8_t dev_addr, enum i3c_addr_slot_status status)
 Set the address status of a device.
 
enum i3c_addr_slot_status i3c_addr_slots_status (struct i3c_addr_slots *slots, uint8_t dev_addr)
 Get the address status of a device.
 
bool i3c_addr_slots_is_free (struct i3c_addr_slots *slots, uint8_t dev_addr)
 Check if the address is free.
 
uint8_t i3c_addr_slots_next_free_find (struct i3c_addr_slots *slots, uint8_t start_addr)
 Find the next free address.
 
static void i3c_addr_slots_mark_free (struct i3c_addr_slots *addr_slots, uint8_t addr)
 Mark the address as free (not used) in device list.
 
static void i3c_addr_slots_mark_rsvd (struct i3c_addr_slots *addr_slots, uint8_t addr)
 Mark the address as reserved in device list.
 
static void i3c_addr_slots_mark_i3c (struct i3c_addr_slots *addr_slots, uint8_t addr)
 Mark the address as I3C device in device list.
 
static void i3c_addr_slots_mark_i2c (struct i3c_addr_slots *addr_slots, uint8_t addr)
 Mark the address as I2C device in device list.
 

Detailed Description

I3C Address-related Helper Code.

Macro Definition Documentation

◆ I3C_BROADCAST_ADDR

#define I3C_BROADCAST_ADDR   0x7E

#include <zephyr/drivers/i3c/addresses.h>

Broadcast Address on I3C bus.

◆ I3C_MAX_ADDR

#define I3C_MAX_ADDR   0x7F

#include <zephyr/drivers/i3c/addresses.h>

Maximum value of device addresses.

Enumeration Type Documentation

◆ i3c_addr_slot_status

#include <zephyr/drivers/i3c/addresses.h>

Enum to indicate whether an address is reserved, has I2C/I3C device attached, or no device attached.

Enumerator
I3C_ADDR_SLOT_STATUS_FREE 

Address has not device attached.

I3C_ADDR_SLOT_STATUS_RSVD 

Address is reserved.

I3C_ADDR_SLOT_STATUS_I3C_DEV 

Address is associated with an I3C device.

I3C_ADDR_SLOT_STATUS_I2C_DEV 

Address is associated with an I2C device.

I3C_ADDR_SLOT_STATUS_MASK 

Bit masks used to filter status bits.

Function Documentation

◆ i3c_addr_slots_init()

int i3c_addr_slots_init ( const struct device dev)

#include <zephyr/drivers/i3c/addresses.h>

Initialize the I3C address slots struct.

This clears out the assigned address bits, and set the reserved address bits according to the I3C specification.

Parameters
devPointer to controller device driver instance.
Return values
0if successful.
-EINVALif duplicate addresses.

◆ i3c_addr_slots_is_free()

bool i3c_addr_slots_is_free ( struct i3c_addr_slots slots,
uint8_t  dev_addr 
)

#include <zephyr/drivers/i3c/addresses.h>

Check if the address is free.

Parameters
slotsPointer to the address slots structure.
dev_addrDevice address.
Return values
trueif address is free.
falseif address is not free.

◆ i3c_addr_slots_mark_free()

static void i3c_addr_slots_mark_free ( struct i3c_addr_slots addr_slots,
uint8_t  addr 
)
inlinestatic

#include <zephyr/drivers/i3c/addresses.h>

Mark the address as free (not used) in device list.

Parameters
addr_slotsPointer to the address slots struct.
addrDevice address.

◆ i3c_addr_slots_mark_i2c()

static void i3c_addr_slots_mark_i2c ( struct i3c_addr_slots addr_slots,
uint8_t  addr 
)
inlinestatic

#include <zephyr/drivers/i3c/addresses.h>

Mark the address as I2C device in device list.

Parameters
addr_slotsPointer to the address slots struct.
addrDevice address.

◆ i3c_addr_slots_mark_i3c()

static void i3c_addr_slots_mark_i3c ( struct i3c_addr_slots addr_slots,
uint8_t  addr 
)
inlinestatic

#include <zephyr/drivers/i3c/addresses.h>

Mark the address as I3C device in device list.

Parameters
addr_slotsPointer to the address slots struct.
addrDevice address.

◆ i3c_addr_slots_mark_rsvd()

static void i3c_addr_slots_mark_rsvd ( struct i3c_addr_slots addr_slots,
uint8_t  addr 
)
inlinestatic

#include <zephyr/drivers/i3c/addresses.h>

Mark the address as reserved in device list.

Parameters
addr_slotsPointer to the address slots struct.
addrDevice address.

◆ i3c_addr_slots_next_free_find()

uint8_t i3c_addr_slots_next_free_find ( struct i3c_addr_slots slots,
uint8_t  start_addr 
)

#include <zephyr/drivers/i3c/addresses.h>

Find the next free address.

This can be used to find the next free address that can be assigned to a new device.

Parameters
slotsPointer to the address slots structure.
start_addrWhere to start searching
Returns
The next free address, or 0 if none found.

◆ i3c_addr_slots_set()

void i3c_addr_slots_set ( struct i3c_addr_slots slots,
uint8_t  dev_addr,
enum i3c_addr_slot_status  status 
)

#include <zephyr/drivers/i3c/addresses.h>

Set the address status of a device.

Parameters
slotsPointer to the address slots structure.
dev_addrDevice address.
statusNew status for the address dev_addr.

◆ i3c_addr_slots_status()

enum i3c_addr_slot_status i3c_addr_slots_status ( struct i3c_addr_slots slots,
uint8_t  dev_addr 
)

#include <zephyr/drivers/i3c/addresses.h>

Get the address status of a device.

Parameters
slotsPointer to the address slots structure.
dev_addrDevice address.
Returns
Address status for the address dev_addr.