xref: /rk3399_ARM-atf/tools/encrypt_fw/include/debug.h (revision 091576e7f1fa0ca7360732d290a28ff2dc2a16e6)
1*90aa901fSSumit Garg /*
2*90aa901fSSumit Garg  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3*90aa901fSSumit Garg  *
4*90aa901fSSumit Garg  * SPDX-License-Identifier: BSD-3-Clause
5*90aa901fSSumit Garg  */
6*90aa901fSSumit Garg 
7*90aa901fSSumit Garg #ifndef DEBUG_H
8*90aa901fSSumit Garg #define DEBUG_H
9*90aa901fSSumit Garg 
10*90aa901fSSumit Garg #include <stdio.h>
11*90aa901fSSumit Garg 
12*90aa901fSSumit Garg /* The log output macros print output to the console. These macros produce
13*90aa901fSSumit Garg  * compiled log output only if the LOG_LEVEL defined in the makefile (or the
14*90aa901fSSumit Garg  * make command line) is greater or equal than the level required for that
15*90aa901fSSumit Garg  * type of log output.
16*90aa901fSSumit Garg  * The format expected is the same as for printf(). For example:
17*90aa901fSSumit Garg  * INFO("Info %s.\n", "message")    -> INFO:    Info message.
18*90aa901fSSumit Garg  * WARN("Warning %s.\n", "message") -> WARNING: Warning message.
19*90aa901fSSumit Garg  */
20*90aa901fSSumit Garg 
21*90aa901fSSumit Garg #define LOG_LEVEL_NONE			0
22*90aa901fSSumit Garg #define LOG_LEVEL_ERROR			10
23*90aa901fSSumit Garg #define LOG_LEVEL_NOTICE		20
24*90aa901fSSumit Garg #define LOG_LEVEL_WARNING		30
25*90aa901fSSumit Garg #define LOG_LEVEL_INFO			40
26*90aa901fSSumit Garg #define LOG_LEVEL_VERBOSE		50
27*90aa901fSSumit Garg 
28*90aa901fSSumit Garg 
29*90aa901fSSumit Garg #if LOG_LEVEL >= LOG_LEVEL_NOTICE
30*90aa901fSSumit Garg # define NOTICE(...)	printf("NOTICE:  " __VA_ARGS__)
31*90aa901fSSumit Garg #else
32*90aa901fSSumit Garg # define NOTICE(...)
33*90aa901fSSumit Garg #endif
34*90aa901fSSumit Garg 
35*90aa901fSSumit Garg #if LOG_LEVEL >= LOG_LEVEL_ERROR
36*90aa901fSSumit Garg # define ERROR(...)	printf("ERROR:   " __VA_ARGS__)
37*90aa901fSSumit Garg #else
38*90aa901fSSumit Garg # define ERROR(...)
39*90aa901fSSumit Garg #endif
40*90aa901fSSumit Garg 
41*90aa901fSSumit Garg #if LOG_LEVEL >= LOG_LEVEL_WARNING
42*90aa901fSSumit Garg # define WARN(...)	printf("WARNING: " __VA_ARGS__)
43*90aa901fSSumit Garg #else
44*90aa901fSSumit Garg # define WARN(...)
45*90aa901fSSumit Garg #endif
46*90aa901fSSumit Garg 
47*90aa901fSSumit Garg #if LOG_LEVEL >= LOG_LEVEL_INFO
48*90aa901fSSumit Garg # define INFO(...)	printf("INFO:    " __VA_ARGS__)
49*90aa901fSSumit Garg #else
50*90aa901fSSumit Garg # define INFO(...)
51*90aa901fSSumit Garg #endif
52*90aa901fSSumit Garg 
53*90aa901fSSumit Garg #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
54*90aa901fSSumit Garg # define VERBOSE(...)	printf("VERBOSE: " __VA_ARGS__)
55*90aa901fSSumit Garg #else
56*90aa901fSSumit Garg # define VERBOSE(...)
57*90aa901fSSumit Garg #endif
58*90aa901fSSumit Garg 
59*90aa901fSSumit Garg #endif /* DEBUG_H */
60