3 * (C) COPYRIGHT 2010-2012 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
8 * A copy of the licence is included with the program, and can also be obtained from Free Software
9 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * Implementation of the OS abstraction layer for the kernel device driver
20 #ifndef _OSK_ARCH_DEBUG_H_
21 #define _OSK_ARCH_DEBUG_H_
23 #include <malisw/mali_stdtypes.h>
24 #include "mali_osk_arch_types.h"
27 /* Kernel testing helpers */
28 void osk_kernel_test_init(void);
29 void osk_kernel_test_term(void);
30 void osk_kernel_test_wait(void);
31 void osk_kernel_test_signal(void);
32 mali_bool osk_kernel_test_has_asserted(void);
33 void oskp_kernel_test_exit(void);
36 /** Maximum number of bytes (incl. end of string character) supported in the generated debug output string */
37 #define OSK_DEBUG_MESSAGE_SIZE 256
40 * All OSKP_ASSERT* and OSKP_PRINT_* macros will eventually call OSKP_PRINT to output messages
42 void oskp_debug_print(const char *fmt, ...);
43 #define OSKP_PRINT(...) oskp_debug_print(__VA_ARGS__)
46 * Insert a breakpoint to cause entry in an attached debugger. However, since there is
47 * no API available to trigger entry in a debugger, we dereference a NULL
48 * pointer which should cause an exception and enter a debugger.
50 #define OSKP_BREAKPOINT() *(int *)0 = 0
53 * Quit the driver and halt.
55 #define OSKP_QUIT() BUG()
60 #define OSKP_TRACE() WARN_ON(1)
62 #define OSKP_CHANNEL_INFO ((u32)0x00000001) /**< @brief No output*/
63 #define OSKP_CHANNEL_WARN ((u32)0x00000002) /**< @brief Standard output*/
64 #define OSKP_CHANNEL_ERROR ((u32)0x00000004) /**< @brief Error output*/
65 #define OSKP_CHANNEL_RAW ((u32)0x00000008) /**< @brief Raw output*/
66 #define OSKP_CHANNEL_ALL ((u32)0xFFFFFFFF) /**< @brief All the channels at the same time*/
68 /** @brief Disable the asserts tests if set to 1. Default is to enable the asserts. */
69 #ifndef OSK_DISABLE_ASSERT
70 #define OSK_DISABLE_ASSERTS 0
73 /** @brief If equals to 0, a trace containing the file, line, and function will be displayed before each message. */
74 #define OSK_SKIP_TRACE 0
76 /** @brief If different from 0, the trace will only contain the file and line. */
77 #define OSK_SKIP_FUNCTION_NAME 0
79 /** @brief Variable to set the permissions per module and per channel.
81 #define OSK_MODULES_PERMISSIONS "ALL_ALL"
83 /** @brief String terminating every message printed by the debug API */
84 #define OSK_STOP_MSG "\n"
86 /** @brief Enables support for runtime configuration if set to 1.
88 #define OSK_USE_RUNTIME_CONFIG 0
89 #define OSK_SIMULATE_FAILURES MALI_BASE_TRACK_MEMLEAK /**< @brief Enables simulation of failures (for testing) if non-zero */
91 #define OSK_ACTION_IGNORE 0 /**< @brief The given message is ignored then the execution continues*/
92 #define OSK_ACTION_PRINT_AND_CONTINUE 1 /**< @brief The given message is printed then the execution continues*/
93 #define OSK_ACTION_PRINT_AND_BREAK 2 /**< @brief The given message is printed then a break point is triggered*/
94 #define OSK_ACTION_PRINT_AND_QUIT 3 /**< @brief The given message is printed then the execution is stopped*/
95 #define OSK_ACTION_PRINT_AND_TRACE 4 /**< @brief The given message and a backtrace is printed then the execution continues*/
99 * @brief Defines the API behavior when @ref OSK_PRINT_INFO() is called
100 * @note Must be set to one of the following values: @see OSK_ACTION_PRINT_AND_CONTINUE,
101 * @note @ref OSK_ACTION_PRINT_AND_BREAK, @see OSK_ACTION_PRINT_AND_QUIT, @see OSK_ACTION_IGNORE
104 * @brief Defines the API behavior when @see OSK_PRINT_WARN() is called
105 * @note Must be set to one of the following values: @see OSK_ACTION_PRINT_AND_CONTINUE,
106 * @note @see OSK_ACTION_PRINT_AND_BREAK, @see OSK_ACTION_PRINT_AND_QUIT, @see OSK_ACTION_IGNORE
109 * @brief Defines the API behavior when @see OSK_PRINT_ERROR() is called
110 * @note Must be set to one of the following values: @see OSK_ACTION_PRINT_AND_CONTINUE,
111 * @note @see OSK_ACTION_PRINT_AND_BREAK, @see OSK_ACTION_PRINT_AND_QUIT, @see OSK_ACTION_IGNORE
114 * @brief Defines the API behavior when @see OSKP_PRINT_ASSERT() is called
115 * @note Must be set to one of the following values: @see OSK_ACTION_PRINT_AND_CONTINUE,
116 * @note @see OSK_ACTION_PRINT_AND_BREAK, @see OSK_ACTION_PRINT_AND_QUIT, @see OSK_ACTION_IGNORE
119 * @brief Defines the API behavior when @see OSKP_PRINT_RAW() is called
120 * @note Must be set to one of the following values: @see OSK_ACTION_PRINT_AND_CONTINUE,
121 * @note @see OSK_ACTION_PRINT_AND_BREAK, @see OSK_ACTION_PRINT_AND_QUIT, @see OSK_ACTION_IGNORE
126 #define OSK_ON_INFO OSK_ACTION_IGNORE
127 #define OSK_ON_WARN OSK_ACTION_PRINT_AND_CONTINUE
128 #define OSK_ON_ASSERT OSK_ACTION_PRINT_AND_QUIT
129 #define OSK_ON_ERROR OSK_ACTION_PRINT_AND_CONTINUE
130 #define OSK_ON_RAW OSK_ACTION_PRINT_AND_CONTINUE
132 #define OSK_ON_INFO OSK_ACTION_IGNORE
133 #define OSK_ON_WARN OSK_ACTION_IGNORE
134 #define OSK_ON_ASSERT OSK_ACTION_IGNORE
135 #define OSK_ON_ERROR OSK_ACTION_PRINT_AND_CONTINUE
136 #define OSK_ON_RAW OSK_ACTION_PRINT_AND_CONTINUE
140 #define OSKP_KERNEL_TEST_ASSERT() oskp_kernel_test_exit()
142 #define OSKP_KERNEL_TEST_ASSERT() CSTD_NOP()
146 * OSK_ASSERT macros do nothing if the flag @see OSK_DISABLE_ASSERTS is set to 1
148 #if OSK_DISABLE_ASSERTS
149 #define OSKP_ASSERT(expr) CSTD_NOP()
150 #define OSKP_INTERNAL_ASSERT(expr) CSTD_NOP()
151 #define OSKP_ASSERT_MSG(expr, ...) CSTD_NOP()
152 #else /* OSK_DISABLE_ASSERTS */
155 * @def OSKP_ASSERT_MSG(expr, ...)
156 * @brief Calls @see OSKP_PRINT_ASSERT and prints the given message if @a expr is false
158 * @note This macro does nothing if the flag @see OSK_DISABLE_ASSERTS is set to 1
160 * @param expr Boolean expression
161 * @param ... Message to display when @a expr is false, as a format string followed by format arguments.
163 #define OSKP_ASSERT_MSG(expr, ...)\
166 if(MALI_FALSE == (expr))\
168 OSKP_PRINT_ASSERT(__VA_ARGS__);\
173 * @def OSKP_ASSERT(expr)
174 * @brief Calls @see OSKP_PRINT_ASSERT and prints the expression @a expr if @a expr is false
176 * @note This macro does nothing if the flag @see OSK_DISABLE_ASSERTS is set to 1
178 * @param expr Boolean expression
180 #define OSKP_ASSERT(expr)\
181 OSKP_ASSERT_MSG(expr, #expr)
184 * @def OSKP_INTERNAL_ASSERT(expr)
185 * @brief Calls @see OSKP_BREAKPOINT if @a expr is false
186 * This assert function is for internal use of OSK functions which themselves are used to implement
187 * the OSK_ASSERT functionality. These functions should use OSK_INTERNAL_ASSERT which does not use
188 * any OSK functions to prevent ending up in a recursive loop.
190 * @note This macro does nothing if the flag @see OSK_DISABLE_ASSERTS is set to 1
192 * @param expr Boolean expression
194 #define OSKP_INTERNAL_ASSERT(expr)\
197 if(MALI_FALSE == (expr))\
204 * @def OSKP_PRINT_ASSERT(...)
205 * @brief Prints "MALI<ASSERT>" followed by trace, function name and the given message.
207 * The behavior of this function is defined by the macro @see OSK_ON_ASSERT.
209 * @note This macro does nothing if the flag @see OSK_DISABLE_ASSERTS is set to 1
211 * Example: OSKP_PRINT_ASSERT(" %d blocks could not be allocated", mem_alocated) will print:\n
212 * "MALI<ASSERT> In file <path> line: <line number> function:<function name> 10 blocks could not be allocated"
214 * @note Depending on the values of @see OSK_SKIP_FUNCTION_NAME and @see OSK_SKIP_TRACE the trace will be displayed
215 * before the message.
217 * @param ... Message to print, passed as a format string followed by format arguments.
219 #define OSKP_PRINT_ASSERT(...)\
222 OSKP_ASSERT_OUT(OSKP_PRINT_TRACE, OSKP_PRINT_FUNCTION, __VA_ARGS__);\
223 oskp_debug_assert_call_hook();\
224 OSKP_KERNEL_TEST_ASSERT();\
225 OSKP_ASSERT_ACTION();\
231 * @def OSKP_DEBUG_CODE( X )
232 * @brief Executes the code inside the macro only in debug mode
234 * @param X Code to compile only in debug mode.
237 #define OSKP_DEBUG_CODE( X ) X
239 #define OSKP_DEBUG_CODE( X ) CSTD_NOP()
243 * @def OSKP_ASSERT_ACTION
244 * @brief (Private) Action associated to the @see OSKP_PRINT_ASSERT event.
246 /* Configure the post display action */
247 #if OSK_ON_ASSERT == OSK_ACTION_PRINT_AND_BREAK
248 #define OSKP_ASSERT_ACTION OSKP_BREAKPOINT
249 #elif OSK_ON_ASSERT == OSK_ACTION_PRINT_AND_QUIT
250 #define OSKP_ASSERT_ACTION OSKP_QUIT
251 #elif OSK_ON_ASSERT == OSK_ACTION_PRINT_AND_TRACE
252 #define OSKP_ASSERT_ACTION OSKP_TRACE
253 #elif OSK_ON_ASSERT == OSK_ACTION_PRINT_AND_CONTINUE || OSK_ON_ASSERT == OSK_ACTION_IGNORE
254 #define OSKP_ASSERT_ACTION() CSTD_NOP()
256 #error invalid value for OSK_ON_ASSERT
260 * @def OSKP_RAW_ACTION
261 * @brief (Private) Action associated to the @see OSK_PRINT_RAW event.
263 /* Configure the post display action */
264 #if OSK_ON_RAW == OSK_ACTION_PRINT_AND_BREAK
265 #define OSKP_RAW_ACTION OSKP_BREAKPOINT
266 #elif OSK_ON_RAW == OSK_ACTION_PRINT_AND_QUIT
267 #define OSKP_RAW_ACTION OSKP_QUIT
268 #elif OSK_ON_RAW == OSK_ACTION_PRINT_AND_TRACE
269 #define OSKP_RAW_ACTION OSKP_TRACE
270 #elif OSK_ON_RAW == OSK_ACTION_PRINT_AND_CONTINUE || OSK_ON_RAW == OSK_ACTION_IGNORE
271 #define OSKP_RAW_ACTION() CSTD_NOP()
273 #error invalid value for OSK_ON_RAW
277 * @def OSKP_INFO_ACTION
278 * @brief (Private) Action associated to the @see OSK_PRINT_INFO event.
280 /* Configure the post display action */
281 #if OSK_ON_INFO == OSK_ACTION_PRINT_AND_BREAK
282 #define OSKP_INFO_ACTION OSKP_BREAKPOINT
283 #elif OSK_ON_INFO == OSK_ACTION_PRINT_AND_QUIT
284 #define OSKP_INFO_ACTION OSKP_QUIT
285 #elif OSK_ON_INFO == OSK_ACTION_PRINT_AND_TRACE
286 #define OSKP_INFO_ACTION OSKP_TRACE
287 #elif OSK_ON_INFO == OSK_ACTION_PRINT_AND_CONTINUE || OSK_ON_INFO == OSK_ACTION_IGNORE
288 #define OSKP_INFO_ACTION() CSTD_NOP()
290 #error invalid value for OSK_ON_INFO
294 * @def OSKP_ERROR_ACTION
295 * @brief (Private) Action associated to the @see OSK_PRINT_ERROR event.
297 /* Configure the post display action */
298 #if OSK_ON_ERROR == OSK_ACTION_PRINT_AND_BREAK
299 #define OSKP_ERROR_ACTION OSKP_BREAKPOINT
300 #elif OSK_ON_ERROR == OSK_ACTION_PRINT_AND_QUIT
301 #define OSKP_ERROR_ACTION OSKP_QUIT
302 #elif OSK_ON_ERROR == OSK_ACTION_PRINT_AND_TRACE
303 #define OSKP_ERROR_ACTION OSKP_TRACE
304 #elif OSK_ON_ERROR == OSK_ACTION_PRINT_AND_CONTINUE || OSK_ON_ERROR == OSK_ACTION_IGNORE
305 #define OSKP_ERROR_ACTION() CSTD_NOP()
307 #error invalid value for OSK_ON_ERROR
311 * @def OSKP_WARN_ACTION
312 * @brief (Private) Action associated to the @see OSK_PRINT_WARN event.
314 /* Configure the post display action */
315 #if OSK_ON_WARN == OSK_ACTION_PRINT_AND_BREAK
316 #define OSKP_WARN_ACTION OSKP_BREAKPOINT
317 #elif OSK_ON_WARN == OSK_ACTION_PRINT_AND_QUIT
318 #define OSKP_WARN_ACTION OSKP_QUIT
319 #elif OSK_ON_WARN == OSK_ACTION_PRINT_AND_TRACE
320 #define OSKP_WARN_ACTION OSKP_TRACE
321 #elif OSK_ON_WARN == OSK_ACTION_PRINT_AND_CONTINUE || OSK_ON_WARN == OSK_ACTION_IGNORE
322 #define OSKP_WARN_ACTION() CSTD_NOP()
324 #error invalid value for OSK_ON_WARN
328 * @def OSKP_PRINT_RAW(module, ...)
329 * @brief Prints given message
331 * The behavior of this function is defined by macro @see OSK_ON_RAW
334 * @code OSKP_PRINT_RAW(OSK_BASE_MEM, " %d blocks could not be allocated", mem_allocated); @endcode will print:
336 * "10 blocks could not be allocated"
338 * @param module Name of the module which prints the message.
339 * @param ... Format string followed by a varying number of parameters
341 #define OSKP_PRINT_RAW(module, ...)\
344 if(MALI_FALSE != OSKP_PRINT_IS_ALLOWED( (module), OSK_CHANNEL_RAW))\
346 OSKP_RAW_OUT(oskp_module_to_str( (module) ), \
347 OSKP_PRINT_TRACE, OSKP_PRINT_FUNCTION, __VA_ARGS__ );\
353 * @def OSKP_PRINT_INFO(module, ...)
354 * @brief Prints "MALI<INFO,module_name>: " followed by the given message.
356 * The behavior of this function is defined by the macro @see OSK_ON_INFO
359 * @code OSKP_PRINT_INFO(OSK_BASE_MEM, " %d blocks could not be allocated", mem_allocated); @endcode will print:
361 * "MALI<INFO,BASE_MEM>: 10 blocks could not be allocated"\n
363 * @param module Name of the module which prints the message.
364 * @param ... Format string followed by a varying number of parameters
366 #define OSKP_PRINT_INFO(module, ...)\
369 if(MALI_FALSE != OSKP_PRINT_IS_ALLOWED( (module), OSK_CHANNEL_INFO))\
371 OSKP_INFO_OUT(oskp_module_to_str( (module) ), \
372 OSKP_PRINT_TRACE, OSKP_PRINT_FUNCTION, __VA_ARGS__ );\
378 * @def OSKP_PRINT_WARN(module, ...)
379 * @brief Prints "MALI<WARN,module_name>: " followed by the given message.
381 * The behavior of this function is defined by the macro @see OSK_ON_WARN
384 * @code OSK_PRINT_WARN(OSK_BASE_MEM, " %d blocks could not be allocated", mem_allocated);@endcode will print: \n
385 * "MALI<WARN,BASE_MEM>: 10 blocks could not be allocated"\n
387 * @param module Name of the module which prints the message.
388 * @param ... Format string followed by a varying number of parameters
390 #define OSKP_PRINT_WARN(module, ...)\
393 if(MALI_FALSE != OSKP_PRINT_IS_ALLOWED( (module), OSK_CHANNEL_WARN))\
395 OSKP_WARN_OUT(oskp_module_to_str( (module) ), \
396 OSKP_PRINT_TRACE, OSKP_PRINT_FUNCTION, __VA_ARGS__ );\
402 * @def OSKP_PRINT_ERROR(module, ...)
403 * @brief Prints "MALI<ERROR,module_name>: " followed by the given message.
405 * The behavior of this function is defined by the macro @see OSK_ON_ERROR
408 * @code OSKP_PRINT_ERROR(OSK_BASE_MEM, " %d blocks could not be allocated", mem_allocated); @endcode will print:
410 * "MALI<ERROR,BASE_MEM>: 10 blocks could not be allocated"\n
412 * @param module Name of the module which prints the message.
413 * @param ... Format string followed by a varying number of parameters
415 #define OSKP_PRINT_ERROR(module, ...)\
418 if(MALI_FALSE != OSKP_PRINT_IS_ALLOWED( (module), OSK_CHANNEL_ERROR))\
420 OSKP_ERROR_OUT(oskp_module_to_str( (module) ), \
421 OSKP_PRINT_TRACE, OSKP_PRINT_FUNCTION, __VA_ARGS__ );\
423 OSKP_ERROR_ACTION();\
427 * @def OSKP_PRINT_TRACE
428 * @brief Private macro containing the format of the trace to display before every message
429 * @sa OSK_SKIP_TRACE, OSK_SKIP_FUNCTION_NAME
431 #if OSK_SKIP_TRACE == 0
432 #define OSKP_PRINT_TRACE \
433 "In file: " __FILE__ " line: " CSTD_STR2(__LINE__)
434 #if OSK_SKIP_FUNCTION_NAME == 0
435 #define OSKP_PRINT_FUNCTION CSTD_FUNC
437 #define OSKP_PRINT_FUNCTION ""
440 #define OSKP_PRINT_TRACE ""
444 * @def OSKP_PRINT_ALLOW(module, channel)
445 * @brief Allow the given module to print on the given channel
446 * @note If @see OSK_USE_RUNTIME_CONFIG is disabled then this macro doesn't do anything
447 * @param module is a @see osk_module
448 * @param channel is one of @see OSK_CHANNEL_INFO, @see OSK_CHANNEL_WARN, @see OSK_CHANNEL_ERROR,
449 * @see OSK_CHANNEL_ALL
450 * @return MALI_TRUE if the module is allowed to print on the channel.
453 * @def OSKP_PRINT_BLOCK(module, channel)
454 * @brief Prevent the given module from printing on the given channel
455 * @note If @see OSK_USE_RUNTIME_CONFIG is disabled then this macro doesn't do anything
456 * @param module is a @see osk_module
457 * @param channel is one of @see OSK_CHANNEL_INFO, @see OSK_CHANNEL_WARN, @see OSK_CHANNEL_ERROR,
458 * @see OSK_CHANNEL_ALL
459 * @return MALI_TRUE if the module is allowed to print on the channel.
461 #if OSK_USE_RUNTIME_CONFIG
462 #define OSKP_PRINT_ALLOW(module, channel) oskp_debug_print_allow( (module), (channel) )
463 #define OSKP_PRINT_BLOCK(module, channel) oskp_debug_print_block( (module), (channel) )
465 #define OSKP_PRINT_ALLOW(module, channel) CSTD_NOP()
466 #define OSKP_PRINT_BLOCK(module, channel) CSTD_NOP()
470 * @def OSKP_RAW_OUT(module, trace, ...)
471 * @brief (Private) system printing function associated to the @see OSK_PRINT_RAW event.
472 * @param module module ID
473 * @param trace location in the code from where the message is printed
474 * @param function function from where the message is printed
475 * @param ... Format string followed by format arguments.
477 /* Select the correct system output function*/
478 #if OSK_ON_RAW != OSK_ACTION_IGNORE
479 #define OSKP_RAW_OUT(module, trace, function, ...)\
482 OSKP_PRINT(__VA_ARGS__);\
483 OSKP_PRINT(OSK_STOP_MSG);\
486 #define OSKP_RAW_OUT(module, trace, function, ...) CSTD_NOP()
491 * @def OSKP_INFO_OUT(module, trace, ...)
492 * @brief (Private) system printing function associated to the @see OSK_PRINT_INFO event.
493 * @param module module ID
494 * @param trace location in the code from where the message is printed
495 * @param function function from where the message is printed
496 * @param ... Format string followed by format arguments.
498 /* Select the correct system output function*/
499 #if OSK_ON_INFO != OSK_ACTION_IGNORE
500 #define OSKP_INFO_OUT(module, trace, function, ...)\
503 /* Split up in several lines to prevent hitting max 128 chars limit of OSK print function */ \
504 OSKP_PRINT("Mali<INFO,%s>: ", module);\
505 OSKP_PRINT(__VA_ARGS__);\
506 OSKP_PRINT(OSK_STOP_MSG);\
509 #define OSKP_INFO_OUT(module, trace, function, ...) CSTD_NOP()
513 * @def OSKP_ASSERT_OUT(trace, function, ...)
514 * @brief (Private) system printing function associated to the @see OSKP_PRINT_ASSERT event.
515 * @param trace location in the code from where the message is printed
516 * @param function function from where the message is printed
517 * @param ... Format string followed by format arguments.
518 * @note function parameter cannot be concatenated with other strings
520 /* Select the correct system output function*/
521 #if OSK_ON_ASSERT != OSK_ACTION_IGNORE
522 #define OSKP_ASSERT_OUT(trace, function, ...)\
525 /* Split up in several lines to prevent hitting max 128 chars limit of OSK print function */ \
526 OSKP_PRINT("Mali<ASSERT>: %s function:%s ", trace, function);\
527 OSKP_PRINT(__VA_ARGS__);\
528 OSKP_PRINT(OSK_STOP_MSG);\
531 #define OSKP_ASSERT_OUT(trace, function, ...) CSTD_NOP()
535 * @def OSKP_WARN_OUT(module, trace, ...)
536 * @brief (Private) system printing function associated to the @see OSK_PRINT_WARN event.
537 * @param module module ID
538 * @param trace location in the code from where the message is printed
539 * @param function function from where the message is printed
540 * @param ... Format string followed by format arguments.
541 * @note function parameter cannot be concatenated with other strings
543 /* Select the correct system output function*/
544 #if OSK_ON_WARN != OSK_ACTION_IGNORE
545 #define OSKP_WARN_OUT(module, trace, function, ...)\
548 /* Split up in several lines to prevent hitting max 128 chars limit of OSK print function */ \
549 OSKP_PRINT("Mali<WARN,%s>: ", module);\
550 OSKP_PRINT(__VA_ARGS__);\
551 OSKP_PRINT(OSK_STOP_MSG);\
554 #define OSKP_WARN_OUT(module, trace, function, ...) CSTD_NOP()
558 * @def OSKP_ERROR_OUT(module, trace, ...)
559 * @brief (Private) system printing function associated to the @see OSK_PRINT_ERROR event.
560 * @param module module ID
561 * @param trace location in the code from where the message is printed
562 * @param function function from where the message is printed
563 * @param ... Format string followed by format arguments.
564 * @note function parameter cannot be concatenated with other strings
566 /* Select the correct system output function*/
567 #if OSK_ON_ERROR != OSK_ACTION_IGNORE
568 #define OSKP_ERROR_OUT(module, trace, function, ...)\
571 /* Split up in several lines to prevent hitting max 128 chars limit of OSK print function */ \
572 OSKP_PRINT("Mali<ERROR,%s>: ", module);\
573 OSKP_PRINT(__VA_ARGS__);\
574 OSKP_PRINT(OSK_STOP_MSG);\
577 #define OSKP_ERROR_OUT(module, trace, function, ...) CSTD_NOP()
581 * @def OSKP_PRINT_IS_ALLOWED(module, channel)
582 * @brief function or constant indicating if the given module is allowed to print on the given channel
583 * @note If @see OSK_USE_RUNTIME_CONFIG is disabled then this macro is set to MALI_TRUE to avoid any overhead
584 * @param module is a @see osk_module
585 * @param channel is one of @see OSK_CHANNEL_INFO, @see OSK_CHANNEL_WARN, @see OSK_CHANNEL_ERROR,
586 * @see OSK_CHANNEL_ALL
587 * @return MALI_TRUE if the module is allowed to print on the channel.
589 #if OSK_USE_RUNTIME_CONFIG
590 #define OSKP_PRINT_IS_ALLOWED(module, channel) oskp_is_allowed_to_print( (module), (channel) )
592 #define OSKP_PRINT_IS_ALLOWED(module, channel) MALI_TRUE
596 * @def OSKP_SIMULATE_FAILURE_IS_ENABLED(module, feature)
597 * @brief Macro that evaluates as true if the specified feature is enabled for the given module
598 * @note If @ref OSK_USE_RUNTIME_CONFIG is disabled then this macro always evaluates as true.
599 * @param[in] module is a @ref cdbg_module
600 * @param[in] channel is one of @see OSK_CHANNEL_INFO, @see OSK_CHANNEL_WARN, @see OSK_CHANNEL_ERROR,
601 * @return MALI_TRUE if the feature is enabled
603 #if OSK_USE_RUNTIME_CONFIG
604 #define OSKP_SIMULATE_FAILURE_IS_ENABLED(module, channel) oskp_is_allowed_to_simulate_failure( (module), (channel) )
606 #define OSKP_SIMULATE_FAILURE_IS_ENABLED(module, channel) MALI_TRUE
609 OSK_STATIC_INLINE void osk_debug_get_thread_info( u32 *thread_id, u32 *cpu_nr )
611 OSK_ASSERT( thread_id != NULL );
612 OSK_ASSERT( cpu_nr != NULL );
614 /* This implementation uses the PID as shown in ps listings.
615 * On 64-bit systems, this could narrow from signed 64-bit to unsigned 32-bit */
616 *thread_id = (u32)task_pid_nr(current);
618 /* On 64-bit systems, this could narrow from unsigned 64-bit to unsigned 32-bit */
619 *cpu_nr = (u32)task_cpu(current);
623 #endif /* _OSK_ARCH_DEBUG_H_ */