From efa794dbc5fe2d0b406f953be5be09caeaac03ab Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Fri, 10 Jul 2020 14:58:32 +0100 Subject: [PATCH] samples/audio: Add Sound Open Firmware Adds the Sound Open Firmware project, built as a Zephyr application, under samples/subsys/sudio/sof. Signed-off-by: Liam Girdwood --- samples/audio/sof/CMakeLists.txt | 17 +++++++++ .../audio/sof/boards/intel_adsp_cavs15.conf | 8 +++++ .../audio/sof/boards/intel_adsp_cavs18.conf | 7 ++++ .../audio/sof/boards/intel_adsp_cavs20.conf | 6 ++++ .../audio/sof/boards/intel_adsp_cavs25.conf | 6 ++++ samples/audio/sof/prj.conf | 7 ++++ samples/audio/sof/sample.yaml | 11 ++++++ samples/audio/sof/src/main.c | 36 +++++++++++++++++++ 8 files changed, 98 insertions(+) create mode 100644 samples/audio/sof/CMakeLists.txt create mode 100644 samples/audio/sof/boards/intel_adsp_cavs15.conf create mode 100644 samples/audio/sof/boards/intel_adsp_cavs18.conf create mode 100644 samples/audio/sof/boards/intel_adsp_cavs20.conf create mode 100644 samples/audio/sof/boards/intel_adsp_cavs25.conf create mode 100644 samples/audio/sof/prj.conf create mode 100644 samples/audio/sof/sample.yaml create mode 100644 samples/audio/sof/src/main.c diff --git a/samples/audio/sof/CMakeLists.txt b/samples/audio/sof/CMakeLists.txt new file mode 100644 index 00000000000..6f500e87a13 --- /dev/null +++ b/samples/audio/sof/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.13.1) + +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) +project(sample_sof) + +target_sources(app PRIVATE + src/main.c + ) + +zephyr_interface_library_named(sof_lib) + +zephyr_library_include_directories(app PUBLIC + ${sof_module}/src/arch/xtensa/include + ${sof_module}/src/include + ) diff --git a/samples/audio/sof/boards/intel_adsp_cavs15.conf b/samples/audio/sof/boards/intel_adsp_cavs15.conf new file mode 100644 index 00000000000..ecc40cf02ac --- /dev/null +++ b/samples/audio/sof/boards/intel_adsp_cavs15.conf @@ -0,0 +1,8 @@ +CONFIG_APOLLOLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_CORE_COUNT=1 +CONFIG_LP_MEMORY_BANKS=2 +CONFIG_HP_MEMORY_BANKS=8 +CONFIG_PERFORMANCE_COUNTERS=y +CONFIG_COMP_SRC_SMALL=y diff --git a/samples/audio/sof/boards/intel_adsp_cavs18.conf b/samples/audio/sof/boards/intel_adsp_cavs18.conf new file mode 100644 index 00000000000..a49f550c35c --- /dev/null +++ b/samples/audio/sof/boards/intel_adsp_cavs18.conf @@ -0,0 +1,7 @@ +CONFIG_CANNONLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=47 +CONFIG_PERFORMANCE_COUNTERS=y diff --git a/samples/audio/sof/boards/intel_adsp_cavs20.conf b/samples/audio/sof/boards/intel_adsp_cavs20.conf new file mode 100644 index 00000000000..0f3a659cbe2 --- /dev/null +++ b/samples/audio/sof/boards/intel_adsp_cavs20.conf @@ -0,0 +1,6 @@ +CONFIG_ICELAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=47 diff --git a/samples/audio/sof/boards/intel_adsp_cavs25.conf b/samples/audio/sof/boards/intel_adsp_cavs25.conf new file mode 100644 index 00000000000..8c5d4e912b5 --- /dev/null +++ b/samples/audio/sof/boards/intel_adsp_cavs25.conf @@ -0,0 +1,6 @@ +CONFIG_TIGERLAKE=y +CONFIG_INTEL_DMIC=y +CONFIG_INTEL_SSP=y +CONFIG_INTEL_ALH=y +CONFIG_LP_MEMORY_BANKS=1 +CONFIG_HP_MEMORY_BANKS=46 diff --git a/samples/audio/sof/prj.conf b/samples/audio/sof/prj.conf new file mode 100644 index 00000000000..74c52d4a3e1 --- /dev/null +++ b/samples/audio/sof/prj.conf @@ -0,0 +1,7 @@ +CONFIG_SOF=y +CONFIG_SMP=n +CONFIG_LOG=y +CONFIG_MP_NUM_CPUS=1 + +# Requires heap_info() be implemented, but no Zephyr wrapper +CONFIG_DEBUG_MEMORY_USAGE_SCAN=n diff --git a/samples/audio/sof/sample.yaml b/samples/audio/sof/sample.yaml new file mode 100644 index 00000000000..32ba0df254e --- /dev/null +++ b/samples/audio/sof/sample.yaml @@ -0,0 +1,11 @@ +sample: + description: Audio with SOF + name: sof +common: + tags: audio +tests: + sample.audio.sof: + tags: sof + build_only: true + integration_platforms: + - intel_adsp_cavs15 diff --git a/samples/audio/sof/src/main.c b/samples/audio/sof/src/main.c new file mode 100644 index 00000000000..ee3eba34362 --- /dev/null +++ b/samples/audio/sof/src/main.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG); + +/** + * Should be included from sof/schedule/task.h + * but triggers include chain issue + * FIXME + */ +int sof_main(int argc, char *argv[]); + +/** + * TODO: Here comes SOF initialization + */ + +void main(void) +{ + int ret; + + LOG_INF("SOF on %s", CONFIG_BOARD); + + /* sof_main is actually SOF initialization */ + ret = sof_main(0, NULL); + if (ret) { + LOG_ERR("SOF initialization failed"); + } + + LOG_INF("SOF initialized"); +}