mirror of https://github.com/thesofproject/sof.git
include: sof: debug: Split panic.h into Zephyr and XTOS-specific headers
The purpose of this commit is to separate Zephyr-specific definitions from XTOS-specific definitions. Based on the build, <rtos/panic.h> will contain the required definitions. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
parent
a9b9d85b7a
commit
b91e253f65
|
@ -8,54 +8,6 @@
|
|||
#ifndef __SOF_DEBUG_PANIC_H__
|
||||
#define __SOF_DEBUG_PANIC_H__
|
||||
|
||||
#include <arch/debug/panic.h>
|
||||
#include <ipc/trace.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __clang_analyzer__
|
||||
#define SOF_NORETURN __attribute__((analyzer_noreturn))
|
||||
#elif __GNUC__
|
||||
#define SOF_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define SOF_NORETURN
|
||||
#endif
|
||||
|
||||
#ifndef RELATIVE_FILE
|
||||
#error "This file requires RELATIVE_FILE to be defined. " \
|
||||
"Add it to CMake's target with sof_append_relative_path_definitions."
|
||||
#endif
|
||||
|
||||
void dump_panicinfo(void *addr, struct sof_ipc_panic_info *panic_info);
|
||||
void panic_dump(uint32_t p, struct sof_ipc_panic_info *panic_info,
|
||||
uintptr_t *data)
|
||||
SOF_NORETURN;
|
||||
|
||||
#ifdef __ZEPHYR__
|
||||
#include <rtos/kernel.h>
|
||||
#define sof_panic(x) k_panic()
|
||||
|
||||
#define assert(x) __ASSERT_NO_MSG(x)
|
||||
|
||||
/* To print the asserted expression on failure:
|
||||
* #define assert(x) __ASSERT(x, #x)
|
||||
*/
|
||||
|
||||
#else /* __ZEPHYR__ */
|
||||
|
||||
|
||||
void __panic(uint32_t p, char *filename, uint32_t linenum) SOF_NORETURN;
|
||||
|
||||
/** panic dump filename and linenumber of the call
|
||||
*
|
||||
* \param x panic code defined in ipc/trace.h
|
||||
*/
|
||||
#define sof_panic(x) __panic((x), (RELATIVE_FILE), (__LINE__))
|
||||
|
||||
/* runtime assertion */
|
||||
#ifndef assert
|
||||
#define assert(cond) (void)((cond) || (sof_panic(SOF_IPC_PANIC_ASSERT), 0))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#include <rtos/panic.h>
|
||||
|
||||
#endif /* __SOF_DEBUG_PANIC_H__ */
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright 2023 NXP
|
||||
* Copyright(c) 2018 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOS_RTOS_PANIC_H__
|
||||
#define __XTOS_RTOS_PANIC_H__
|
||||
|
||||
#include <ipc/trace.h>
|
||||
#include <stdint.h>
|
||||
#include <arch/debug/panic.h>
|
||||
|
||||
#ifdef __ZEPHYR__
|
||||
#error "This file should only be included in XTOS builds."
|
||||
#endif /* __ZEPHYR__ */
|
||||
|
||||
#ifdef __clang_analyzer__
|
||||
#define SOF_NORETURN __attribute__((analyzer_noreturn))
|
||||
#elif __GNUC__
|
||||
#define SOF_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define SOF_NORETURN
|
||||
#endif
|
||||
|
||||
#ifndef RELATIVE_FILE
|
||||
#error "This file requires RELATIVE_FILE to be defined. "\
|
||||
"Add it to CMake's target with sof_append_relative_path_definitions."
|
||||
#endif
|
||||
|
||||
void dump_panicinfo(void *addr, struct sof_ipc_panic_info *panic_info);
|
||||
void panic_dump(uint32_t p, struct sof_ipc_panic_info *panic_info,
|
||||
uintptr_t *data) SOF_NORETURN;
|
||||
void __panic(uint32_t p, char *filename, uint32_t linenum) SOF_NORETURN;
|
||||
|
||||
/** panic dump filename and linenumber of the call
|
||||
*
|
||||
* \param x panic code defined in ipc/trace.h
|
||||
*/
|
||||
#define sof_panic(x) __panic((x), (RELATIVE_FILE), (__LINE__))
|
||||
|
||||
/* runtime assertion */
|
||||
#ifndef assert
|
||||
#define assert(cond) (void)((cond) || (sof_panic(SOF_IPC_PANIC_ASSERT), 0))
|
||||
#endif
|
||||
|
||||
#endif /* __XTOS_RTOS_PANIC_H__ */
|
|
@ -0,0 +1,25 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright 2023 NXP
|
||||
* Copyright(c) 2018 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __ZEPHYR_RTOS_PANIC_H__
|
||||
#define __ZEPHYR_RTOS_PANIC_H__
|
||||
|
||||
#include <rtos/kernel.h>
|
||||
|
||||
#ifndef __ZEPHYR__
|
||||
#error "This file should only be included in Zephyr builds."
|
||||
#endif /* __ZEPHYR__ */
|
||||
|
||||
#define sof_panic(x) k_panic()
|
||||
#define assert(x) __ASSERT_NO_MSG(x)
|
||||
|
||||
/* To print the asserted expression on failure:
|
||||
* #define assert(x) __ASSERT(x, #x)
|
||||
*/
|
||||
|
||||
#endif /* __ZEPHYR_RTOS_PANIC_H__ */
|
Loading…
Reference in New Issue