I3C Target Device API .
More...
I3C Target Device API .
◆ i3c_target_register()
#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
-
dev | Pointer to the device structure for an I3C controller driver configured in target mode. |
cfg | Config struct with functions and parameters used by the I3C target driver to send bus events |
- Return values
-
0 | Is successful |
-EINVAL | If parameters are invalid |
-EIO | General input / output error. |
-ENOSYS | If target mode is not implemented |
◆ i3c_target_tx_write()
#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
-
dev | Pointer to the device structure for an I3C controller driver configured in target mode. |
buf | Pointer to the buffer |
len | Length of the buffer |
hdr_mode | HDR mode see I3C_MSG_HDR_MODE* |
- Return values
-
Total | number of bytes written |
-ENOTSUP | Not in Target Mode or HDR Mode not supported |
-ENOSPC | No space in Tx FIFO |
-ENOSYS | If target mode is not implemented |
◆ i3c_target_unregister()
#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
-
dev | Pointer to the device structure for an I3C controller driver configured in target mode. |
cfg | Config struct with functions and parameters used by the I3C target driver to send bus events |
- Return values
-
0 | Is successful |
-EINVAL | If parameters are invalid |
-ENOSYS | If target mode is not implemented |