Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The SOF firmware is built with a modular, layered architecture to support multip

### 2.1 OS Abstraction and RTOS
* **Zephyr RTOS:** Modern SOF extensively leverages the Zephyr RTOS for core operating system services, including thread scheduling, synchronization, logging, and hardware abstraction.
* **XTOS / Bare-metal (Legacy):** Older platforms or specific stripped-down environments might use XTOS or bare-metal abstractions.
* **Host builds:** The host library, testbench and unit tests run on the host, with POSIX replacements for the RTOS headers (`posix/include`).

### 2.2 Inter-Process Communication (IPC)
The IPC subsystem is responsible for all communication between the Host OS and the DSP Firmware.
Expand Down
6 changes: 3 additions & 3 deletions posix/include/rtos/bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/

#ifndef __XTOS_RTOS_BIT_H__
#define __XTOS_RTOS_BIT_H__
#ifndef __POSIX_RTOS_BIT_H__
#define __POSIX_RTOS_BIT_H__

#if ASSEMBLY
#define BIT(b) (1 << (b))
Expand All @@ -24,4 +24,4 @@
#define GET_BITS(b_hi, b_lo, x) \
(((x) & MASK(b_hi, b_lo)) >> (b_lo))

#endif /* __XTOS_RTOS_BIT_H__ */
#endif /* __POSIX_RTOS_BIT_H__ */
2 changes: 1 addition & 1 deletion posix/include/rtos/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <stdint.h>

#ifdef __ZEPHYR__
#error "This file should only be included in XTOS builds."
#error "This file should only be included in host builds."
#endif

typedef uint32_t k_ticks_t;
Expand Down
2 changes: 1 addition & 1 deletion posix/include/rtos/panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <stdint.h>

#ifdef __ZEPHYR__
#error "This file should only be included in XTOS builds."
#error "This file should only be included in host builds."
#endif /* __ZEPHYR__ */

#ifdef __clang_analyzer__
Expand Down
6 changes: 3 additions & 3 deletions posix/include/sof/lib/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/

#ifndef __XTOS_POSIX_LIB_IO_H__
#define __XTOS_POSIX_LIB_IO_H__
#ifndef __POSIX_SOF_LIB_IO_H__
#define __POSIX_SOF_LIB_IO_H__


#include <stdint.h>
Expand Down Expand Up @@ -85,4 +85,4 @@ static inline void io_reg_update_bits8(uint32_t reg, uint8_t mask,

#endif

#endif /* __XTOS_POSIX_LIB_IO_H__ */
#endif /* __POSIX_SOF_LIB_IO_H__ */
2 changes: 1 addition & 1 deletion scripts/set_xtensa_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ case "$platform" in
;;
esac

# Pre-zephyr "XTOS" build, testbench,...
# Testbench build (rebuild-testbench.sh)
case "$platform" in
mtl|lnl|ptl|acp_7_0|mt8196|nvl)
SOF_CC_BASE='clang';;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/google/google_rtc_audio_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/* Zephyr provides uncached memory for static variables on SMP, but we
* are single-core component and know we can safely use the cache for
* AEC work. XTOS SOF is cached by default, so stub the Zephyr API.
* AEC work. Host builds have no Zephyr cache API, so stub it.
*/
#ifdef __ZEPHYR__
#include <zephyr/cache.h>
Expand Down
2 changes: 1 addition & 1 deletion src/include/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
** SOF Header Layout **

Today SOF is somewhat coupled with xtensa xtos/HAL and it's own SOF RTOS logic.
SOF used to be coupled with the Xtensa XTOS/HAL and its own SOF RTOS logic.
This coupling is reflected in the headers where we have a mix of RTOS and
common headers at the top level ```src/include``` directory.

