Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
ec_host_cmd.h
Go to the documentation of this file.
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_H_
8#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_H_
9
17#include <stdint.h>
18
24 const void *const input_buf;
28 void *const output_buf;
38};
39
41 struct ec_host_cmd_handler_args *args);
63};
64
80#define EC_HOST_CMD_HANDLER(_function, _id, _version_mask, _request_type, \
81 _response_type) \
82 const STRUCT_SECTION_ITERABLE(ec_host_cmd_handler, __cmd##_id) = { \
83 .id = _id, \
84 .handler = _function, \
85 .version_mask = _version_mask, \
86 .min_rqt_size = sizeof(_request_type), \
87 .min_rsp_size = sizeof(_response_type), \
88 }
89
102#define EC_HOST_CMD_HANDLER_UNBOUND(_function, _id, _version_mask) \
103 const STRUCT_SECTION_ITERABLE(ec_host_cmd_handler, __cmd##_id) = { \
104 .id = _id, \
105 .handler = _function, \
106 .version_mask = _version_mask, \
107 .min_rqt_size = 0, \
108 .min_rsp_size = 0, \
109 }
110
137} __packed;
138
159} __packed;
160
161/*
162 * Host command response codes (16-bit).
163 */
199
200 EC_HOST_CMD_MAX = UINT16_MAX /* Force enum to be 16 bits */
201} __packed;
202
207#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_H_ */
enum ec_host_cmd_status(* ec_host_cmd_handler_cb)(struct ec_host_cmd_handler_args *args)
Definition: ec_host_cmd.h:40
ec_host_cmd_status
Definition: ec_host_cmd.h:164
@ EC_HOST_CMD_BUSY
Definition: ec_host_cmd.h:198
@ EC_HOST_CMD_REQUEST_TRUNCATED
Definition: ec_host_cmd.h:192
@ EC_HOST_CMD_ERROR
Definition: ec_host_cmd.h:170
@ EC_HOST_CMD_INVALID_HEADER
Definition: ec_host_cmd.h:190
@ EC_HOST_CMD_IN_PROGRESS
Definition: ec_host_cmd.h:182
@ EC_HOST_CMD_SUCCESS
Definition: ec_host_cmd.h:166
@ EC_HOST_CMD_INVALID_VERSION
Definition: ec_host_cmd.h:178
@ EC_HOST_CMD_INVALID_CHECKSUM
Definition: ec_host_cmd.h:180
@ EC_HOST_CMD_UNAVAILABLE
Definition: ec_host_cmd.h:184
@ EC_HOST_CMD_MAX
Definition: ec_host_cmd.h:200
@ EC_HOST_CMD_INVALID_COMMAND
Definition: ec_host_cmd.h:168
@ EC_HOST_CMD_ACCESS_DENIED
Definition: ec_host_cmd.h:174
@ EC_HOST_CMD_TIMEOUT
Definition: ec_host_cmd.h:186
@ EC_HOST_CMD_BUS_ERROR
Definition: ec_host_cmd.h:196
@ EC_HOST_CMD_INVALID_PARAM
Definition: ec_host_cmd.h:172
@ EC_HOST_CMD_OVERFLOW
Definition: ec_host_cmd.h:188
@ EC_HOST_CMD_RESPONSE_TOO_BIG
Definition: ec_host_cmd.h:194
@ EC_HOST_CMD_INVALID_RESPONSE
Definition: ec_host_cmd.h:176
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
#define UINT16_MAX
Definition: stdint.h:28
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Arguments passed into every installed host command handler.
Definition: ec_host_cmd.h:22
uint16_t output_buf_size
Definition: ec_host_cmd.h:33
const uint8_t version
Definition: ec_host_cmd.h:37
const void *const input_buf
Definition: ec_host_cmd.h:24
void *const output_buf
Definition: ec_host_cmd.h:28
const uint16_t input_buf_size
Definition: ec_host_cmd.h:26
Structure use for statically registering host command handlers.
Definition: ec_host_cmd.h:45
uint16_t version_mask
Definition: ec_host_cmd.h:54
uint16_t min_rsp_size
Definition: ec_host_cmd.h:62
ec_host_cmd_handler_cb handler
Definition: ec_host_cmd.h:47
uint16_t id
Definition: ec_host_cmd.h:49
uint16_t min_rqt_size
Definition: ec_host_cmd.h:58
Header for requests from host to embedded controller.
Definition: ec_host_cmd.h:118
uint16_t cmd_id
Definition: ec_host_cmd.h:128
uint8_t cmd_ver
Definition: ec_host_cmd.h:132
uint8_t prtcl_ver
Definition: ec_host_cmd.h:122
uint8_t checksum
Definition: ec_host_cmd.h:126
uint8_t reserved
Definition: ec_host_cmd.h:134
uint16_t data_len
Definition: ec_host_cmd.h:136
Header for responses from embedded controller to host.
Definition: ec_host_cmd.h:146
uint8_t prtcl_ver
Definition: ec_host_cmd.h:148
uint16_t reserved
Definition: ec_host_cmd.h:158
uint16_t result
Definition: ec_host_cmd.h:154
uint8_t checksum
Definition: ec_host_cmd.h:152
uint16_t data_len
Definition: ec_host_cmd.h:156