Loading...
Searching...
No Matches
Go to the documentation of this file.
9#ifndef __SOF_DEBUG_DEBUG_H__
10#define __SOF_DEBUG_DEBUG_H__
25#error "This file requires RELATIVE_FILE to be defined. " \
26 "Add it to CMake's target with sof_append_relative_path_definitions."
33#define DEBUG_SET_FW_READY_FLAGS \
35 SOF_IPC_INFO_BUILD | \
36 (IS_ENABLED(CONFIG_GDB_DEBUG) ? SOF_IPC_INFO_GDB : 0) \
42 volatile uint32_t *__m = (uint32_t *)mailbox_get_debug_base(); \
43 *(__m++) = (RELATIVE_FILE[0] << 24) + \
44 (RELATIVE_FILE[1] << 16) + \
45 (RELATIVE_FILE[2] << 8) + (RELATIVE_FILE[3]); \
46 *(__m++) = (__func__[0] << 24) + (__func__[1] << 16) + \
47 (__func__[2] << 8) + (__func__[3]); \
54 volatile uint32_t *__m = \
55 (uint32_t *)mailbox_get_debug_base() + __x; \
56 *(__m++) = (RELATIVE_FILE[0] << 24) + \
57 (RELATIVE_FILE[1] << 16) + \
58 (RELATIVE_FILE[2] << 8) + (RELATIVE_FILE[3]); \
59 *(__m++) = (__func__[0] << 24) + (__func__[1] << 16) + \
60 (__func__[2] << 8) + (__func__[3]); \
67 volatile uint32_t *__m = \
68 (volatile uint32_t *)mailbox_get_debug_base(); \
73#define dbg_val_at(__v, __x) \
75 volatile uint32_t *__m = \
76 (volatile uint32_t *)mailbox_get_debug_base() + __x; \
81#define dump(addr, count) \
83 volatile uint32_t *__m = (uint32_t *)mailbox_get_debug_base(); \
84 volatile uint32_t *__a = (uint32_t *)addr; \
85 volatile int __c = count; \
87 *(__m++) = *(__a++); \
91#define dump_at(addr, count, offset) \
93 volatile uint32_t *__m = \
94 (uint32_t *)mailbox_get_debug_base() + offset; \
95 volatile uint32_t *__a = (uint32_t *)addr; \
96 volatile int __c = count; \
98 *(__m++) = *(__a++); \
102#define dump_object(__o) \
105 dump(&__o, sizeof(__o) >> 2); \
109#define dump_object_ptr(__o) \
112 dump(__o, sizeof(*(__o)) >> 2); \
115#define dump_object_ptr_at(__o, __at) \
118 dump_at(__o, sizeof(*(__o)) >> 2, __at);\
123#define DEBUG_SET_FW_READY_FLAGS \
125 (IS_ENABLED(CONFIG_GDB_DEBUG) ? SOF_IPC_INFO_GDB : 0) \
128#define dbg() do {} while (0)
129#define dbg_at(__x) do {} while (0)
130#define dbg_val(__v) do {} while (0)
131#define dbg_val_at(__v, __x) do {} while (0)
132#define dump(addr, count) do {} while (0)
133#define dump_object(__o) do {} while (0)
134#define dump_object_ptr(__o) do {} while (0)
138#define bswap32(N) ({ \
139 __typeof__(N) n = (N); \
140 ((n & 0x000000FF) << 24) | \
141 ((n & 0x0000FF00) << 8) | \
142 ((n & 0x00FF0000) >> 8) | \
143 ((n & 0xFF000000) >> 24); })
150#define dump_hex(ptr, idx, len) \
152 __typeof__(idx) __i = (idx); \
153 __typeof__(ptr) __p = (ptr) + __i; \
154 __typeof__(idx) __l = (len) - __i; \
155 __typeof__(idx) __n = __l > 4 ? 4 : __l; \
157 comp_info(dev, "%08x%08x%08x%08x", bswap32(__p[0]), bswap32(__p[1]), \
158 bswap32(__p[2]), bswap32(__p[3])); \
159 } else if (__n == 3) { \
160 comp_info(dev, "%08x%08x%08x", bswap32(__p[0]), bswap32(__p[1]), \
162 } else if (__n == 2) { \
163 comp_info(dev, "%08x%08x", bswap32(__p[0]), bswap32(__p[1])); \
164 } else if (__n == 1) { \
165 comp_info(dev, "%08x", bswap32(__p[0])); \
171#define dump_hex() do {} while (0)