Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
ivshmem.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_VIRTUALIZATION_IVSHMEM_H_
8#define ZEPHYR_INCLUDE_DRIVERS_VIRTUALIZATION_IVSHMEM_H_
9
16#include <zephyr/types.h>
17#include <stddef.h>
18#include <device.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24typedef size_t (*ivshmem_get_mem_f)(const struct device *dev,
25 uintptr_t *memmap);
26
27typedef uint32_t (*ivshmem_get_id_f)(const struct device *dev);
28
29typedef uint16_t (*ivshmem_get_vectors_f)(const struct device *dev);
30
31typedef int (*ivshmem_int_peer_f)(const struct device *dev,
32 uint32_t peer_id, uint16_t vector);
33
34typedef int (*ivshmem_register_handler_f)(const struct device *dev,
35 struct k_poll_signal *signal,
36 uint16_t vector);
37
38__subsystem struct ivshmem_driver_api {
44};
45
54__syscall size_t ivshmem_get_mem(const struct device *dev,
55 uintptr_t *memmap);
56
57static inline size_t z_impl_ivshmem_get_mem(const struct device *dev,
58 uintptr_t *memmap)
59{
60 const struct ivshmem_driver_api *api =
61 (const struct ivshmem_driver_api *)dev->api;
62
63 return api->get_mem(dev, memmap);
64}
65
73__syscall uint32_t ivshmem_get_id(const struct device *dev);
74
75static inline uint32_t z_impl_ivshmem_get_id(const struct device *dev)
76{
77 const struct ivshmem_driver_api *api =
78 (const struct ivshmem_driver_api *)dev->api;
79
80 return api->get_id(dev);
81}
82
90__syscall uint16_t ivshmem_get_vectors(const struct device *dev);
91
92static inline uint16_t z_impl_ivshmem_get_vectors(const struct device *dev)
93{
94 const struct ivshmem_driver_api *api =
95 (const struct ivshmem_driver_api *)dev->api;
96
97 return api->get_vectors(dev);
98}
99
109__syscall int ivshmem_int_peer(const struct device *dev,
110 uint32_t peer_id, uint16_t vector);
111
112static inline int z_impl_ivshmem_int_peer(const struct device *dev,
113 uint32_t peer_id, uint16_t vector)
114{
115 const struct ivshmem_driver_api *api =
116 (const struct ivshmem_driver_api *)dev->api;
117
118 return api->int_peer(dev, peer_id, vector);
119}
120
136__syscall int ivshmem_register_handler(const struct device *dev,
137 struct k_poll_signal *signal,
138 uint16_t vector);
139
140static inline int z_impl_ivshmem_register_handler(const struct device *dev,
141 struct k_poll_signal *signal,
142 uint16_t vector)
143{
144 const struct ivshmem_driver_api *api =
145 (const struct ivshmem_driver_api *)dev->api;
146
147 return api->register_handler(dev, signal, vector);
148}
149
150#ifdef __cplusplus
151}
152#endif
153
158#include <syscalls/ivshmem.h>
159
160#endif /* ZEPHYR_INCLUDE_DRIVERS_VIRTUALIZATION_IVSHMEM_H_ */
int(* ivshmem_int_peer_f)(const struct device *dev, uint32_t peer_id, uint16_t vector)
Definition: ivshmem.h:31
uint16_t(* ivshmem_get_vectors_f)(const struct device *dev)
Definition: ivshmem.h:29
int(* ivshmem_register_handler_f)(const struct device *dev, struct k_poll_signal *signal, uint16_t vector)
Definition: ivshmem.h:34
int ivshmem_register_handler(const struct device *dev, struct k_poll_signal *signal, uint16_t vector)
Register a vector notification (interrupt) handler.
uint32_t(* ivshmem_get_id_f)(const struct device *dev)
Definition: ivshmem.h:27
uint32_t ivshmem_get_id(const struct device *dev)
Get our VM ID.
int ivshmem_int_peer(const struct device *dev, uint32_t peer_id, uint16_t vector)
Interrupt another VM.
size_t ivshmem_get_mem(const struct device *dev, uintptr_t *memmap)
Get the inter-VM shared memory.
size_t(* ivshmem_get_mem_f)(const struct device *dev, uintptr_t *memmap)
Definition: ivshmem.h:24
uint16_t ivshmem_get_vectors(const struct device *dev)
Get the number of interrupt vectors we can use.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
Definition: ivshmem.h:38
ivshmem_register_handler_f register_handler
Definition: ivshmem.h:43
ivshmem_get_id_f get_id
Definition: ivshmem.h:40
ivshmem_int_peer_f int_peer
Definition: ivshmem.h:42
ivshmem_get_vectors_f get_vectors
Definition: ivshmem.h:41
ivshmem_get_mem_f get_mem
Definition: ivshmem.h:39
Definition: kernel.h:5405
static struct k_poll_signal signal
Definition: test_poll.c:696