Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ec_host_cmd.h File Reference

Go to the source code of this file.

Data Structures

struct  ec_host_cmd
 
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(_id, _function, _version_mask, _request_type, _response_type)
 Statically define and register a host command handler.
 
#define EC_HOST_CMD_HANDLER_UNBOUND(_id, _function, _version_mask)
 Statically define and register a host command handler without sizes.
 

Typedefs

typedef void(* ec_host_cmd_user_cb_t) (const struct ec_host_cmd_rx_ctx *rx_ctx, void *user_data)
 
typedef enum ec_host_cmd_status(* ec_host_cmd_in_progress_cb_t) (void *user_data)
 
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_INVALID_HEADER_VERSION = 17 , EC_HOST_CMD_INVALID_HEADER_CRC = 18 , EC_HOST_CMD_INVALID_DATA_CRC = 19 ,
  EC_HOST_CMD_DUP_UNAVAILABLE = 20 , EC_HOST_CMD_MAX = UINT16_MAX
}
 Host command response codes (16-bit). More...
 
enum  ec_host_cmd_log_level {
  EC_HOST_CMD_DEBUG_OFF , EC_HOST_CMD_DEBUG_NORMAL , EC_HOST_CMD_DEBUG_EVERY , EC_HOST_CMD_DEBUG_PARAMS ,
  EC_HOST_CMD_DEBUG_MODES
}
 
enum  ec_host_cmd_state { EC_HOST_CMD_STATE_DISABLED = 0 , EC_HOST_CMD_STATE_RECEIVING , EC_HOST_CMD_STATE_PROCESSING , EC_HOST_CMD_STATE_SENDING }
 

Functions

int ec_host_cmd_init (struct ec_host_cmd_backend *backend)
 Initialize the host command subsystem.
 
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.
 
void ec_host_cmd_rx_notify (void)
 Signal a new host command.
 
void ec_host_cmd_set_user_cb (ec_host_cmd_user_cb_t cb, void *user_data)
 Install a user callback for receiving a host command.
 
const struct ec_host_cmdec_host_cmd_get_hc (void)
 Get the main ec host command structure.
 
FUNC_NORETURN void ec_host_cmd_task (void)
 The thread function for Host Command subsystem.
 
int ec_host_cmd_add_suppressed (uint16_t cmd_id)
 Add a suppressed command.