Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
backend.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
12#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_BACKEND_H_
13#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_BACKEND_H_
14
15#include <zephyr/sys/__assert.h>
16#include <zephyr/device.h>
17#include <zephyr/drivers/gpio.h>
18#include <zephyr/kernel.h>
19#include <zephyr/types.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29 void *ctx;
30};
31
50 size_t len;
51};
52
63 void *buf;
65 size_t len;
67 size_t len_max;
68};
69
87typedef int (*ec_host_cmd_backend_api_init)(const struct ec_host_cmd_backend *backend,
88 struct ec_host_cmd_rx_ctx *rx_ctx,
89 struct ec_host_cmd_tx_buf *tx);
90
101typedef int (*ec_host_cmd_backend_api_send)(const struct ec_host_cmd_backend *backend);
102
103__subsystem struct ec_host_cmd_backend_api {
106};
107
119
126
133
145
157
162#ifdef __cplusplus
163}
164#endif
165
166#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_BACKEND_H_ */
Public APIs for GPIO drivers.
int(* ec_host_cmd_backend_api_send)(const struct ec_host_cmd_backend *backend)
Sends data to the host.
Definition: backend.h:101
struct ec_host_cmd_backend * ec_host_cmd_backend_get_spi(struct gpio_dt_spec *cs)
Get the SPI Host Command backend pointer.
struct ec_host_cmd_backend * ec_host_cmd_backend_get_espi(const struct device *dev)
Get the eSPI Host Command backend pointer.
struct ec_host_cmd_backend * ec_host_cmd_backend_get_uart(const struct device *dev)
Get the UART Host Command backend pointer.
int(* ec_host_cmd_backend_api_init)(const struct ec_host_cmd_backend *backend, struct ec_host_cmd_rx_ctx *rx_ctx, struct ec_host_cmd_tx_buf *tx)
Initialize a host command backend.
Definition: backend.h:87
struct ec_host_cmd_backend * ec_host_cmd_backend_get_shi_ite(void)
Get the SHI ITE Host Command backend pointer.
struct ec_host_cmd_backend * ec_host_cmd_backend_get_shi_npcx(void)
Get the SHI NPCX Host Command backend pointer.
Public kernel APIs.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition: device.h:381
Definition: backend.h:103
ec_host_cmd_backend_api_init init
Definition: backend.h:104
ec_host_cmd_backend_api_send send
Definition: backend.h:105
Definition: backend.h:25
void * ctx
Context for the backed.
Definition: backend.h:29
const struct ec_host_cmd_backend_api * api
API provided by the backed.
Definition: backend.h:27
Context for host command backend and handler to pass rx data.
Definition: backend.h:42
size_t len
Number of bytes written to buf by backend.
Definition: backend.h:50
uint8_t * buf
Buffer to hold received data.
Definition: backend.h:48
Context for host command backend and handler to pass tx data.
Definition: backend.h:56
size_t len_max
Size of buf.
Definition: backend.h:67
void * buf
Data to write to the host The buffer is provided by the handler if CONFIG_EC_HOST_CMD_HANDLER_TX_BUFF...
Definition: backend.h:63
size_t len
Number of bytes to write from buf.
Definition: backend.h:65
Container for GPIO pin information specified in devicetree.
Definition: gpio.h:286