Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hdr_ddr.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 Meta Platforms
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_HDR_DDR_H_
8#define ZEPHYR_INCLUDE_DRIVERS_I3C_HDR_DDR_H_
9
17#include <errno.h>
18#include <stddef.h>
19#include <stdint.h>
20
21#include <zephyr/drivers/i3c.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
41static inline int i3c_hdr_ddr_write(struct i3c_device_desc *target, uint8_t cmd,
42 uint8_t *buf, uint32_t num_bytes)
43{
44 struct i3c_msg msg;
45
46 msg.buf = buf;
47 msg.len = num_bytes;
50 msg.hdr_cmd_code = cmd;
51
52 return i3c_transfer(target, &msg, 1);
53}
54
69static inline int i3c_hdr_ddr_read(struct i3c_device_desc *target, uint8_t cmd,
70 uint8_t *buf, uint32_t num_bytes)
71{
72 struct i3c_msg msg;
73
74 msg.buf = buf;
75 msg.len = num_bytes;
78 msg.hdr_cmd_code = cmd;
79
80 return i3c_transfer(target, &msg, 1);
81}
82
102static inline int i3c_hdr_ddr_write_read(struct i3c_device_desc *target,
103 const void *write_buf, size_t num_write, uint8_t read_cmd,
104 void *read_buf, size_t num_read, uint8_t write_cmd)
105{
106 struct i3c_msg msg[2];
107
108 msg[0].buf = (uint8_t *)write_buf;
109 msg[0].len = num_write;
111 msg[0].hdr_mode = I3C_MSG_HDR_DDR;
112 msg[0].hdr_cmd_code = write_cmd;
113
114 msg[1].buf = (uint8_t *)read_buf;
115 msg[1].len = num_read;
117 msg[1].hdr_mode = I3C_MSG_HDR_DDR;
118 msg[1].hdr_cmd_code = read_cmd;
119
120 return i3c_transfer(target, msg, 2);
121}
122
123#ifdef __cplusplus
124}
125#endif
126
131#endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_HDR_DDR_H_ */
System error numbers.
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
static int i3c_hdr_ddr_read(struct i3c_device_desc *target, uint8_t cmd, uint8_t *buf, uint32_t num_bytes)
Read a set amount of data from an I3C target device with HDR DDR.
Definition hdr_ddr.h:69
static int i3c_hdr_ddr_write(struct i3c_device_desc *target, uint8_t cmd, uint8_t *buf, uint32_t num_bytes)
Write a set amount of data to an I3C target device with HDR DDR.
Definition hdr_ddr.h:41
static int i3c_hdr_ddr_write_read(struct i3c_device_desc *target, const void *write_buf, size_t num_write, uint8_t read_cmd, void *read_buf, size_t num_read, uint8_t write_cmd)
Write then read data from an I3C target device with HDR DDR.
Definition hdr_ddr.h:102
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.
#define I3C_MSG_STOP
Send STOP after this message.
Definition i3c.h:397
#define I3C_MSG_READ
Read message from I3C bus.
Definition i3c.h:390
#define I3C_MSG_WRITE
Write message to I3C bus.
Definition i3c.h:387
#define I3C_MSG_HDR_DDR
I3C HDR-DDR (Double Data Rate)
Definition i3c.h:441
#define I3C_MSG_HDR
Transfer use HDR mode.
Definition i3c.h:411
#define I3C_MSG_RESTART
RESTART I3C transaction for this message.
Definition i3c.h:408
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Structure describing a I3C target device.
Definition i3c.h:929
One I3C Message.
Definition i3c.h:473
uint8_t flags
Flags for this message.
Definition i3c.h:490
uint8_t hdr_mode
HDR mode (I3C_MSG_HDR_MODE*) for transfer if any I3C_MSG_HDR_* is set in flags.
Definition i3c.h:498
uint8_t * buf
Data buffer in bytes.
Definition i3c.h:475
uint8_t hdr_cmd_code
HDR command code field (7-bit) for HDR-DDR, HDR-TSP and HDR-TSL.
Definition i3c.h:501
uint32_t len
Length of buffer in bytes.
Definition i3c.h:478