Zephyr API Documentation
3.4.0
A Scalable Open Source RTOS
|
|
3.4.0 |
I3C Interface. More...
Modules | |
I3C Address-related Helper Code | |
I3C Address-related Helper Code. | |
I3C Common Command Codes | |
I3C Common Command Codes. | |
I3C Devicetree related bits | |
I3C Devicetree related bits. | |
I3C In-Band Interrupts | |
I3C In-Band Interrupts. | |
Target Device API | |
I3C Target Device API. | |
Data Structures | |
struct | i3c_msg |
One I3C Message. More... | |
struct | i3c_config_controller |
Configuration parameters for I3C hardware to act as controller. More... | |
struct | i3c_config_custom |
Custom I3C configuration parameters. More... | |
struct | i3c_device_id |
Structure used for matching I3C devices. More... | |
struct | i3c_device_desc |
Structure describing a I3C target device. More... | |
struct | i3c_i2c_device_desc |
Structure describing a I2C device on I3C bus. More... | |
struct | i3c_dev_attached_list |
Structure for describing attached devices for a controller. More... | |
struct | i3c_dev_list |
Structure for describing known devices for a controller. More... | |
struct | i3c_driver_config |
struct | i3c_driver_data |
Functions | |
struct i3c_device_desc * | i3c_dev_list_find (const struct i3c_dev_list *dev_list, const struct i3c_device_id *id) |
Find a I3C target device descriptor by ID. | |
struct i3c_device_desc * | i3c_dev_list_i3c_addr_find (struct i3c_dev_attached_list *dev_list, uint8_t addr) |
Find a I3C target device descriptor by dynamic address. | |
struct i3c_i2c_device_desc * | i3c_dev_list_i2c_addr_find (struct i3c_dev_attached_list *dev_list, uint16_t addr) |
Find a I2C target device descriptor by address. | |
int | i3c_determine_default_addr (struct i3c_device_desc *target, uint8_t *addr) |
Helper function to find the default address an i3c device is attached with. | |
int | i3c_dev_list_daa_addr_helper (struct i3c_addr_slots *addr_slots, const struct i3c_dev_list *dev_list, uint64_t pid, bool must_match, bool assigned_okay, struct i3c_device_desc **target, uint8_t *addr) |
Helper function to find a usable address during ENTDAA. | |
static int | i3c_configure (const struct device *dev, enum i3c_config_type type, void *config) |
Configure the I3C hardware. | |
static int | i3c_config_get (const struct device *dev, enum i3c_config_type type, void *config) |
Get configuration of the I3C hardware. | |
static int | i3c_recover_bus (const struct device *dev) |
Attempt bus recovery on the I3C bus. | |
int | i3c_attach_i3c_device (struct i3c_device_desc *target) |
Attach an I3C device. | |
int | i3c_reattach_i3c_device (struct i3c_device_desc *target, uint8_t old_dyn_addr) |
Reattach I3C device. | |
int | i3c_detach_i3c_device (struct i3c_device_desc *target) |
Detach I3C Device. | |
int | i3c_attach_i2c_device (struct i3c_i2c_device_desc *target) |
Attach an I2C device. | |
int | i3c_detach_i2c_device (struct i3c_i2c_device_desc *target) |
Detach I2C Device. | |
static int | i3c_do_daa (const struct device *dev) |
Perform Dynamic Address Assignment on the I3C bus. | |
int | i3c_do_ccc (const struct device *dev, struct i3c_ccc_payload *payload) |
Send CCC to the bus. | |
int | i3c_transfer (struct i3c_device_desc *target, struct i3c_msg *msgs, uint8_t num_msgs) |
Perform data transfer from the controller to a I3C target device. | |
static struct i3c_device_desc * | i3c_device_find (const struct device *dev, const struct i3c_device_id *id) |
static int | i3c_ibi_raise (const struct device *dev, struct i3c_ibi *request) |
Raise an In-Band Interrupt (IBI). | |
static int | i3c_ibi_enable (struct i3c_device_desc *target) |
Enable IBI of a target device. | |
static int | i3c_ibi_disable (struct i3c_device_desc *target) |
Disable IBI of a target device. | |
static int | i3c_ibi_has_payload (struct i3c_device_desc *target) |
Check if target's IBI has payload. | |
static int | i3c_device_is_ibi_capable (struct i3c_device_desc *target) |
Check if device is IBI capable. | |
static int | i3c_write (struct i3c_device_desc *target, const uint8_t *buf, uint32_t num_bytes) |
Write a set amount of data to an I3C target device. | |
static int | i3c_read (struct i3c_device_desc *target, uint8_t *buf, uint32_t num_bytes) |
Read a set amount of data from an I3C target device. | |
static int | i3c_write_read (struct i3c_device_desc *target, const void *write_buf, size_t num_write, void *read_buf, size_t num_read) |
Write then read data from an I3C target device. | |
static int | i3c_burst_read (struct i3c_device_desc *target, uint8_t start_addr, uint8_t *buf, uint32_t num_bytes) |
Read multiple bytes from an internal address of an I3C target device. | |
static int | i3c_burst_write (struct i3c_device_desc *target, uint8_t start_addr, const uint8_t *buf, uint32_t num_bytes) |
Write multiple bytes to an internal address of an I3C target device. | |
static int | i3c_reg_read_byte (struct i3c_device_desc *target, uint8_t reg_addr, uint8_t *value) |
Read internal register of an I3C target device. | |
static int | i3c_reg_write_byte (struct i3c_device_desc *target, uint8_t reg_addr, uint8_t value) |
Write internal register of an I3C target device. | |
static int | i3c_reg_update_byte (struct i3c_device_desc *target, uint8_t reg_addr, uint8_t mask, uint8_t value) |
Update internal register of an I3C target device. | |
void | i3c_dump_msgs (const char *name, const struct i3c_msg *msgs, uint8_t num_msgs, struct i3c_device_desc *target) |
Dump out an I3C message. | |
int | i3c_bus_init (const struct device *dev, const struct i3c_dev_list *i3c_dev_list) |
Generic helper function to perform bus initialization. | |
int | i3c_device_basic_info_get (struct i3c_device_desc *target) |
Get basic information from device and update device descriptor. | |
I3C Interface.
#define I3C_BCR_ADV_CAPABILITIES BIT(5) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_DEVICE_ROLE | ( | bcr | ) | (((bcr) & I3C_BCR_DEVICE_ROLE_MASK) >> I3C_BCR_DEVICE_ROLE_SHIFT) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_DEVICE_ROLE_I3C_CONTROLLER_CAPABLE 1U |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_DEVICE_ROLE_I3C_TARGET 0U |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_DEVICE_ROLE_MASK (0x03U << I3C_BCR_DEVICE_ROLE_SHIFT) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_DEVICE_ROLE_SHIFT 6U |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_IBI_PAYLOAD_HAS_DATA_BYTE BIT(2) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_IBI_REQUEST_CAPABLE BIT(1) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_MAX_DATA_SPEED_LIMIT BIT(0) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_OFFLINE_CAPABLE BIT(3) |
#include <zephyr/drivers/i3c.h>
#define I3C_BCR_VIRTUAL_TARGET BIT(4) |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX | ( | dcr | ) | (((dcr) & I3C_DCR_I2C_DEV_IDX_MASK) >> I3C_DCR_I2C_DEV_IDX_SHIFT) |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX_0 0 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX_1 1 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX_2 2 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX_MASK (0x07U << I3C_DCR_I2C_DEV_IDX_SHIFT) |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_DEV_IDX_SHIFT 5 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_FM_MODE 1 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_FM_PLUS_MODE 0 |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_MODE | ( | dcr | ) | (((mode) & I3C_DCR_I2C_MODE_MASK) >> I3C_DCR_I2C_MODE_SHIFT) |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_MODE_MASK BIT(4) |
#include <zephyr/drivers/i3c.h>
#define I3C_DCR_I2C_MODE_SHIFT 4 |
#include <zephyr/drivers/i3c.h>
#define I3C_DEVICE_ID | ( | pid | ) |
#include <zephyr/drivers/i3c.h>
Structure initializer for i3c_device_id from PID.
This helper macro expands to a static initializer for a struct i3c_device_id
by populating the PID (Provisioned ID) field.
pid | Provisioned ID. |
#define I3C_MSG_HDR BIT(3) |
#include <zephyr/drivers/i3c.h>
Transfer use HDR mode
#define I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3 |
#include <zephyr/drivers/i3c.h>
I3C HDR-BT (Bulk Transport)
#define I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0 |
#include <zephyr/drivers/i3c.h>
I3C HDR-DDR (Double Data Rate)
#define I3C_MSG_HDR_MODE0 BIT(0) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 0
#define I3C_MSG_HDR_MODE1 BIT(1) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 1
#define I3C_MSG_HDR_MODE2 BIT(2) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 2
#define I3C_MSG_HDR_MODE3 BIT(3) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 3
#define I3C_MSG_HDR_MODE4 BIT(4) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 4
#define I3C_MSG_HDR_MODE5 BIT(5) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 5
#define I3C_MSG_HDR_MODE6 BIT(6) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 6
#define I3C_MSG_HDR_MODE7 BIT(7) |
#include <zephyr/drivers/i3c.h>
I3C HDR Mode 7
#define I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2 |
#include <zephyr/drivers/i3c.h>
I3C HDR-TSL (Ternary Symbol Legacy-inclusive-bus)
#define I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1 |
#include <zephyr/drivers/i3c.h>
I3C HDR-TSP (Ternary Symbol Pure-bus)
#define I3C_MSG_NBCH BIT(4) |
#include <zephyr/drivers/i3c.h>
Skip I3C broadcast header. Private Transfers only.
#define I3C_MSG_READ BIT(0) |
#include <zephyr/drivers/i3c.h>
Read message from I3C bus.
#define I3C_MSG_RESTART BIT(2) |
#include <zephyr/drivers/i3c.h>
RESTART I3C transaction for this message.
#define I3C_MSG_STOP BIT(1) |
#include <zephyr/drivers/i3c.h>
Send STOP after this message.
#define I3C_MSG_WRITE (0U << 0U) |
#include <zephyr/drivers/i3c.h>
Write message to I3C bus.
enum i3c_bus_mode |
#include <zephyr/drivers/i3c.h>
I3C bus mode.
enum i3c_config_type |
#include <zephyr/drivers/i3c.h>
Type of configuration being passed to configure function.
Enumerator | |
---|---|
I3C_CONFIG_CONTROLLER | |
I3C_CONFIG_TARGET | |
I3C_CONFIG_CUSTOM |
enum i3c_data_rate |
#include <zephyr/drivers/i3c.h>
I3C data rate.
I3C data transfer rate defined by the I3C specification.
enum i3c_i2c_speed_type |
#include <zephyr/drivers/i3c.h>
I2C bus speed under I3C bus.
Only FM and FM+ modes are supported for I2C devices under I3C bus.
Enumerator | |
---|---|
I3C_I2C_SPEED_FM | I2C FM mode |
I3C_I2C_SPEED_FMPLUS | I2C FM+ mode |
I3C_I2C_SPEED_MAX | |
I3C_I2C_SPEED_INVALID |
#include <zephyr/drivers/i3c.h>
I3C SDR Controller Error Codes.
These are error codes defined by the I3C specification.
I3C_ERROR_CE_UNKNOWN
and I3C_ERROR_CE_NONE
are not official error codes according to the specification. These are there simply to aid in error handling during interactions with the I3C drivers and subsystem.
#include <zephyr/drivers/i3c.h>
I3C SDR Target Error Codes.
These are error codes defined by the I3C specification.
I3C_ERROR_TE_UNKNOWN
and I3C_ERROR_TE_NONE
are not official error codes according to the specification. These are there simply to aid in error handling during interactions with the I3C drivers and subsystem.
int i3c_attach_i2c_device | ( | struct i3c_i2c_device_desc * | target | ) |
#include <zephyr/drivers/i3c.h>
Attach an I2C device.
Called to attach a I2C device to the addresses. This will also call the optional api to update any registers within the driver if implemented.
target | Pointer to the target device descriptor |
0 | If successful. |
-EINVAL | If address is not available or if the device has already been attached before |
int i3c_attach_i3c_device | ( | struct i3c_device_desc * | target | ) |
#include <zephyr/drivers/i3c.h>
Attach an I3C device.
Called to attach a I3C device to the addresses. This is typically called before a SETDASA or ENTDAA to reserve the addresses. This will also call the optional api to update any registers within the driver if implemented.
target | Pointer to the target device descriptor |
0 | If successful. |
-EINVAL | If address is not available or if the device has already been attached before |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Read multiple bytes from an internal address of an I3C target device.
This routine reads multiple bytes from an internal address of an I3C target device synchronously.
Instances of this may be replaced by i3c_write_read().
target | I3C target device descriptor, |
start_addr | Internal address from which the data is being read. |
buf | Memory pool that stores the retrieved data. |
num_bytes | Number of bytes being read. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Write multiple bytes to an internal address of an I3C target device.
This routine writes multiple bytes to an internal address of an I3C target device synchronously.
target | I3C target device descriptor. |
start_addr | Internal address to which the data is being written. |
buf | Memory pool from which the data is transferred. |
num_bytes | Number of bytes being written. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
int i3c_bus_init | ( | const struct device * | dev, |
const struct i3c_dev_list * | i3c_dev_list | ||
) |
#include <zephyr/drivers/i3c.h>
Generic helper function to perform bus initialization.
dev | Pointer to controller device driver instance. |
i3c_dev_list | Pointer to I3C device list. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
-ENODEV | If a provisioned ID does not match to any target devices in the registered device list. |
-ENOSPC | No more free addresses can be assigned to target. |
-ENOSYS | Dynamic address assignment is not supported by the controller driver. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Get configuration of the I3C hardware.
This provides a way to get the current configuration of the I3C hardware.
This can return cached config or probed hardware parameters, but it has to be up to date with current configuration.
[in] | dev | Pointer to controller device driver instance. |
[in] | type | Type of configuration parameters being passed in config . |
[in,out] | config | Pointer to the configuration parameters. |
Note that if type
is I3C_CONFIG_CUSTOM
, config
must contain the ID of the parameter to be retrieved.
0 | If successful. |
-EIO | General Input/Output errors. |
-ENOSYS | If not implemented. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Configure the I3C hardware.
dev | Pointer to controller device driver instance. |
type | Type of configuration parameters being passed in config . |
config | Pointer to the configuration parameters. |
0 | If successful. |
-EINVAL | If invalid configure parameters. |
-EIO | General Input/Output errors. |
-ENOSYS | If not implemented. |
int i3c_detach_i2c_device | ( | struct i3c_i2c_device_desc * | target | ) |
#include <zephyr/drivers/i3c.h>
Detach I2C Device.
called to remove an I2C device and to free up the address that it used. This will also call the optional api to update any registers within the driver if implemented.
target | Pointer to the target device descriptor |
0 | If successful. |
-EINVAL | If device is already detached |
int i3c_detach_i3c_device | ( | struct i3c_device_desc * | target | ) |
#include <zephyr/drivers/i3c.h>
Detach I3C Device.
called to remove an I3C device and to free up the address that it used. If it's dynamic address was not set, then it assumed that SETDASA failed and will free it's static addr. This will also call the optional api to update any registers within the driver if implemented.
target | Pointer to the target device descriptor |
0 | If successful. |
-EINVAL | If device is already detached |
int i3c_determine_default_addr | ( | struct i3c_device_desc * | target, |
uint8_t * | addr | ||
) |
#include <zephyr/drivers/i3c.h>
Helper function to find the default address an i3c device is attached with.
This is a helper function to find the default address the device will be loaded with. This could be either it's static address, a requested dynamic address, or just a dynamic address that is available
[in] | target | The pointer of the device descriptor |
[out] | addr | Address to be assigned to target device. |
0 | if successful. |
-EINVAL | if the expected default address is already in use |
int i3c_dev_list_daa_addr_helper | ( | struct i3c_addr_slots * | addr_slots, |
const struct i3c_dev_list * | dev_list, | ||
uint64_t | pid, | ||
bool | must_match, | ||
bool | assigned_okay, | ||
struct i3c_device_desc ** | target, | ||
uint8_t * | addr | ||
) |
#include <zephyr/drivers/i3c.h>
Helper function to find a usable address during ENTDAA.
This is a helper function to find a usable address during Dynamic Address Assignment. Given the PID (pid
), it will search through the device list for the matching device descriptor. If the device descriptor indicates that there is a preferred address (i.e. assigned-address in device tree,
If must_match
is true, the PID (pid
) must match one of the device in the device list.
If must_match
is false, this will return an arbitrary address. This is useful when not all devices are described in device tree. Or else, the DAA process cannot proceed since there is no address to be assigned.
If assigned_okay
is true, it will return the same address already assigned to the device (
assigned_okay
is false. This is useful for assigning the same address to the same device (for example, hot-join after device coming back from suspend).If assigned_okay
is false, the device cannot have an address assigned already (that
[in] | addr_slots | Pointer to address slots struct. |
[in] | dev_list | Pointer to the device list struct. |
[in] | pid | Provisioned ID of device to be assigned address. |
[in] | must_match | True if PID must match devices in the device list. False otherwise. |
[in] | assigned_okay | True if it is okay to return the address already assigned to the target matching the PID (pid ). |
[out] | target | Store the pointer of the device descriptor if it matches the incoming PID (pid ). |
[out] | addr | Address to be assigned to target device. |
0 | if successful. |
-ENODEV | if no device matches the PID (pid ) in the device list and must_match is true. |
-EINVAL | if the device matching PID (pid ) already has an address assigned or invalid function arguments. |
struct i3c_device_desc * i3c_dev_list_find | ( | const struct i3c_dev_list * | dev_list, |
const struct i3c_device_id * | id | ||
) |
#include <zephyr/drivers/i3c.h>
Find a I3C target device descriptor by ID.
This finds the I3C target device descriptor in the device list matching the provided ID struct (id
).
dev_list | Pointer to the device list struct. |
id | Pointer to I3C device ID struct. |
struct i3c_i2c_device_desc * i3c_dev_list_i2c_addr_find | ( | struct i3c_dev_attached_list * | dev_list, |
uint16_t | addr | ||
) |
#include <zephyr/drivers/i3c.h>
Find a I2C target device descriptor by address.
This finds the I2C target device descriptor in the attached device list matching the address (addr
)
dev_list | Pointer to the device list struct. |
addr | Address to be matched. |
struct i3c_device_desc * i3c_dev_list_i3c_addr_find | ( | struct i3c_dev_attached_list * | dev_list, |
uint8_t | addr | ||
) |
#include <zephyr/drivers/i3c.h>
Find a I3C target device descriptor by dynamic address.
This finds the I3C target device descriptor in the attached device list matching the dynamic address (addr
)
dev_list | Pointer to the device list struct. |
addr | Dynamic address to be matched. |
int i3c_device_basic_info_get | ( | struct i3c_device_desc * | target | ) |
#include <zephyr/drivers/i3c.h>
Get basic information from device and update device descriptor.
This retrieves some basic information:
This only updates the field(s) in device descriptor only if CCC operations succeed.
[in,out] | target | I3C target device descriptor. |
0 | if successful. |
-EIO | General Input/Output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Find a registered I3C target device.
Controller only API.
This returns the I3C device descriptor of the I3C device matching the incoming id
.
dev | Pointer to controller device driver instance. |
id | Pointer to I3C device ID. |
id
.
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Check if device is IBI capable.
This reads the BCR from the device descriptor struct to determine whether device is capable of IBI.
Note that BCR must have been obtained from device and
int i3c_do_ccc | ( | const struct device * | dev, |
struct i3c_ccc_payload * | payload | ||
) |
#include <zephyr/drivers/i3c.h>
Send CCC to the bus.
dev | Pointer to the device structure for the controller driver instance. |
payload | Pointer to the structure describing the CCC payload. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General Input / output error. |
-EINVAL | Invalid valid set in the payload structure. |
-ENOSYS | Not implemented. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Perform Dynamic Address Assignment on the I3C bus.
This routine asks the controller to perform dynamic address assignment where the controller belongs. Only the active controller of the bus should do this.
dev | Pointer to the device structure for the controller driver instance. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
-ENODEV | If a provisioned ID does not match to any target devices in the registered device list. |
-ENOSPC | No more free addresses can be assigned to target. |
-ENOSYS | Dynamic address assignment is not supported by the controller driver. |
void i3c_dump_msgs | ( | const char * | name, |
const struct i3c_msg * | msgs, | ||
uint8_t | num_msgs, | ||
struct i3c_device_desc * | target | ||
) |
#include <zephyr/drivers/i3c.h>
Dump out an I3C message.
Dumps out a list of I3C messages. For any that are writes (W), the data is displayed in hex.
It looks something like this (with name "testing"):
name | Name of this dump, displayed at the top. |
msgs | Array of messages to dump. |
num_msgs | Number of messages to dump. |
target | I3C target device descriptor. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Disable IBI of a target device.
This enables IBI of a target device where the IBI has already been request.
target | I3C target device descriptor. |
0 | If successful. |
-EIO | General Input / output error. |
-ENODEV | If IBI is not previously enabled for target . |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Enable IBI of a target device.
This enables IBI of a target device where the IBI has already been request.
target | I3C target device descriptor. |
0 | If successful. |
-EIO | General Input / output error. |
-ENOMEM | If these is no more empty entries in the controller's IBI table (if the controller uses such table). |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Check if target's IBI has payload.
This reads the BCR from the device descriptor struct to determine whether IBI from device has payload.
Note that BCR must have been obtained from device and
#include <zephyr/drivers/i3c.h>
Raise an In-Band Interrupt (IBI).
This raises an In-Band Interrupt (IBI) to the active controller.
dev | Pointer to controller device driver instance. |
request | Pointer to the IBI request struct. |
0 | if operation is successful. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Read a set amount of data from an I3C target device.
This routine reads a set amount of data synchronously.
target | I3C target device descriptor. |
buf | Memory pool that stores the retrieved data. |
num_bytes | Number of bytes to read. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
int i3c_reattach_i3c_device | ( | struct i3c_device_desc * | target, |
uint8_t | old_dyn_addr | ||
) |
#include <zephyr/drivers/i3c.h>
Reattach I3C device.
called after every time an I3C device has its address changed. It can be because the device has been powered down and has lost its address, or it can happen when a device had a static address and has been assigned a dynamic address with SETDASA or a dynamic address has been updated with SETNEWDA. This will also call the optional api to update any registers within the driver if implemented.
target | Pointer to the target device descriptor |
old_dyn_addr | The old dynamic address of target device, 0 if there was no old dynamic address |
0 | If successful. |
-EINVAL | If address is not available |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Attempt bus recovery on the I3C bus.
This routine asks the controller to attempt bus recovery.
0 | If successful. |
-EBUSY | If bus recovery fails. |
-EIO | General input / output error. |
-ENOSYS | Bus recovery is not supported by the controller driver. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Read internal register of an I3C target device.
This routine reads the value of an 8-bit internal register of an I3C target device synchronously.
target | I3C target device descriptor. |
reg_addr | Address of the internal register being read. |
value | Memory pool that stores the retrieved register value. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Update internal register of an I3C target device.
This routine updates the value of a set of bits from an 8-bit internal register of an I3C target device synchronously.
target | I3C target device descriptor. |
reg_addr | Address of the internal register being updated. |
mask | Bitmask for updating internal register. |
value | Value for updating internal register. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Write internal register of an I3C target device.
This routine writes a value to an 8-bit internal register of an I3C target device synchronously.
target | I3C target device descriptor. |
reg_addr | Address of the internal register being written. |
value | Value to be written to internal register. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
int i3c_transfer | ( | struct i3c_device_desc * | target, |
struct i3c_msg * | msgs, | ||
uint8_t | num_msgs | ||
) |
#include <zephyr/drivers/i3c.h>
Perform data transfer from the controller to a I3C target device.
This routine provides a generic interface to perform data transfer to a target device synchronously. Use i3c_read()/i3c_write() for simple read or write.
The array of message msgs must not be NULL. The number of message num_msgs may be zero, in which case no transfer occurs.
i3c_msg
buffers all configured for I3C_MSG_WRITE
) may be packed into a single transaction by some drivers, but others may emit each fragment as a distinct write transaction, which will not produce the same behavior. See the documentation of struct i3c_msg
for limitations on support for multi-message bus transactions.target | I3C target device descriptor. |
msgs | Array of messages to transfer. |
num_msgs | Number of messages to transfer. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Write a set amount of data to an I3C target device.
This routine writes a set amount of data synchronously.
target | I3C target device descriptor. |
buf | Memory pool from which the data is transferred. |
num_bytes | Number of bytes to write. |
0 | If successful. |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |
|
inlinestatic |
#include <zephyr/drivers/i3c.h>
Write then read data from an I3C target device.
This supports the common operation "this is what I want", "now give it to me" transaction pair through a combined write-then-read bus transaction.
target | I3C target device descriptor. |
write_buf | Pointer to the data to be written |
num_write | Number of bytes to write |
read_buf | Pointer to storage for read data |
num_read | Number of bytes to read |
0 | if successful |
-EBUSY | Bus is busy. |
-EIO | General input / output error. |