blob: f3d716923d313bd331e2c5a8fec7d712982b0c26 [file] [log] [blame]
Googler25e92cf2023-12-13 10:05:01 +00001/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 */
5
6#ifndef _OSD_LOG_H_
7#define _OSD_LOG_H_
8
9#include <common.h>
10
11#define OSD_LOG_TAG "[OSD]"
12
13#define OSD_LOG_LEVEL_NULL 0
14#define OSD_LOG_LEVEL_DEBUG 1
15#define OSD_LOG_LEVEL_DEBUG2 2
16#define OSD_LOG_LEVEL_DEBUG3 3
17
18extern unsigned int osd_log_level;
19
20#define osd_logl() \
21 printf(OSD_LOG_TAG "%s:%d\n", __func__, __LINE__)
22
23#define osd_logv(fmt, ...) \
24 printf(OSD_LOG_TAG "%s:%d " fmt, __func__, __LINE__, ##__VA_ARGS__)
25
26#define osd_logi(fmt, ...) \
27 printf(OSD_LOG_TAG fmt, ##__VA_ARGS__)
28
29#define osd_loge(fmt, ...) \
30 printf(OSD_LOG_TAG "ERR: " fmt, ##__VA_ARGS__)
31
32#define osd_logd(fmt, ...) \
33 do { \
34 if (osd_log_level >= OSD_LOG_LEVEL_DEBUG) { \
35 printf(OSD_LOG_TAG fmt, ##__VA_ARGS__); \
36 } \
37 } while (0)
38
39#define osd_logd2(fmt, ...) \
40 do { \
41 if (osd_log_level >= OSD_LOG_LEVEL_DEBUG2) { \
42 printf(OSD_LOG_TAG fmt, ##__VA_ARGS__); \
43 } \
44 } while (0)
45
46#define osd_logd3(fmt, ...) \
47 do { \
48 if (osd_log_level >= OSD_LOG_LEVEL_DEBUG3) { \
49 printf(OSD_LOG_TAG fmt, ##__VA_ARGS__); \
50 } \
51 } while (0)
52
53#endif