Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
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
13
#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_BACKEND_H_
14
#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_BACKEND_H_
15
22
23
#include <
zephyr/sys/__assert.h
>
24
#include <
zephyr/device.h
>
25
#include <
zephyr/drivers/gpio.h
>
26
#include <
zephyr/kernel.h
>
27
#include <
zephyr/types.h
>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
36
struct
ec_host_cmd_backend
{
38
const
struct
ec_host_cmd_backend_api
*
api
;
40
void
*
ctx
;
41
};
42
46
struct
ec_host_cmd_rx_ctx
{
53
uint8_t
*
buf
;
55
size_t
len
;
57
size_t
len_max
;
58
};
59
63
struct
ec_host_cmd_tx_buf
{
70
void
*
buf
;
72
size_t
len
;
74
size_t
len_max
;
75
};
76
94
typedef
int (*
ec_host_cmd_backend_api_init
)(
const
struct
ec_host_cmd_backend
*backend,
95
struct
ec_host_cmd_rx_ctx
*rx_ctx,
96
struct
ec_host_cmd_tx_buf
*tx);
97
108
typedef
int (*
ec_host_cmd_backend_api_send
)(
const
struct
ec_host_cmd_backend
*backend);
109
110
struct
ec_host_cmd_backend_api
{
111
ec_host_cmd_backend_api_init
init
;
112
ec_host_cmd_backend_api_send
send
;
113
};
114
125
struct
ec_host_cmd_backend
*
ec_host_cmd_backend_get_espi
(
const
struct
device
*dev);
126
132
struct
ec_host_cmd_backend
*
ec_host_cmd_backend_get_shi_npcx
(
void
);
133
139
struct
ec_host_cmd_backend
*
ec_host_cmd_backend_get_shi_ite
(
void
);
140
151
struct
ec_host_cmd_backend
*
ec_host_cmd_backend_get_uart
(
const
struct
device
*dev);
152
163
struct
ec_host_cmd_backend
*
ec_host_cmd_backend_get_spi
(
struct
gpio_dt_spec
*cs);
164
171
void
ec_host_cmd_backend_usb_trigger_event
(
void
);
172
176
177
#ifdef __cplusplus
178
}
179
#endif
180
181
#endif
/* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_BACKEND_H_ */
__assert.h
device.h
gpio.h
Main header file for GPIO driver API.
ec_host_cmd_backend_api_send
int(* ec_host_cmd_backend_api_send)(const struct ec_host_cmd_backend *backend)
Sends data to the host.
Definition
backend.h:108
ec_host_cmd_backend_get_spi
struct ec_host_cmd_backend * ec_host_cmd_backend_get_spi(struct gpio_dt_spec *cs)
Get the SPI Host Command backend pointer.
ec_host_cmd_backend_get_espi
struct ec_host_cmd_backend * ec_host_cmd_backend_get_espi(const struct device *dev)
Get the eSPI Host Command backend pointer.
ec_host_cmd_backend_get_uart
struct ec_host_cmd_backend * ec_host_cmd_backend_get_uart(const struct device *dev)
Get the UART Host Command backend pointer.
ec_host_cmd_backend_api_init
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:94
ec_host_cmd_backend_get_shi_ite
struct ec_host_cmd_backend * ec_host_cmd_backend_get_shi_ite(void)
Get the SHI ITE Host Command backend pointer.
ec_host_cmd_backend_get_shi_npcx
struct ec_host_cmd_backend * ec_host_cmd_backend_get_shi_npcx(void)
Get the SHI NPCX Host Command backend pointer.
ec_host_cmd_backend_usb_trigger_event
void ec_host_cmd_backend_usb_trigger_event(void)
Signal event over USB.
types.h
kernel.h
Public kernel APIs.
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:513
ec_host_cmd_backend_api
Definition
backend.h:110
ec_host_cmd_backend_api::init
ec_host_cmd_backend_api_init init
Definition
backend.h:111
ec_host_cmd_backend_api::send
ec_host_cmd_backend_api_send send
Definition
backend.h:112
ec_host_cmd_backend
EC Host Command Backend.
Definition
backend.h:36
ec_host_cmd_backend::ctx
void * ctx
Context for the backend.
Definition
backend.h:40
ec_host_cmd_backend::api
const struct ec_host_cmd_backend_api * api
API provided by the backend.
Definition
backend.h:38
ec_host_cmd_rx_ctx
Context for host command backend and handler to pass rx data.
Definition
backend.h:46
ec_host_cmd_rx_ctx::len_max
size_t len_max
Maximum number of bytes to receive with one request packet.
Definition
backend.h:57
ec_host_cmd_rx_ctx::len
size_t len
Number of bytes written to buf by backend.
Definition
backend.h:55
ec_host_cmd_rx_ctx::buf
uint8_t * buf
Buffer to hold received data.
Definition
backend.h:53
ec_host_cmd_tx_buf
Context for host command backend and handler to pass tx data.
Definition
backend.h:63
ec_host_cmd_tx_buf::len_max
size_t len_max
Maximum number of bytes to send with one response packet.
Definition
backend.h:74
ec_host_cmd_tx_buf::buf
void * buf
Data to write to the host.
Definition
backend.h:70
ec_host_cmd_tx_buf::len
size_t len
Number of bytes to write from buf.
Definition
backend.h:72
gpio_dt_spec
Container for GPIO pin information specified in devicetree.
Definition
gpio.h:296
zephyr
mgmt
ec_host_cmd
backend.h
Generated on
for Zephyr API by
1.17.0