Skip to content

Commit b38445e

Browse files
Yuval Peresscarlescufi
authored andcommitted
math: Introduce a DSP basicmath subsystem with a cmsis backend
Introduce an API mirroring the CMSIS-DSP's basicmath. If CMSIS_DSP is enabled, then it will by default be used as a backend. Developers may opt into a custom backend by setting CONFIG_DSP_BACKEND_CMSIS=n. If done, the application must provide `zdsp_backend/dsp.h` and optionally implement the functions in its own .c files. Signed-off-by: Yuval Peress <[email protected]>
1 parent 0433965 commit b38445e

File tree

20 files changed

+1637
-3
lines changed

20 files changed

+1637
-3
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ scripts/build/gen_image_info.py @tejlmand
756756
/subsys/debug/gdbstub.c @ceolin
757757
/subsys/dfu/ @de-nordic @nordicjm
758758
/subsys/disk/ @jfischer-no
759+
/subsys/dsp/ @yperess
759760
/subsys/tracing/ @nashif
760761
/subsys/debug/asan_hacks.c @aescolar @daor-oti
761762
/subsys/demand_paging/ @dcpleung @nashif

MAINTAINERS.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,17 @@ CMSIS API layer:
324324
- "area: CMSIS API Layer"
325325
- "area: Portability"
326326

327+
DSP subsystem:
328+
status: maintained
329+
maintainers:
330+
- stephanosio
331+
- yperess
332+
files:
333+
- subsys/dsp/
334+
- tests/subsys/dsp/
335+
labels:
336+
- "area: DSP"
337+
327338
CMSIS-DSP integration:
328339
status: maintained
329340
maintainers:
@@ -334,7 +345,6 @@ CMSIS-DSP integration:
334345
- modules/Kconfig.cmsis_dsp
335346
- tests/benchmarks/cmsis_dsp/
336347
- tests/lib/cmsis_dsp/
337-
- tests/subsys/dsp/
338348
labels:
339349
- "area: CMSIS-DSP"
340350

doc/develop/api/overview.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,7 @@ between major releases are available in the :ref:`zephyr_release_notes`.
316316
* - :ref:`watchdog_api`
317317
- Stable
318318
- 1.0
319+
320+
* - :ref:`zdsp_api`
321+
- Experimental
322+
- 3.3

doc/services/dsp/index.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. _zdsp_api:
2+
3+
Digital Signal Processing (DSP)
4+
###############################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
The DSP API provides an architecture agnostic way for signal processing.
11+
Currently, the API will work on any architecture but will likely not be
12+
optimized. The status of the various architectures can be found below:
13+
14+
+--------------+-------------+
15+
| Architecture | Status |
16+
+--------------+-------------+
17+
| ARC | Unoptimized |
18+
| ARM | Optimized |
19+
| ARM64 | Optimized |
20+
| MIPS | Unoptimized |
21+
| NIOS2 | Unoptimized |
22+
| POSIX | Unoptimized |
23+
| RISCV | Unoptimized |
24+
| RISCV64 | Unoptimized |
25+
| SPARC | Unoptimized |
26+
| X86 | Unoptimized |
27+
| XTENSA | Unoptimized |
28+
+--------------+-------------+
29+
30+
Using zDSP
31+
**********
32+
33+
zDSP provides various backend options which are selected automatically for the
34+
application. By default, including the CMSIS module will enable all
35+
architectures to use the zDSP APIs. This can be done by setting::
36+
37+
CONFIG_CMSIS_DSP=y
38+
39+
If your application requires some additional customization, it's possible to
40+
enable :kconfig:option:`CONFIG_DSP_BACKEND_CUSTOM` which means that the
41+
application is responsible for providing the implementation of the zDSP
42+
library.
43+
44+
Optimizing for your architecture
45+
********************************
46+
47+
If your architecture is showing as ``Unoptimized``, it's possible to add a new
48+
zDSP backend to better support it. To do that, a new Kconfig option should be
49+
added to `subsys/dsp/Kconfig`_ along with the required dependencies and the
50+
``default`` set for ``DSP_BACKEND`` Kconfig choice.
51+
52+
Next, the implementation should be added at ``subsys/dsp/<backend>/`` and
53+
linked in at `subsys/dsp/CMakeLists.txt`_.
54+
55+
API Reference
56+
*************
57+
58+
.. doxygengroup:: math_dsp
59+
60+
.. _subsys/dsp/Kconfig: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/Kconfig
61+
.. _subsys/dsp/CMakeLists.txt: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/CMakeLists.txt

doc/services/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OS Services
1010
crypto/index
1111
debugging/index.rst
1212
device_mgmt/index
13+
dsp/index.rst
1314
file_system/index.rst
1415
formatted_output.rst
1516
ipc/index.rst

doc/zephyr.doxyfile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,7 @@ PREDEFINED = __DOXYGEN__ \
23162316
CONFIG_ERRNO \
23172317
CONFIG_FLASH_JESD216_API \
23182318
CONFIG_FLASH_PAGE_LAYOUT \
2319+
CONFIG_FP16 \
23192320
CONFIG_FPU \
23202321
CONFIG_FPU_SHARING \
23212322
CONFIG_GDBSTUB \

0 commit comments

Comments
 (0)