blob: 76218874495704f651d15d535d233e7faf2f7cdd [file] [log] [blame]
developer5698c9c2022-05-30 16:40:23 +08001/* Copyright (C) 2021-2022 Mediatek Inc. */
2#ifndef __ATENL_DEBUG_H
3#define __ATENL_DEBUG_H
4
5/* #define CONFIG_ATENL_DEBUG 1 */
6/* #define CONFIG_ATENL_DEBUG_VERBOSE 1 */
7
8#define atenl_info(fmt, ...) (void)fprintf(stdout, fmt, ##__VA_ARGS__)
9#define atenl_err(fmt, ...) (void)fprintf(stderr, fmt, ##__VA_ARGS__)
10#ifdef CONFIG_ATENL_DEBUG
11#define atenl_dbg(fmt, ...) atenl_info(fmt, ##__VA_ARGS__)
12#else
13#define atenl_dbg(fmt, ...)
14#endif
15
16static inline void
17atenl_dbg_print_data(const void *data, const char *func_name, u32 len)
18{
19#ifdef CONFIG_ATENL_DEBUG_VERBOSE
20 u32 *tmp = (u32 *)data;
21 int i;
22
23 for (i = 0; i < DIV_ROUND_UP(len, 4); i++)
24 atenl_dbg("%s: [%d] = 0x%08x\n", func_name, i, tmp[i]);
25#endif
26}
27
28/* #define debug_print(fmt, ...) \ */
29/* do { if (DEBUG) fprintf(stderr, fmt, __VA_ARGS__); } while (0) */
30
31#endif