Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
subsys
▼
zephyr
►
acpi
►
app_memory
►
arch
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
▼
xen
►
dom0
►
public
►
console.h
►
events.h
►
generic.h
►
gnttab.h
►
hvm.h
►
memory.h
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
generic.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 EPAM Systems
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
#ifndef __XEN_GENERIC_H__
7
#define __XEN_GENERIC_H__
8
9
#include <
zephyr/xen/public/xen.h
>
10
11
#define XEN_PAGE_SIZE 4096
12
#define XEN_PAGE_SHIFT 12
13
14
#define XEN_PFN_UP(x) (unsigned long)(((x) + XEN_PAGE_SIZE-1) >> XEN_PAGE_SHIFT)
15
#define XEN_PFN_DOWN(x) (unsigned long)((x) >> XEN_PAGE_SHIFT)
16
#define XEN_PFN_PHYS(x) ((unsigned long)(x) << XEN_PAGE_SHIFT)
17
#define XEN_PHYS_PFN(x) (unsigned long)((x) >> XEN_PAGE_SHIFT)
18
19
#define xen_to_phys(x) ((unsigned long) (x))
20
#define xen_to_virt(x) ((void *) (x))
21
22
#define xen_virt_to_gfn(_virt) (XEN_PFN_DOWN(xen_to_phys(_virt)))
23
#define xen_gfn_to_virt(_gfn) (xen_to_virt(XEN_PFN_PHYS(_gfn)))
24
25
/*
26
* Atomically exchange value on "ptr" position. If value on "ptr" contains
27
* "old", then store and return "new". Otherwise, return the "old" value.
28
*/
29
#define synch_cmpxchg(ptr, old, new) \
30
({ __typeof__(*ptr) stored = old; \
31
__atomic_compare_exchange_n(ptr, &stored, new, 0, __ATOMIC_SEQ_CST, \
32
__ATOMIC_SEQ_CST) ? new : old; \
33
})
29
#define synch_cmpxchg(ptr, old, new) \
…
34
35
#endif
/* __XEN_GENERIC_H__ */
xen.h
zephyr
xen
generic.h
Generated on Fri May 16 2025 03:24:05 for Zephyr API Documentation by
1.12.0