Skip to content

Commit b4987f3

Browse files
committed
debug makro
1 parent 086e8e4 commit b4987f3

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/audio/module_adapter/module/generic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636

3737
LOG_MODULE_DECLARE(module_adapter, CONFIG_SOF_LOG_LEVEL);
3838

39+
/* Global fallback variables for MOD_DBG when mod is NULL */
40+
uint32_t mod_dbg_global_line;
41+
const char *mod_dbg_global_file;
42+
3943
int module_load_config(struct comp_dev *dev, const void *cfg, size_t size)
4044
{
4145
int ret;

src/include/module/module/base.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@
2323
#define module_get_private_data(mod) ((mod)->priv.private)
2424
#define module_set_private_data(mod, data) ((mod)->priv.private = data)
2525

26+
extern uint32_t mod_dbg_global_line;
27+
extern const char *mod_dbg_global_file;
28+
29+
#define MOD_DBG(mod) do { \
30+
if (mod) { \
31+
(mod)->line = __LINE__; \
32+
(mod)->file = __FILE__; \
33+
} else { \
34+
mod_dbg_global_line = __LINE__; \
35+
mod_dbg_global_file = __FILE__; \
36+
} \
37+
} while (0)
38+
2639
/**
2740
* \struct module_ext_init_data
2841
* \brief Container for found ext init object pointers
@@ -97,7 +110,8 @@ struct k_mem_domain;
97110
struct processing_module {
98111
struct module_data priv; /**< module private data */
99112
uint32_t period_bytes; /** pipeline period bytes */
100-
113+
uint32_t line;
114+
const char *file;
101115
/*
102116
* Fields below can only be accessed by the SOF and must be moved to a new structure.
103117
* Below #ifdef is a temporary solution used until work on separating a common interface

0 commit comments

Comments
 (0)