Expand Down
6 changes: 3 additions & 3 deletions src/include/sof/lib/uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ struct sof_uuid_entry {
__attribute__((alias("_" #uuid_name))) uuid_name

#else
/* XTOS SOF emits two definitions, one into the runtime (which may not
* be linked if unreferenced) and a separate one that goes into a
* special section via handling in the linker script.
/* Host builds emit two definitions, one into the runtime (which may not
* be linked if unreferenced) and a separate one in the .static_uuids
* section.
*/
#define _UUID(uuid_name) (&(uuid_name ## _ldc))
#define _RT_UUID(uuid_name) (&(uuid_name))
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (CONFIG_IPC_MAJOR_4)
add_subdirectory(ipc4)
endif()

# Common to Zephyr and XTOS
# Common to the Zephyr and host builds
add_local_sources(sof
ipc-common.c
ipc-helper.c
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/ipc4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause

# Files common to Zephyr and XTOS
# Files common to the Zephyr and host builds
add_local_sources(sof
handler-user.c
helper.c
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/arch/host/include/arch/drivers/idc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

#else

#error "This file shouldn't be included from outside of XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of the host rtos/idc.h"

#endif /* __POSIX_RTOS_IDC_H__ */
2 changes: 1 addition & 1 deletion src/kernel/arch/host/include/arch/schedule/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

#else

#error "This file shouldn't be included from outside of XTOS's posix/task.h"
#error "This file shouldn't be included from outside of the host rtos/task.h"

#endif /* __POSIX_RTOS_TASK_H__ */
19 changes: 0 additions & 19 deletions src/kernel/arch/host/include/arch/sof.h

This file was deleted.

22 changes: 0 additions & 22 deletions src/kernel/arch/host/lib/ams.c

This file was deleted.

4 changes: 0 additions & 4 deletions src/kernel/ipc/ipc-common-kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ struct k_work_q *ipc_send_wq_get(void)

static void schedule_ipc_worker(void)
{
/*
* note: in XTOS builds, this is handled in
* task_main_primary_core()
*/
#if defined(__ZEPHYR__) && !CONFIG_SOF_BOOT_TEST_STANDALONE
/* with SOF_BOOT_TEST_STANDALONE, ipc_init() does not set up the work queue */
k_work_schedule_for_queue(&ipc_send_wq, &ipc_send_work, K_USEC(IPC_PERIOD_USEC));
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/ipc/ipc3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause

# Files common to Zephyr and XTOS
# Files common to the Zephyr and host builds
add_local_sources(sof
handler.c
helper.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
* SaiSurya, Ch <saisurya.chakkaveeravenkatanaga@amd.com>
*/
#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__)
#ifdef __ZEPHYR_RTOS_IDC_H__

#ifndef __PLATFORM_DRIVERS_IDC_H__
#define __PLATFORM_DRIVERS_IDC_H__
Expand All @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; }

#else

#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h"

#endif
4 changes: 2 additions & 2 deletions src/kernel/platform/imx8/include/platform/drivers/idc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*/

#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__)
#ifdef __ZEPHYR_RTOS_IDC_H__

#ifndef __PLATFORM_DRIVERS_IDC_H__
#define __PLATFORM_DRIVERS_IDC_H__
Expand All @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; }

#else

#error "This file shouldn't be included from outside of Zepyhr/XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h"

#endif
4 changes: 2 additions & 2 deletions src/kernel/platform/imx8m/include/platform/drivers/idc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: Daniel Baluta <daniel.baluta@nxp.com>
*/

#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__)
#ifdef __ZEPHYR_RTOS_IDC_H__

#ifndef __PLATFORM_DRIVERS_IDC_H__
#define __PLATFORM_DRIVERS_IDC_H__
Expand All @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; }

#else

#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h"

#endif
4 changes: 2 additions & 2 deletions src/kernel/platform/imx8ulp/include/platform/drivers/idc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Zhang Peng <peng.zhang_8@nxp.com>
*/

#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__)
#ifdef __ZEPHYR_RTOS_IDC_H__

#ifndef __PLATFORM_DRIVERS_IDC_H__
#define __PLATFORM_DRIVERS_IDC_H__
Expand All @@ -24,6 +24,6 @@ static inline int idc_init(void) { return 0; }

#else

#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h"

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ static inline int idc_restore(void)

#else

#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h"
#error "This file shouldn't be included from outside of the host rtos/idc.h"

#endif
8 changes: 3 additions & 5 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ if(CONFIG_SOF_FULL_ZEPHYR_APPLICATION)
if(CONFIG_ZEPHYR_POSIX)
set(ARCH host)
set(PLATFORM "posix")
set(PLATFORM_HEADERS "posix")
else()
# firmware build supports only xtensa arch for now
set(ARCH xtensa)
set(PLATFORM_HEADERS "xtos")
endif()

# Appends literal with path of the source file relative to the project root
Expand Down Expand Up @@ -201,9 +199,9 @@ zephyr_include_directories(${SOF_SRC_PATH}/include/sof/audio/module_adapter/libr


# New, "de-centralized Zephyr" way. Requires "is_zephyr()" conditionals in
# the decentralized CMakeLists.txt files shared with XTOS.
# the decentralized CMakeLists.txt files shared with the host builds.

# XTOS duplicate in sof/scripts/misc.cmake; keep in sync
# Host build duplicate in sof/scripts/cmake/misc.cmake; keep in sync
macro(is_zephyr ret)
if(CONFIG_ZEPHYR_SOF_MODULE)
set(${ret} TRUE)
Expand All @@ -212,7 +210,7 @@ macro(is_zephyr ret)
endif()
endmacro()

# Wrappers for compatibility and re-use of existing, XTOS CMake files.
# Wrappers for the CMake files shared with the host builds.
# Do NOT use these macros in this file or in any other Zephyr-specific
# CMake code.
macro(add_local_sources target)
Expand Down
2 changes: 1 addition & 1 deletion zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ config ZEPHYR_NATIVE_DRIVERS
Enable Zephyr native api drivers for host and dai audio components
host-zephyr
dai-zephyr
will be used instead of legacy xtos version.
will be used instead of the legacy SOF drivers.

config DMA_MTK_SOF_HOST_DMA
bool "MediaTek SOF host DMA driver"
Expand Down
11 changes: 3 additions & 8 deletions zephyr/README
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
SOF with Zephyr RTOS
====================

SOF currently uses the Cadence Xtos/HAL and it's own kernel functions as
its RTOS. SOF is moving to use Zephyr as it's RTOS in parallel to current
releases using xtos.

The initial "alpha" of SOF on Zephyr will use the Zephyr RTOS for boot, IRQs,
scheduling and memory allocation. Subsequent release will use more Zephyr
functionality as code is moved from SOF to Zephyr (i.e. EDF scheduler updates
copied from SOF to Zephyr).
SOF uses the Zephyr RTOS for boot, IRQs, scheduling and memory allocation.
Zephyr is the only supported RTOS: the XTOS (Cadence Xtos/HAL) firmware build
has been removed.

Building SOF on Zephyr
======================
Expand Down
4 changes: 1 addition & 3 deletions zephyr/include/rtos/interrupt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2022 Intel Corporation. All rights reserved.
*
* TODO: IMX support, today IRQ is supported via SOF xtos API.
*/

#ifndef __ZEPHYR_RTOS_INTERRUPT_H__
Expand All @@ -12,7 +10,7 @@
* to native drivers.
*/
#if defined(CONFIG_AMD) && !defined(CONFIG_ZEPHYR_NATIVE_DRIVERS)
/* imx currently has no IRQ driver in Zephyr so we force to xtos IRQ */
/* AMD platforms without native drivers use the legacy SOF interrupt API */
#include <rtos/interrupt-legacy.h>
#else

Expand Down
4 changes: 2 additions & 2 deletions zephyr/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ struct k_heap;
* Definitions in this file are used by following SOF code:
* - Some use of SOF DMA data types and definitions exists in
* generic application code (in IPC, host handling and a few other
* places). To support both XTOS and Zephyr builds, these
* places). To support both the host and Zephyr builds, these
* definitions must be provided by the RTOS layer.
* - SOF builds where Zephyr is used but platform has not yet
* moved to native Zephyr drivers, so legacy/XTOS DMA are used.
* moved to native Zephyr drivers, so the legacy SOF DMA drivers are used.
* - Linking DMA resources to audio usages. Even SOF builds with
* native Zephyr build still use some SOF side DMA definitions
* to describe system DMA resources in terms of their capabilities
Expand Down
2 changes: 1 addition & 1 deletion zephyr/include/sof/trace/preproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CONFIG_ZEPHYR_LOG

/*
* Unlike the XTOS version of this macro, this does not silence all
* Unlike the host version of this macro, this does not silence all
* compiler warnings about unused variables.
*/
#define SOF_TRACE_UNUSED(arg1, ...) ((void)arg1)
Expand Down
2 changes: 1 addition & 1 deletion zephyr/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DECLARE_TR_CTX(zephyr_tr, SOF_UUID(zephyr_uuid), LOG_LEVEL_INFO);
const char irq_name_level2[] = "level2";
const char irq_name_level5[] = "level5";

/* imx currently has no IRQ driver in Zephyr so we force to xtos IRQ */
/* AMD platforms without native drivers use the legacy SOF interrupt API */
#if defined(CONFIG_AMD) && !defined(CONFIG_ZEPHYR_NATIVE_DRIVERS)
int interrupt_register(uint32_t irq, void(*handler)(void *arg), void *arg)
{
Expand Down
Loading