Front Haul Interface Library first seed code contribution
[o-du/phy.git] / fhi_lib / lib / src / xran_printf.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2019 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18
19
20 /**
21  * @brief Modules provide debug prints and utility functions
22  * @file xran_printf.h
23  * @ingroup group_source_xran
24  * @author Intel Corporation
25  **/
26
27 #ifndef XRAN_PRINTF_H
28 #define XRAN_PRINTF_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 #include <stdio.h>
34 #include <stdlib.h>
35
36 #define PRINTF_LOG_OK
37 #define PRINTF_INF_OK
38 #define PRINTF_ERR_OK
39 //#define PRINTF_DBG_OK
40
41 #ifndef WIN32
42 #ifdef PRINTF_LOG_OK
43 #define print_log(fmt, args...) printf("%s:" fmt "\n", __FUNCTION__, ## args)
44 #else  /* PRINTF_LOG_OK */
45 #define print_log(fmt, args...)
46 #endif  /* PRINTF_LOG_OK */
47 #else
48 #define print_log(fmt, ...) printf("%s:" fmt "\n", __FUNCTION__, __VA_ARGS__)
49 #endif
50
51 #ifndef WIN32
52 #ifdef PRINTF_DBG_OK
53 #define print_dbg(fmt, args...) printf("%s:[dbg] " fmt "\n", __FUNCTION__, ## args)
54 #else  /* PRINTF_LOG_OK */
55 #define print_dbg(fmt, args...)
56 #endif  /* PRINTF_LOG_OK */
57 #else
58 #define print_dbg(fmt, ...) printf("%s:[dbg] " fmt "\n", __FUNCTION__, __VA_ARGS__)
59 #endif
60
61 #ifndef WIN32
62 #ifdef PRINTF_ERR_OK
63 #define print_err(fmt, args...) printf("%s:[err] " fmt "\n", __FUNCTION__, ## args)
64 #else  /* PRINTF_LOG_OK */
65 #define print_err(fmt, args...)
66 #endif  /* PRINTF_LOG_OK */
67 #else
68 #define print_err(fmt, ...) printf("%s:[err] " fmt "\n", __FUNCTION__, __VA_ARGS__)
69 #endif
70
71 #ifndef WIN32
72 #ifdef PRINTF_INF_OK
73 #define print_inf               printf
74 #else  /* PRINTF_LOG_OK */
75 #define print_inf
76 #endif  /* PRINTF_LOG_OK */
77 #else
78 #define print_inf               printf
79 #endif
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #ifndef _IASSERT_
86 #define _IASSERT_
87
88 #ifdef _DEBUG
89 #define iAssert(p) if(!(p)){fprintf(stderr,\
90     "Assertion failed: %s, file %s, line %d, val %d\n",\
91     #p, __FILE__, __LINE__, p);exit(-1);}
92 #else /* _DEBUG */
93 #define iAssert(p)
94 #endif /* _DEBUG */
95
96 #ifndef PHY_APP
97 #ifndef _assert
98 #define _assert(x)
99 #endif
100 #endif
101
102 #endif /* _IASSERT_*/
103
104
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif // PHY_PRINTF_H