Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
EC Host Command Interface

EC Host Command Interface. More...

Data Structures

struct  ec_host_cmd_handler_args
 Arguments passed into every installed host command handler. More...
 
struct  ec_host_cmd_handler
 Structure use for statically registering host command handlers. More...
 
struct  ec_host_cmd_request_header
 Header for requests from host to embedded controller. More...
 
struct  ec_host_cmd_response_header
 Header for responses from embedded controller to host. More...
 

Macros

#define EC_HOST_CMD_HANDLER(_function, _id, _version_mask, _request_type, _response_type)
 Statically define and register a host command handler. More...
 
#define EC_HOST_CMD_HANDLER_UNBOUND(_function, _id, _version_mask)
 Statically define and register a host command handler without sizes. More...
 

Typedefs

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

Enumerations

enum  ec_host_cmd_status {
  EC_HOST_CMD_SUCCESS = 0 , EC_HOST_CMD_INVALID_COMMAND = 1 , EC_HOST_CMD_ERROR = 2 , EC_HOST_CMD_INVALID_PARAM = 3 ,
  EC_HOST_CMD_ACCESS_DENIED = 4 , EC_HOST_CMD_INVALID_RESPONSE = 5 , EC_HOST_CMD_INVALID_VERSION = 6 , EC_HOST_CMD_INVALID_CHECKSUM = 7 ,
  EC_HOST_CMD_IN_PROGRESS = 8 , EC_HOST_CMD_UNAVAILABLE = 9 , EC_HOST_CMD_TIMEOUT = 10 , EC_HOST_CMD_OVERFLOW = 11 ,
  EC_HOST_CMD_INVALID_HEADER = 12 , EC_HOST_CMD_REQUEST_TRUNCATED = 13 , EC_HOST_CMD_RESPONSE_TOO_BIG = 14 , EC_HOST_CMD_BUS_ERROR = 15 ,
  EC_HOST_CMD_BUSY = 16 , EC_HOST_CMD_MAX = UINT16_MAX
}
 

Detailed Description

EC Host Command Interface.

Macro Definition Documentation

◆ EC_HOST_CMD_HANDLER

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

#include <include/mgmt/ec_host_cmd.h>

Value:
.id = _id, \
.handler = _function, \
.version_mask = _version_mask, \
.min_rqt_size = sizeof(_request_type), \
.min_rsp_size = sizeof(_response_type), \
}
#define STRUCT_SECTION_ITERABLE(struct_type, name)
Defines a new iterable section.
Definition: common.h:199
Structure use for statically registering host command handlers.
Definition: ec_host_cmd.h:45

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
_functionName of handler function.
_idId of host command to handle request for.
_version_maskThe bitfield of all versions that the _function supports. E.g. BIT(0) corresponse to version 0.
_request_typeThe datatype of the request parameters for _function.
_response_typeThe datatype of the response parameters for _function.

◆ EC_HOST_CMD_HANDLER_UNBOUND

#define EC_HOST_CMD_HANDLER_UNBOUND (   _function,
  _id,
  _version_mask 
)

#include <include/mgmt/ec_host_cmd.h>

Value:
.id = _id, \
.handler = _function, \
.version_mask = _version_mask, \
.min_rqt_size = 0, \
.min_rsp_size = 0, \
}

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
_functionName of handler function.
_idId of host command to handle request for.
_version_maskThe bitfield of all versions that the _function supports. E.g. BIT(0) corresponse to version 0.

Typedef Documentation

◆ ec_host_cmd_handler_cb

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

Enumeration Type Documentation

◆ ec_host_cmd_status

#include <include/mgmt/ec_host_cmd.h>

Enumerator
EC_HOST_CMD_SUCCESS 

Host command was successful.

EC_HOST_CMD_INVALID_COMMAND 

The specified command id is not recognized or supported.

EC_HOST_CMD_ERROR 

Generic Error.

EC_HOST_CMD_INVALID_PARAM 

One of more of the input request parameters is invalid.

EC_HOST_CMD_ACCESS_DENIED 

Host command is not permitted.

EC_HOST_CMD_INVALID_RESPONSE 

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

EC_HOST_CMD_INVALID_VERSION 

Host command id version unsupported.

EC_HOST_CMD_INVALID_CHECKSUM 

Checksum did not match

EC_HOST_CMD_IN_PROGRESS 

A host command is currently being processed.

EC_HOST_CMD_UNAVAILABLE 

Requested information is currently unavailable.

EC_HOST_CMD_TIMEOUT 

Timeout during processing.

EC_HOST_CMD_OVERFLOW 

Data or table overflow.

EC_HOST_CMD_INVALID_HEADER 

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

EC_HOST_CMD_REQUEST_TRUNCATED 

Did not receive all expected request data.

EC_HOST_CMD_RESPONSE_TOO_BIG 

Response was too big to send within one response packet.

EC_HOST_CMD_BUS_ERROR 

Error on underlying communication bus.

EC_HOST_CMD_BUSY 

System busy. Should retry later.

EC_HOST_CMD_MAX