7#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_H_
8#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_H_
27#ifdef CONFIG_EC_HOST_CMD_DEDICATED_THREAD
98#define EC_HOST_CMD_HANDLER(_id, _function, _version_mask, _request_type, _response_type) \
99 const STRUCT_SECTION_ITERABLE(ec_host_cmd_handler, __cmd##_id) = { \
101 .handler = _function, \
102 .version_mask = _version_mask, \
103 .min_rqt_size = sizeof(_request_type), \
104 .min_rsp_size = sizeof(_response_type), \
118#define EC_HOST_CMD_HANDLER_UNBOUND(_id, _function, _version_mask) \
119 const STRUCT_SECTION_ITERABLE(ec_host_cmd_handler, __cmd##_id) = { \
121 .handler = _function, \
122 .version_mask = _version_mask, \
274#ifndef CONFIG_EC_HOST_CMD_DEDICATED_THREAD
static struct k_thread thread[2]
Definition: atomic.c:26
Public APIs for Host Command backends that respond to host commands.
enum ec_host_cmd_status(* ec_host_cmd_handler_cb)(struct ec_host_cmd_handler_args *args)
Definition: ec_host_cmd.h:57
int ec_host_cmd_send_response(enum ec_host_cmd_status status, const struct ec_host_cmd_handler_args *args)
Send the host command response.
ec_host_cmd_status
Definition: ec_host_cmd.h:184
FUNC_NORETURN void ec_host_cmd_task(void)
The thread function for Host Command subsystem.
int ec_host_cmd_init(struct ec_host_cmd_backend *backend)
Initialize the host command subsystem.
const struct ec_host_cmd * ec_host_cmd_get_hc(void)
Get the main ec host command structure.
@ EC_HOST_CMD_BUSY
Definition: ec_host_cmd.h:218
@ EC_HOST_CMD_REQUEST_TRUNCATED
Definition: ec_host_cmd.h:212
@ EC_HOST_CMD_INVALID_DATA_CRC
Definition: ec_host_cmd.h:224
@ EC_HOST_CMD_DUP_UNAVAILABLE
Definition: ec_host_cmd.h:226
@ EC_HOST_CMD_ERROR
Definition: ec_host_cmd.h:190
@ EC_HOST_CMD_INVALID_HEADER
Definition: ec_host_cmd.h:210
@ EC_HOST_CMD_INVALID_HEADER_VERSION
Definition: ec_host_cmd.h:220
@ EC_HOST_CMD_IN_PROGRESS
Definition: ec_host_cmd.h:202
@ EC_HOST_CMD_SUCCESS
Definition: ec_host_cmd.h:186
@ EC_HOST_CMD_INVALID_VERSION
Definition: ec_host_cmd.h:198
@ EC_HOST_CMD_INVALID_CHECKSUM
Definition: ec_host_cmd.h:200
@ EC_HOST_CMD_UNAVAILABLE
Definition: ec_host_cmd.h:204
@ EC_HOST_CMD_INVALID_HEADER_CRC
Definition: ec_host_cmd.h:222
@ EC_HOST_CMD_MAX
Definition: ec_host_cmd.h:228
@ EC_HOST_CMD_INVALID_COMMAND
Definition: ec_host_cmd.h:188
@ EC_HOST_CMD_ACCESS_DENIED
Definition: ec_host_cmd.h:194
@ EC_HOST_CMD_TIMEOUT
Definition: ec_host_cmd.h:206
@ EC_HOST_CMD_BUS_ERROR
Definition: ec_host_cmd.h:216
@ EC_HOST_CMD_INVALID_PARAM
Definition: ec_host_cmd.h:192
@ EC_HOST_CMD_OVERFLOW
Definition: ec_host_cmd.h:208
@ EC_HOST_CMD_RESPONSE_TOO_BIG
Definition: ec_host_cmd.h:214
@ EC_HOST_CMD_INVALID_RESPONSE
Definition: ec_host_cmd.h:196
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
#define UINT16_MAX
Definition: stdint.h:28
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Arguments passed into every installed host command handler.
Definition: ec_host_cmd.h:35
uint16_t command
Definition: ec_host_cmd.h:39
uint16_t output_buf_size
Definition: ec_host_cmd.h:54
void * output_buf
Definition: ec_host_cmd.h:50
const void * input_buf
Definition: ec_host_cmd.h:46
uint16_t input_buf_size
Definition: ec_host_cmd.h:48
void * reserved
Definition: ec_host_cmd.h:37
uint16_t output_buf_max
Definition: ec_host_cmd.h:52
uint8_t version
Definition: ec_host_cmd.h:44
Structure use for statically registering host command handlers.
Definition: ec_host_cmd.h:61
uint16_t version_mask
Definition: ec_host_cmd.h:71
uint16_t min_rsp_size
Definition: ec_host_cmd.h:81
ec_host_cmd_handler_cb handler
Definition: ec_host_cmd.h:63
uint16_t id
Definition: ec_host_cmd.h:65
uint16_t min_rqt_size
Definition: ec_host_cmd.h:76
Context for host command backend and handler to pass rx data.
Definition: backend.h:41
Context for host command backend and handler to pass tx data.
Definition: backend.h:60
Definition: ec_host_cmd.h:23
struct ec_host_cmd_rx_ctx rx_ctx
Definition: ec_host_cmd.h:24
struct ec_host_cmd_backend * backend
Definition: ec_host_cmd.h:26
struct ec_host_cmd_tx_buf tx
Definition: ec_host_cmd.h:25