123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_
- #define ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_
- #include <sys/__assert.h>
- #include <zephyr/types.h>
- #include <device.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct ec_host_cmd_periph_rx_ctx {
-
- uint8_t *buf;
-
- size_t *len;
-
- struct k_sem *dev_owns;
-
- struct k_sem *handler_owns;
- };
- struct ec_host_cmd_periph_tx_buf {
-
- void *buf;
-
- size_t len;
- };
- typedef int (*ec_host_cmd_periph_api_init)(
- const struct device *dev, struct ec_host_cmd_periph_rx_ctx *rx_ctx);
- typedef int (*ec_host_cmd_periph_api_send)(
- const struct device *dev,
- const struct ec_host_cmd_periph_tx_buf *tx_buf);
- __subsystem struct ec_host_cmd_periph_api {
- ec_host_cmd_periph_api_init init;
- ec_host_cmd_periph_api_send send;
- };
- __syscall int ec_host_cmd_periph_init(const struct device *dev,
- struct ec_host_cmd_periph_rx_ctx *rx_ctx);
- static inline int
- z_impl_ec_host_cmd_periph_init(const struct device *dev,
- struct ec_host_cmd_periph_rx_ctx *rx_ctx)
- {
- const struct ec_host_cmd_periph_api *api =
- (const struct ec_host_cmd_periph_api *)dev->api;
- return api->init(dev, rx_ctx);
- }
- __syscall int ec_host_cmd_periph_send(
- const struct device *dev,
- const struct ec_host_cmd_periph_tx_buf *tx_buf);
- static inline int z_impl_ec_host_cmd_periph_send(
- const struct device *dev,
- const struct ec_host_cmd_periph_tx_buf *tx_buf)
- {
- const struct ec_host_cmd_periph_api *api =
- (const struct ec_host_cmd_periph_api *)dev->api;
- return api->send(dev, tx_buf);
- }
- #ifdef __cplusplus
- }
- #endif
- #include <syscalls/ec_host_cmd_periph.h>
- #endif
|