Skip to content

Commit bb03d1a

Browse files
alvsunkartben
authored andcommitted
include: i3c: target_device: add target driver buffer mode
As title. Signed-off-by: Alvis Sun <[email protected]>
1 parent e512151 commit bb03d1a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

drivers/i3c/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ config I3C_USE_GROUP_ADDR
3333

3434
Says Y if unsure.
3535

36+
config I3C_TARGET_BUFFER_MODE
37+
bool "I3C target driver for buffer mode"
38+
help
39+
This is an option to enable buffer mode.
40+
3641
menuconfig I3C_USE_IBI
3742
bool "Use In-Band Interrupt (IBI)"
3843
default y

include/zephyr/drivers/i3c/target_device.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,49 @@ struct i3c_target_callbacks {
202202
int (*read_processed_cb)(struct i3c_target_config *config,
203203
uint8_t *val);
204204

205+
#ifdef CONFIG_I3C_TARGET_BUFFER_MODE
206+
/** @brief Function called when a write to the device is completed.
207+
*
208+
* This function is invoked by the controller when it completes
209+
* reception of data from the source buffer to the destination
210+
* buffer in an ongoing write operation to the device.
211+
*
212+
* @param config Configuration structure associated with the
213+
* device to which the operation is addressed.
214+
*
215+
* @param ptr pointer to the buffer that contains the data to be transferred.
216+
*
217+
* @param len the length of the data to be transferred.
218+
*/
219+
void (*buf_write_received_cb)(struct i3c_target_config *config, uint8_t *ptr, uint32_t len);
220+
221+
/** @brief Function called when a read from the device is initiated.
222+
*
223+
* This function is invoked by the controller when the bus is ready to
224+
* provide additional data by buffer for a read operation from the address
225+
* associated with the device.
226+
*
227+
* The value returned in @p **ptr and @p *len will be transmitted. A success
228+
* return shall cause the controller to react to additional read operations.
229+
* An error return shall cause the controller to ignore bus operations until
230+
* a new start condition is received.
231+
*
232+
* @param config the configuration structure associated with the
233+
* device to which the operation is addressed.
234+
*
235+
* @param ptr pointer to storage for the address of data buffer to return
236+
* for the read request.
237+
*
238+
* @param len pointer to storage for the length of the data to be transferred
239+
* for the read request.
240+
*
241+
* @param hdr_mode HDR mode
242+
*
243+
* @return 0 if data has been provided, or a negative error code.
244+
*/
245+
int (*buf_read_requested_cb)(struct i3c_target_config *config, uint8_t **ptr, uint32_t *len,
246+
uint8_t *hdr_mode);
247+
#endif
205248
/**
206249
* @brief Function called when a stop condition is observed after a
207250
* start condition addressed to a particular device.

0 commit comments

Comments
 (0)