7#ifndef ZEPHYR_INCLUDE_DRIVERS_VIRTUALIZATION_IVSHMEM_H_
8#define ZEPHYR_INCLUDE_DRIVERS_VIRTUALIZATION_IVSHMEM_H_
26#define IVSHMEM_V2_PROTO_UNDEFINED 0x0000
27#define IVSHMEM_V2_PROTO_NET 0x0001
43#ifdef CONFIG_IVSHMEM_V2
45typedef size_t (*ivshmem_get_rw_mem_section_f)(
const struct device *dev,
48typedef size_t (*ivshmem_get_output_mem_section_f)(
const struct device *dev,
55typedef int (*ivshmem_set_state_f)(
const struct device *dev,
58typedef uint32_t (*ivshmem_get_max_peers_f)(
const struct device *dev);
60typedef uint16_t (*ivshmem_get_protocol_f)(
const struct device *dev);
62typedef int (*ivshmem_enable_interrupts_f)(
const struct device *dev,
73#ifdef CONFIG_IVSHMEM_V2
74 ivshmem_get_rw_mem_section_f get_rw_mem_section;
75 ivshmem_get_output_mem_section_f get_output_mem_section;
76 ivshmem_get_state_f get_state;
77 ivshmem_set_state_f set_state;
78 ivshmem_get_max_peers_f get_max_peers;
79 ivshmem_get_protocol_f get_protocol;
80 ivshmem_enable_interrupts_f enable_interrupts;
101static inline size_t z_impl_ivshmem_get_mem(
const struct device *dev,
107 return api->
get_mem(dev, memmap);
119static inline uint32_t z_impl_ivshmem_get_id(
const struct device *dev)
136static inline uint16_t z_impl_ivshmem_get_vectors(
const struct device *dev)
156static inline int z_impl_ivshmem_int_peer(
const struct device *dev,
162 return api->
int_peer(dev, peer_id, vector);
184static inline int z_impl_ivshmem_register_handler(
const struct device *dev,
194#ifdef CONFIG_IVSHMEM_V2
204__syscall
size_t ivshmem_get_rw_mem_section(
const struct device *dev,
207static inline size_t z_impl_ivshmem_get_rw_mem_section(
const struct device *dev,
213 return api->get_rw_mem_section(dev, memmap);
225__syscall
size_t ivshmem_get_output_mem_section(
const struct device *dev,
229static inline size_t z_impl_ivshmem_get_output_mem_section(
const struct device *dev,
236 return api->get_output_mem_section(dev, peer_id, memmap);
250static inline uint32_t z_impl_ivshmem_get_state(
const struct device *dev,
256 return api->get_state(dev, peer_id);
267__syscall
int ivshmem_set_state(
const struct device *dev,
270static inline int z_impl_ivshmem_set_state(
const struct device *dev,
276 return api->set_state(dev,
state);
286__syscall
uint32_t ivshmem_get_max_peers(
const struct device *dev);
288static inline uint32_t z_impl_ivshmem_get_max_peers(
const struct device *dev)
293 return api->get_max_peers(dev);
305static inline uint16_t z_impl_ivshmem_get_protocol(
const struct device *dev)
310 return api->get_protocol(dev);
321__syscall
int ivshmem_enable_interrupts(
const struct device *dev,
324static inline int z_impl_ivshmem_enable_interrupts(
const struct device *dev,
330 return api->enable_interrupts(dev, enable);
343#include <zephyr/syscalls/ivshmem.h>
int(* ivshmem_int_peer_f)(const struct device *dev, uint32_t peer_id, uint16_t vector)
Definition: ivshmem.h:36
uint16_t(* ivshmem_get_vectors_f)(const struct device *dev)
Definition: ivshmem.h:34
int(* ivshmem_register_handler_f)(const struct device *dev, struct k_poll_signal *signal, uint16_t vector)
Definition: ivshmem.h:39
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:32
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:29
uint16_t ivshmem_get_vectors(const struct device *dev)
Get the number of interrupt vectors we can use.
state
Definition: parser_state.h:29
Size of off_t must be equal or less than size of size_t
Definition: retained_mem.h:28
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409
ivshmem_register_handler_f register_handler
Definition: ivshmem.h:72
ivshmem_get_id_f get_id
Definition: ivshmem.h:69
ivshmem_int_peer_f int_peer
Definition: ivshmem.h:71
ivshmem_get_vectors_f get_vectors
Definition: ivshmem.h:70
ivshmem_get_mem_f get_mem
Definition: ivshmem.h:68
Definition: kernel.h:5691