Zephyr API 3.6.99
Loading...
Searching...
No Matches
I3C Target Device API

I3C Target Device API . More...

Data Structures

struct  i3c_config_target
 Configuration parameters for I3C hardware to act as target device. More...
 
struct  i3c_target_config
 Structure describing a device that supports the I3C target API. More...
 
struct  i3c_target_callbacks
 
struct  i3c_target_driver_api
 

Functions

static int i3c_target_tx_write (const struct device *dev, uint8_t *buf, uint16_t len, uint8_t hdr_mode)
 Writes to the target's TX FIFO.
 
static int i3c_target_register (const struct device *dev, struct i3c_target_config *cfg)
 Registers the provided config as target device of a controller.
 
static int i3c_target_unregister (const struct device *dev, struct i3c_target_config *cfg)
 Unregisters the provided config as target device.
 

Detailed Description

I3C Target Device API .

Function Documentation

◆ i3c_target_register()

static int i3c_target_register ( const struct device * dev,
struct i3c_target_config * cfg )
inlinestatic

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

Registers the provided config as target device of a controller.

Enable I3C target mode for the dev I3C bus driver using the provided config struct (cfg) containing the functions and parameters to send bus events. The I3C target will be registered at the address provided as i3c_target_config::address struct member. Any I3C bus events related to the target mode will be passed onto I3C target device driver via a set of callback functions provided in the 'callbacks' struct member.

Most of the existing hardware allows simultaneous support for master and target mode. This is however not guaranteed.

Parameters
devPointer to the device structure for an I3C controller driver configured in target mode.
cfgConfig struct with functions and parameters used by the I3C target driver to send bus events
Return values
0Is successful
-EINVALIf parameters are invalid
-EIOGeneral input / output error.
-ENOSYSIf target mode is not implemented

◆ i3c_target_tx_write()

static int i3c_target_tx_write ( const struct device * dev,
uint8_t * buf,
uint16_t len,
uint8_t hdr_mode )
inlinestatic

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

Writes to the target's TX FIFO.

Write to the TX FIFO dev I3C bus driver using the provided buffer and length. Some I3C targets will NACK read requests until data is written to the TX FIFO. This function will write as much as it can to the FIFO return the total number of bytes written. It is then up to the application to utalize the target callbacks to write the remaining data. Negative returns indicate error.

Most of the existing hardware allows simultaneous support for master and target mode. This is however not guaranteed.

Parameters
devPointer to the device structure for an I3C controller driver configured in target mode.
bufPointer to the buffer
lenLength of the buffer
hdr_modeHDR mode see I3C_MSG_HDR_MODE*
Return values
Totalnumber of bytes written
-ENOTSUPNot in Target Mode or HDR Mode not supported
-ENOSPCNo space in Tx FIFO
-ENOSYSIf target mode is not implemented

◆ i3c_target_unregister()

static int i3c_target_unregister ( const struct device * dev,
struct i3c_target_config * cfg )
inlinestatic

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

Unregisters the provided config as target device.

This routine disables I3C target mode for the dev I3C bus driver using the provided config struct (cfg) containing the functions and parameters to send bus events.

Parameters
devPointer to the device structure for an I3C controller driver configured in target mode.
cfgConfig struct with functions and parameters used by the I3C target driver to send bus events
Return values
0Is successful
-EINVALIf parameters are invalid
-ENOSYSIf target mode is not implemented