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

Host command was successful.

enumerator EC_HOST_CMD_INVALID_COMMAND

The specified command id is not recognized or supported.

enumerator EC_HOST_CMD_ERROR

Generic Error.

enumerator EC_HOST_CMD_INVALID_PARAM

One of more of the input request parameters is invalid.

enumerator EC_HOST_CMD_ACCESS_DENIED

Host command is not permitted.

enumerator EC_HOST_CMD_INVALID_RESPONSE

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

enumerator EC_HOST_CMD_INVALID_VERSION

Host command id version unsupported.

enumerator EC_HOST_CMD_INVALID_CHECKSUM

Checksum did not match

enumerator EC_HOST_CMD_IN_PROGRESS

A host command is currently being processed.

enumerator EC_HOST_CMD_UNAVAILABLE

Requested information is currently unavailable.

enumerator EC_HOST_CMD_TIMEOUT

Timeout during processing.

enumerator EC_HOST_CMD_OVERFLOW

Data or table overflow.

enumerator EC_HOST_CMD_INVALID_HEADER

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

enumerator EC_HOST_CMD_REQUEST_TRUNCATED

Did not receive all expected request data.

enumerator EC_HOST_CMD_RESPONSE_TOO_BIG

Response was too big to send within one response packet.

enumerator EC_HOST_CMD_BUS_ERROR

Error on underlying communication bus.

enumerator EC_HOST_CMD_BUSY

System busy. Should retry later.

enumerator EC_HOST_CMD_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.