This is the documentation for the latest (master) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

EC Host Command

Overview

API Reference

group ec_host_cmd_periph_interface

EC Host Command Interface.

Defines

EC_HOST_CMD_HANDLER(_function, _id, _version_mask, _request_type, _response_type)

Statically define and register a host command handler.

Helper macro to statically define and register a host command handler that has a compile-time-fixed sizes for its both request and response structures.

Parameters
  • _function: Name of handler function.

  • _id: Id of host command to handle request for.

  • _version_mask: The bitfield of all versions that the _function supports. E.g. BIT(0) corresponse to version 0.

  • _request_type: The datatype of the request parameters for _function.

  • _response_type: The datatype of the response parameters for _function.

EC_HOST_CMD_HANDLER_UNBOUND(_function, _id, _version_mask)

Statically define and register a host command handler without sizes.

Helper macro to statically define and register a host command handler whose request or response structure size is not known as compile time.

Parameters
  • _function: Name of handler function.

  • _id: Id of host command to handle request for.

  • _version_mask: The bitfield of all versions that the _function supports. E.g. BIT(0) corresponse to version 0.

Typedefs

typedef enum ec_host_cmd_status (*ec_host_cmd_handler_cb)(struct ec_host_cmd_handler_args *args)

Enums

enum ec_host_cmd_status

Values:

enumerator EC_HOST_CMD_SUCCESS = 0

Host command was successful.

enumerator EC_HOST_CMD_INVALID_COMMAND = 1

The specified command id is not recognized or supported.

enumerator EC_HOST_CMD_ERROR = 2

Generic Error.

enumerator EC_HOST_CMD_INVALID_PARAM = 3

One of more of the input request parameters is invalid.

enumerator EC_HOST_CMD_ACCESS_DENIED = 4

Host command is not permitted.

enumerator EC_HOST_CMD_INVALID_RESPONSE = 5

Response was invalid (e.g. not version 3 of header).

enumerator EC_HOST_CMD_INVALID_VERSION = 6

Host command id version unsupported.

enumerator EC_HOST_CMD_INVALID_CHECKSUM = 7

Checksum did not match

enumerator EC_HOST_CMD_IN_PROGRESS = 8

A host command is currently being processed.

enumerator EC_HOST_CMD_UNAVAILABLE = 9

Requested information is currently unavailable.

enumerator EC_HOST_CMD_TIMEOUT = 10

Timeout during processing.

enumerator EC_HOST_CMD_OVERFLOW = 11

Data or table overflow.

enumerator EC_HOST_CMD_INVALID_HEADER = 12

Header is invalid or unsupported (e.g. not version 3 of header).

enumerator EC_HOST_CMD_REQUEST_TRUNCATED = 13

Did not receive all expected request data.

enumerator EC_HOST_CMD_RESPONSE_TOO_BIG = 14

Response was too big to send within one response packet.

enumerator EC_HOST_CMD_BUS_ERROR = 15

Error on underlying communication bus.

enumerator EC_HOST_CMD_BUSY = 16

System busy. Should retry later.

enumerator EC_HOST_CMD_MAX = UINT16_MAX
struct ec_host_cmd_handler_args
#include <ec_host_cmd.h>

Arguments passed into every installed host command handler.

struct ec_host_cmd_handler
#include <ec_host_cmd.h>

Structure use for statically registering host command handlers.

struct ec_host_cmd_request_header
#include <ec_host_cmd.h>

Header for requests from host to embedded controller.

Represent the over-the-wire header in LE format for host command requests. This represent version 3 of the host command header. The requests are always sent from host to embedded controller.

struct ec_host_cmd_response_header
#include <ec_host_cmd.h>

Header for responses from embedded controller to host.

Represent the over-the-wire header in LE format for host command responses. This represent version 3 of the host command header. Responses are always sent from embedded controller to host.