Line data Source code
1 1 : /* 2 : * Copyright (c) 2020 Google LLC 3 : * 4 : * SPDX-License-Identifier: Apache-2.0 5 : */ 6 : 7 : #ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_SIMULATOR_H_ 8 : #define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_SIMULATOR_H_ 9 : 10 : /** 11 : * @file 12 : * @brief Header for commands to interact with the simulator outside of normal 13 : * device interface. 14 : */ 15 : 16 : /* For ec_host_cmd_backend_api_send function pointer type */ 17 : #include <zephyr/mgmt/ec_host_cmd/backend.h> 18 : 19 : /** 20 : * @brief Install callback for when this device would sends data to host 21 : * 22 : * When this host command simulator device should send data to the host, it 23 : * will call the callback parameter provided by this function. Note that 24 : * only one callback may be installed at a time. Calling this a second time 25 : * will override the first callback installation. 26 : * 27 : * @param cb Callback that is called when device would send data to host. 28 : * @param tx_buf Pointer of a pointer to the tx buf structure where data will 29 : * be sent. 30 : */ 31 1 : void ec_host_cmd_backend_sim_install_send_cb(ec_host_cmd_backend_api_send cb, 32 : struct ec_host_cmd_tx_buf **tx_buf); 33 : 34 : /** 35 : * @brief Simulate receiving data from host as passed in to this function 36 : * 37 : * Calling this function simulates that data was sent from the host to the DUT. 38 : * 39 : * @param buffer The buffer that contains the data to receive. 40 : * @param len The number of bytes that are received from the above buffer. 41 : * 42 : * @retval 0 if successful 43 : * @retval -ENOMEM if len is greater than the RX buffer size. 44 : * @retval -EBUSY if the host command framework is busy with another request. 45 : */ 46 1 : int ec_host_cmd_backend_sim_data_received(const uint8_t *buffer, size_t len); 47 : 48 : #endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_SIMULATOR_H_ */