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
►
basicmath.h
►
basicmath_f16.h
►
dsp.h
►
print_format.h
►
types.h
utils.h
►
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
►
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
utils.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2024 OWL Services LLC. All rights reserved.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
13
#ifndef INCLUDE_ZEPHYR_DSP_UTILS_H_
14
#define INCLUDE_ZEPHYR_DSP_UTILS_H_
15
16
#include <
stdint.h
>
17
#include <
zephyr/kernel.h
>
18
#include <
zephyr/dsp/dsp.h
>
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
46
#define Z_SHIFT_Q7_TO_F32(src, m) ((float32_t)(((src << m)) / (float32_t)(1U << 7)))
47
55
#define Z_SHIFT_Q15_TO_F32(src, m) ((float32_t)((src << m) / (float32_t)(1U << 15)))
56
64
#define Z_SHIFT_Q31_TO_F32(src, m) ((float32_t)(((int64_t)src) << m) / (float32_t)(1U << 31))
65
73
#define Z_SHIFT_Q7_TO_F64(src, m) (((float64_t)(src << m)) / (1U << 7))
74
82
#define Z_SHIFT_Q15_TO_F64(src, m) (((float64_t)(src << m)) / (1UL << 15))
83
91
#define Z_SHIFT_Q31_TO_F64(src, m) ((float64_t)(((int64_t)src) << m) / (1ULL << 31))
92
114
#define Z_SHIFT_F32_TO_Q7(src, m) \
115
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
116
124
#define Z_SHIFT_F32_TO_Q15(src, m) \
125
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
126
134
#define Z_SHIFT_F32_TO_Q31(src, m) \
135
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
136
144
#define Z_SHIFT_F64_TO_Q7(src, m) \
145
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
146
154
#define Z_SHIFT_F64_TO_Q15(src, m) \
155
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
156
164
#define Z_SHIFT_F64_TO_Q31(src, m) \
165
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
166
171
#ifdef __cplusplus
172
}
173
#endif
174
175
#endif
/* INCLUDE_ZEPHYR_DSP_UTILS_H_ */
dsp.h
Public APIs for Digital Signal Processing (DSP) math.
kernel.h
Public kernel APIs.
stdint.h
zephyr
dsp
utils.h
Generated on Fri May 16 2025 09:06:21 for Zephyr API Documentation by
1.12.0