rl_trace.h
1 /****************************************************************************************
2  * FileName : rl_trace.h
3  *
4  * Description : This file defines the datatypes.
5  *
6  ****************************************************************************************
7  * (C) Copyright 2014, Texas Instruments Incorporated. - TI web address www.ti.com
8  *---------------------------------------------------------------------------------------
9  *
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * Neither the name of Texas Instruments Incorporated nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 /****************************************************************************************
38  * FILE INCLUSION PROTECTION
39  ****************************************************************************************
40  */
41 #ifndef TRACE_H
42 #define TRACE_H
43 
44 /****************************************************************************************
45 * INCLUDE FILES
46 ****************************************************************************************
47 */
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53  /****************************************************************************************
54  * MACRO DEFINITIONS
55  ****************************************************************************************
56  */
57 
58 #if RL_DISABLE_LOGGING
59 #define RL_LOGV_ARG0(x)
60 #define RL_LOGV_ARG1(x,y)
61 #define RL_LOGV_ARG2(x,y,z)
62 #define RL_LOGV_ARG3(w,x,y,z)
63 #define RL_LOGD_ARG0(x)
64 #define RL_LOGD_ARG1(x,y)
65 #define RL_LOGI_ARG0(x)
66 #define RL_LOGI_ARG1(x,y)
67 #define RL_LOGW_ARG0(x)
68 #define RL_LOGW_ARG1(x,y)
69 #define RL_LOGE_ARG0(x)
70 #define RL_LOGE_ARG1(x,y)
71 #define RL_LOGE_ARG2(x,y,z)
72 #else
73 #define RL_LOGV_ARG0(x) {\
74  /* get the logging function pointer as per requested Level */\
75  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
76  /* check for NULL Pointer */\
77  if(fPtr != NULL)\
78  {\
79  /* log the data with function name, line no and passed arg */\
80  fPtr("[VER ] %s:%d::" x, __FUNCTION__, __LINE__);\
81  }\
82  }
83 
84 #define RL_LOGV_ARG1(x,y) {\
85  /* get the logging function pointer as per requested Level */\
86  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
87  /* check for NULL Pointer */\
88  if(fPtr != NULL)\
89  {\
90  /* log the data with function name, line no and passed arg */\
91  (void)fPtr("[MMW_VER ] %s:%d::" x,\
92  __FUNCTION__, __LINE__, (y));\
93  }\
94  }
95 
96 #define RL_LOGV_ARG2(x,y,z) {\
97  /* get the logging function pointer as per requested Level */\
98  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
99  /* check for NULL Pointer */\
100  if(fPtr != NULL)\
101  {\
102  /* log the data with function name, line no and passed arg */\
103  (void)fPtr("[MMW_VER ] %s:%d::" x,\
104  __FUNCTION__, __LINE__, (y), (z));\
105  }\
106  }
107 
108 #define RL_LOGV_ARG3(w,x,y,z) {\
109  /* get the logging function pointer as per requested Level */\
110  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
111  /* check for NULL Pointer */\
112  if(fPtr != NULL)\
113  {\
114  /* log the data with function name, line no and passed arg */\
115  (void)fPtr("[MMW_VER ] %s:%d::" w,\
116  __FUNCTION__, __LINE__, (x), (y), (z));\
117  }\
118  }
119 
120 #define RL_LOGD_ARG0(x) {\
121  /* get the logging function pointer as per requested Level */\
122  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DEBUG);\
123  /* check for NULL Pointer */\
124  if(fPtr != NULL)\
125  {\
126  /* log the data with function name, line no and passed arg */\
127  (void)fPtr("[DBG ] %s:%d::" x, __FUNCTION__, __LINE__);\
128  }\
129  }
130 
131 #define RL_LOGD_ARG1(x,y) {\
132  /* get the logging function pointer as per requested Level */\
133  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DEBUG);\
134  /* check for NULL Pointer */\
135  if(fPtr != NULL)\
136  {\
137  /* log the data with function name, line no and passed arg */\
138  (void)fPtr("[DBG ] %s:%d::" x,\
139  __FUNCTION__, __LINE__, (y));\
140  }\
141  }
142 
143 #define RL_LOGI_ARG0(x) {\
144  /* get the logging function pointer as per requested Level */\
145  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_INFO);\
146  /* check for NULL Pointer */\
147  if(fPtr != NULL)\
148  {\
149  /* log the data with function name, line no and passed arg */\
150  (void)fPtr("[INFO] %s:%d::" x,\
151  __FUNCTION__, __LINE__);\
152  }\
153  }
154 
155 #define RL_LOGI_ARG1(x,y) {\
156  /* get the logging function pointer as per requested Level */\
157  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_INFO);\
158  /* check for NULL Pointer */\
159  if(fPtr != NULL)\
160  {\
161  /* log the data with function name, line no and passed arg */\
162  (void)fPtr("[INFO] %s:%d::" x,\
163  __FUNCTION__, __LINE__, (y));\
164  }\
165  }
166 
167 #define RL_LOGW_ARG0(x) {\
168  /* get the logging function pointer as per requested Level */\
169  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_WARNING);\
170  /* check for NULL Pointer */\
171  if(fPtr != NULL)\
172  {\
173  /* log the data with function name, line no and passed arg */\
174  (void)fPtr("[WARN] %s:%d::", x, __FUNCTION__, __LINE__);\
175  }\
176  }
177 
178 #define RL_LOGW_ARG1(x,y) {\
179  /* get the logging function pointer as per requested Level */\
180  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_WARNING);\
181  /* check for NULL Pointer */\
182  if(fPtr != NULL)\
183  {\
184  /* log the data with function name, line no and passed arg */\
185  (void)fPtr("[WARN] %s:%d::" x,\
186  __FUNCTION__, __LINE__, (y));\
187  }\
188  }
189 
190 #define RL_LOGE_ARG0(x) {\
191  /* get the logging function pointer as per requested Level */\
192  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
193  /* check for NULL Pointer */\
194  if(fPtr != NULL)\
195  {\
196  /* log the data with function name, line no and passed arg */\
197  (void)fPtr("[ERR ] %s:%d::" x,\
198  __FUNCTION__, __LINE__);\
199  }\
200  }
201 
202 #define RL_LOGE_ARG1(x,y) {\
203  /* get the logging function pointer as per requested Level */\
204  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
205  /* check for NULL Pointer */\
206  if(fPtr != NULL)\
207  {\
208  /* log the data with function name, line no and passed arg */\
209  (void)fPtr("[ERR ] %s:%d::" x,\
210  __FUNCTION__, __LINE__, (y));\
211  }\
212  }
213 
214 #define RL_LOGE_ARG2(x,y,z) {\
215  /* get the logging function pointer as per requested Level */\
216  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
217  /* check for NULL Pointer */\
218  if(fPtr != NULL)\
219  {\
220  /* log the data with function name, line no and passed arg */\
221  (void)fPtr("[ERR ] %s:%d::" x,\
222  __FUNCTION__, __LINE__, (y), (z));\
223  }\
224  }
225 #endif
226 
227 
228 /* Debug fuunction */
229 rlPrintFptr rlGetLogFptr(rlUInt8_t dbgLevel);
230 rlReturnVal_t rlLogInit(void);
231 
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #endif
238 /*
239  * END OF rl_trace.h
240  */
241 

Copyright 2018, Texas Instruments Incorporated