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
5 changes: 4 additions & 1 deletion lmdk/cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/config.cmake)

# Build common module functions from sof to a static library
add_library(sof STATIC)
target_include_directories(sof PRIVATE "${SOF_BASE}/src/include")
target_include_directories(sof PRIVATE
"${SOF_BASE}/src/include"
"${LMDK_BASE}/include"
)
add_subdirectory("${SOF_BASE}/src/module" module_api)

foreach(MODULE ${MODULES_LIST})
Expand Down
23 changes: 23 additions & 0 deletions lmdk/include/rtos/panic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2026 Intel Corporation. All rights reserved.
*
* Author: Piotr Hoppe <piotr.hoppe@intel.com>
*/

#ifndef __LMDK_RTOS_PANIC_H__
#define __LMDK_RTOS_PANIC_H__

#ifdef __cplusplus
extern "C" {
#endif

/* runtime assertion */
#define assert(x) do { if (!(x)) while (1); } while (0)

#ifdef __cplusplus
}
#endif

#endif /* __LMDK_RTOS_PANIC_H__ */

53 changes: 53 additions & 0 deletions lmdk/include/sof/math/numbers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
* Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
* Liam Girdwood <liam.r.girdwood@linux.intel.com>
* Keyon Jie <yang.jie@linux.intel.com>
*/

/*
* LMDK-local copy of <sof/math/numbers.h>.
*
* Loadable modules must not pull in the whole SOF src/include tree. This file
* mirrors the parts of the SOF header that the sink/source module API relies on
* (mainly the ROUND_UP/ROUND_DOWN/MIN/MAX helpers) so that the unchanged
* "#include <sof/math/numbers.h>" resolves inside the LMDK build without
* exposing the rest of the SOF headers.
*/

#ifndef __SOF_MATH_NUMBERS_H__
#define __SOF_MATH_NUMBERS_H__

#include <stdint.h>

/* Unsafe and portable macros for consistency with Zephyr.
* See SEI CERT-C PRE31-C
*/
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

#define ROUND_DOWN(size, alignment) ({ \
__typeof__(size) __size = (size); \
__typeof__(alignment) __alignment = (alignment); \
__size - (__size % __alignment); \
})

#define ROUND_UP(size, alignment) ({ \
__typeof__(size) __size = (size); \
__typeof__(alignment) __alignment = (alignment); \
((__size + __alignment - 1) / __alignment) * __alignment; \
})

#define ABS(a) ({ \
__typeof__(a) __a = (a); \
__a < 0 ? -__a : __a; \
})
#define SGN(a) ({ \
__typeof__(a) __a = (a); \
__a < 0 ? -1 : \
__a > 0 ? 1 : 0; \
})

#endif /* __SOF_MATH_NUMBERS_H__ */
Loading
Loading