Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
ec_host_cmd_periph.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_DRIVERS_HOST_CMD_PERIPH_H_
13#define ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_
14
15#include <sys/__assert.h>
16#include <zephyr/types.h>
17#include <device.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
41 size_t *len;
43 struct k_sem *dev_owns;
45 struct k_sem *handler_owns;
46};
47
53 void *buf;
55 size_t len;
56};
57
59 const struct device *dev, struct ec_host_cmd_periph_rx_ctx *rx_ctx);
60
62 const struct device *dev,
63 const struct ec_host_cmd_periph_tx_buf *tx_buf);
64
65__subsystem struct ec_host_cmd_periph_api {
68};
69
85__syscall int ec_host_cmd_periph_init(const struct device *dev,
86 struct ec_host_cmd_periph_rx_ctx *rx_ctx);
87
88static inline int
89z_impl_ec_host_cmd_periph_init(const struct device *dev,
90 struct ec_host_cmd_periph_rx_ctx *rx_ctx)
91{
92 const struct ec_host_cmd_periph_api *api =
93 (const struct ec_host_cmd_periph_api *)dev->api;
94
95 return api->init(dev, rx_ctx);
96}
97
110 const struct device *dev,
111 const struct ec_host_cmd_periph_tx_buf *tx_buf);
112
113static inline int z_impl_ec_host_cmd_periph_send(
114 const struct device *dev,
115 const struct ec_host_cmd_periph_tx_buf *tx_buf)
116{
117 const struct ec_host_cmd_periph_api *api =
118 (const struct ec_host_cmd_periph_api *)dev->api;
119
120 return api->send(dev, tx_buf);
121}
122
127#ifdef __cplusplus
128}
129#endif
130
131#include <syscalls/ec_host_cmd_periph.h>
132
133#endif /* ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_ */
int ec_host_cmd_periph_init(const struct device *dev, struct ec_host_cmd_periph_rx_ctx *rx_ctx)
Initialize a host command device.
int(* ec_host_cmd_periph_api_send)(const struct device *dev, const struct ec_host_cmd_periph_tx_buf *tx_buf)
Definition: ec_host_cmd_periph.h:61
int(* ec_host_cmd_periph_api_init)(const struct device *dev, struct ec_host_cmd_periph_rx_ctx *rx_ctx)
Definition: ec_host_cmd_periph.h:58
int ec_host_cmd_periph_send(const struct device *dev, const struct ec_host_cmd_periph_tx_buf *tx_buf)
Sends the specified data to the host.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
Definition: ec_host_cmd_periph.h:65
ec_host_cmd_periph_api_send send
Definition: ec_host_cmd_periph.h:67
ec_host_cmd_periph_api_init init
Definition: ec_host_cmd_periph.h:66
Context for host command peripheral and framework to pass rx data.
Definition: ec_host_cmd_periph.h:33
uint8_t * buf
Definition: ec_host_cmd_periph.h:39
size_t * len
Definition: ec_host_cmd_periph.h:41
struct k_sem * handler_owns
Definition: ec_host_cmd_periph.h:45
struct k_sem * dev_owns
Definition: ec_host_cmd_periph.h:43
Context for host command peripheral and framework to pass tx data.
Definition: ec_host_cmd_periph.h:51
void * buf
Definition: ec_host_cmd_periph.h:53
size_t len
Definition: ec_host_cmd_periph.h:55