Skip to content

Commit

Permalink
math: Introduce a DSP basicmath subsystem with a cmsis backend
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
yperess authored and carlescufi committed Dec 2, 2022
1 parent 0433965 commit b38445e
Show file tree
Hide file tree
Showing 20 changed files with 1,637 additions and 3 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ scripts/build/gen_image_info.py @tejlmand
/subsys/debug/gdbstub.c @ceolin
/subsys/dfu/ @de-nordic @nordicjm
/subsys/disk/ @jfischer-no
/subsys/dsp/ @yperess
/subsys/tracing/ @nashif
/subsys/debug/asan_hacks.c @aescolar @daor-oti
/subsys/demand_paging/ @dcpleung @nashif
Expand Down
12 changes: 11 additions & 1 deletion MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@ CMSIS API layer:
- "area: CMSIS API Layer"
- "area: Portability"

DSP subsystem:
status: maintained
maintainers:
- stephanosio
- yperess
files:
- subsys/dsp/
- tests/subsys/dsp/
labels:
- "area: DSP"

CMSIS-DSP integration:
status: maintained
maintainers:
Expand All @@ -334,7 +345,6 @@ CMSIS-DSP integration:
- modules/Kconfig.cmsis_dsp
- tests/benchmarks/cmsis_dsp/
- tests/lib/cmsis_dsp/
- tests/subsys/dsp/
labels:
- "area: CMSIS-DSP"

Expand Down
4 changes: 4 additions & 0 deletions doc/develop/api/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,7 @@ between major releases are available in the :ref:`zephyr_release_notes`.
* - :ref:`watchdog_api`
- Stable
- 1.0

* - :ref:`zdsp_api`
- Experimental
- 3.3
61 changes: 61 additions & 0 deletions doc/services/dsp/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.. _zdsp_api:

Digital Signal Processing (DSP)
###############################

.. contents::
:local:
:depth: 2

The DSP API provides an architecture agnostic way for signal processing.
Currently, the API will work on any architecture but will likely not be
optimized. The status of the various architectures can be found below:

+--------------+-------------+
| Architecture | Status |
+--------------+-------------+
| ARC | Unoptimized |
| ARM | Optimized |
| ARM64 | Optimized |
| MIPS | Unoptimized |
| NIOS2 | Unoptimized |
| POSIX | Unoptimized |
| RISCV | Unoptimized |
| RISCV64 | Unoptimized |
| SPARC | Unoptimized |
| X86 | Unoptimized |
| XTENSA | Unoptimized |
+--------------+-------------+

Using zDSP
**********

zDSP provides various backend options which are selected automatically for the
application. By default, including the CMSIS module will enable all
architectures to use the zDSP APIs. This can be done by setting::

CONFIG_CMSIS_DSP=y

If your application requires some additional customization, it's possible to
enable :kconfig:option:`CONFIG_DSP_BACKEND_CUSTOM` which means that the
application is responsible for providing the implementation of the zDSP
library.

Optimizing for your architecture
********************************

If your architecture is showing as ``Unoptimized``, it's possible to add a new
zDSP backend to better support it. To do that, a new Kconfig option should be
added to `subsys/dsp/Kconfig`_ along with the required dependencies and the
``default`` set for ``DSP_BACKEND`` Kconfig choice.

Next, the implementation should be added at ``subsys/dsp/<backend>/`` and
linked in at `subsys/dsp/CMakeLists.txt`_.

API Reference
*************

.. doxygengroup:: math_dsp

.. _subsys/dsp/Kconfig: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/Kconfig
.. _subsys/dsp/CMakeLists.txt: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/CMakeLists.txt
1 change: 1 addition & 0 deletions doc/services/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ OS Services
crypto/index
debugging/index.rst
device_mgmt/index
dsp/index.rst
file_system/index.rst
formatted_output.rst
ipc/index.rst
Expand Down
1 change: 1 addition & 0 deletions doc/zephyr.doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2316,6 +2316,7 @@ PREDEFINED = __DOXYGEN__ \
CONFIG_ERRNO \
CONFIG_FLASH_JESD216_API \
CONFIG_FLASH_PAGE_LAYOUT \
CONFIG_FP16 \
CONFIG_FPU \
CONFIG_FPU_SHARING \
CONFIG_GDBSTUB \
Expand Down
Loading

0 comments on commit b38445e

Please sign in to comment.