Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
simulator.h File Reference

Header for commands to interact with the simulator outside of normal device interface. More...

Go to the source code of this file.

Functions

void ec_host_cmd_backend_sim_install_send_cb (ec_host_cmd_backend_api_send cb, struct ec_host_cmd_tx_buf **tx_buf)
 Install callback for when this device would sends data to host.
 
int ec_host_cmd_backend_sim_data_received (const uint8_t *buffer, size_t len)
 Simulate receiving data from host as passed in to this function.
 

Detailed Description

Header for commands to interact with the simulator outside of normal device interface.

Function Documentation

◆ ec_host_cmd_backend_sim_data_received()

int ec_host_cmd_backend_sim_data_received ( const uint8_t buffer,
size_t  len 
)

Simulate receiving data from host as passed in to this function.

Calling this function simulates that data was sent from the host to the DUT.

Parameters
bufferThe buffer that contains the data to receive.
lenThe number of bytes that are received from the above buffer.
Return values
0if successful
-ENOMEMif len is greater than the RX buffer size.
-EBUSYif the host command framework is busy with another request.

◆ ec_host_cmd_backend_sim_install_send_cb()

void ec_host_cmd_backend_sim_install_send_cb ( ec_host_cmd_backend_api_send  cb,
struct ec_host_cmd_tx_buf **  tx_buf 
)

Install callback for when this device would sends data to host.

When this host command simulator device should send data to the host, it will call the callback parameter provided by this function. Note that only one callback may be installed at a time. Calling this a second time will override the first callback installation.

Parameters
cbCallback that is called when device would send data to host.
tx_bufPointer of a pointer to the tx buf structure where data will be sent.