Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
I3C Transfer API . More...
Data Structures | |
struct | i3c_msg |
One I3C Message. More... | |
Macros | |
#define | I3C_MSG_WRITE (0U << 0U) |
Write message to I3C bus. | |
#define | I3C_MSG_READ BIT(0) |
Read message from I3C bus. | |
#define | I3C_MSG_STOP BIT(1) |
Send STOP after this message. | |
#define | I3C_MSG_RESTART BIT(2) |
RESTART I3C transaction for this message. | |
#define | I3C_MSG_HDR BIT(3) |
Transfer use HDR mode. | |
#define | I3C_MSG_NBCH BIT(4) |
Skip I3C broadcast header. | |
#define | I3C_MSG_HDR_MODE0 BIT(0) |
I3C HDR Mode 0. | |
#define | I3C_MSG_HDR_MODE1 BIT(1) |
I3C HDR Mode 1. | |
#define | I3C_MSG_HDR_MODE2 BIT(2) |
I3C HDR Mode 2. | |
#define | I3C_MSG_HDR_MODE3 BIT(3) |
I3C HDR Mode 3. | |
#define | I3C_MSG_HDR_MODE4 BIT(4) |
I3C HDR Mode 4. | |
#define | I3C_MSG_HDR_MODE5 BIT(5) |
I3C HDR Mode 5. | |
#define | I3C_MSG_HDR_MODE6 BIT(6) |
I3C HDR Mode 6. | |
#define | I3C_MSG_HDR_MODE7 BIT(7) |
I3C HDR Mode 7. | |
#define | I3C_MSG_HDR_DDR I3C_MSG_HDR_MODE0 |
I3C HDR-DDR (Double Data Rate) | |
#define | I3C_MSG_HDR_TSP I3C_MSG_HDR_MODE1 |
I3C HDR-TSP (Ternary Symbol Pure-bus) | |
#define | I3C_MSG_HDR_TSL I3C_MSG_HDR_MODE2 |
I3C HDR-TSL (Ternary Symbol Legacy-inclusive-bus) | |
#define | I3C_MSG_HDR_BT I3C_MSG_HDR_MODE3 |
I3C HDR-BT (Bulk Transport) | |
Functions | |
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 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. | |
I3C Transfer API .
#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) |
#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.
|
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. |
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>
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. |
|
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.
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. |