7#if MOS_CONFIG(MOS_DYNAMIC_DEBUG)
15#define _check_debug_macro_defined_(name) MOS_STATIC_ASSERT(MOS_CONCAT(MOS_DEBUG_, name) != 0);
17#undef _check_debug_macro_defined_
19#if MOS_CONFIG(MOS_DYNAMIC_DEBUG)
22struct _mos_debug_info mos_debug_info = {
23#define X(_name) ._name = { .id = __COUNTER__ + 1, .name = #_name, .enabled = MOS_DEBUG_FEATURE(_name) },
30void debug_print_action(
const char *
name,
bool newstate)
32 pr_info(
"debug option '%s' has been turned %s",
name, newstate ?
"on" :
"off");
35#define debug_show_function(name) \
36 bool debug_show_##name(sysfs_file_t *file) \
38 sysfs_printf(file, "%d\n", mos_debug_info.name.enabled); \
42#define debug_store_function(name) \
43 size_t debug_store_##name(sysfs_file_t *file, const char *buf, size_t count, off_t offset) \
49 const bool on = buf[0] == '1'; \
50 mos_debug_info.name.enabled = on; \
51 debug_print_action(#name, on); \
59#define X(name) SYSFS_RW_ITEM(#name, debug_show_##name, debug_store_##name),
66#define SETUP_DEBUG_MODULE(name) \
67 static bool setup_debug_##name(const char *value) \
69 mos_debug_info.name.enabled = cmdline_string_truthiness(value, true); \
72 MOS_SETUP("debug." #name, setup_debug_##name);
77#define debug_show_id_function(name) \
78 bool debug_show_id_##name(sysfs_file_t *file) \
80 sysfs_printf(file, "%d\n", mos_debug_info.name.id); \
87#define X(name) SYSFS_RO_ITEM(#name, debug_show_id_##name),
#define _check_debug_macro_defined_(name)
#define MOS_ALL_DEBUG_MODULES(X)
#define SYSFS_AUTOREGISTER(sysfs_name, sysfs_items)