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 #define RL_LOGDB_ARG0(x)
73 #define RL_LOGDB_ARG1(x,y)
74 #define RL_LOGDB_ARG2(x,y,z)
75 #else
76 #define RL_LOGV_ARG0(x) {\
77  /* get the logging function pointer as per requested Level */\
78  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
79  /* check for NULL Pointer */\
80  if(fPtr != NULL)\
81  {\
82  /* log the data with function name, line no and passed arg */\
83  fPtr("[VER ] %s:%d::" x, __FUNCTION__, __LINE__);\
84  }\
85  }
86 
87 #define RL_LOGV_ARG1(x,y) {\
88  /* get the logging function pointer as per requested Level */\
89  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
90  /* check for NULL Pointer */\
91  if(fPtr != NULL)\
92  {\
93  /* log the data with function name, line no and passed arg */\
94  (void)fPtr("[MMW_VER ] %s:%d::" x,\
95  __FUNCTION__, __LINE__, (y));\
96  }\
97  }
98 
99 #define RL_LOGV_ARG2(x,y,z) {\
100  /* get the logging function pointer as per requested Level */\
101  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
102  /* check for NULL Pointer */\
103  if(fPtr != NULL)\
104  {\
105  /* log the data with function name, line no and passed arg */\
106  (void)fPtr("[MMW_VER ] %s:%d::" x,\
107  __FUNCTION__, __LINE__, (y), (z));\
108  }\
109  }
110 
111 #define RL_LOGV_ARG3(w,x,y,z) {\
112  /* get the logging function pointer as per requested Level */\
113  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_VERBOSE);\
114  /* check for NULL Pointer */\
115  if(fPtr != NULL)\
116  {\
117  /* log the data with function name, line no and passed arg */\
118  (void)fPtr("[MMW_VER ] %s:%d::" w,\
119  __FUNCTION__, __LINE__, (x), (y), (z));\
120  }\
121  }
122 
123 #define RL_LOGD_ARG0(x) {\
124  /* get the logging function pointer as per requested Level */\
125  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DEBUG);\
126  /* check for NULL Pointer */\
127  if(fPtr != NULL)\
128  {\
129  /* log the data with function name, line no and passed arg */\
130  (void)fPtr("[DBG ] %s:%d::" x, __FUNCTION__, __LINE__);\
131  }\
132  }
133 
134 #define RL_LOGD_ARG1(x,y) {\
135  /* get the logging function pointer as per requested Level */\
136  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DEBUG);\
137  /* check for NULL Pointer */\
138  if(fPtr != NULL)\
139  {\
140  /* log the data with function name, line no and passed arg */\
141  (void)fPtr("[DBG ] %s:%d::" x,\
142  __FUNCTION__, __LINE__, (y));\
143  }\
144  }
145 
146 #define RL_LOGI_ARG0(x) {\
147  /* get the logging function pointer as per requested Level */\
148  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_INFO);\
149  /* check for NULL Pointer */\
150  if(fPtr != NULL)\
151  {\
152  /* log the data with function name, line no and passed arg */\
153  (void)fPtr("[INFO] %s:%d::" x,\
154  __FUNCTION__, __LINE__);\
155  }\
156  }
157 
158 #define RL_LOGI_ARG1(x,y) {\
159  /* get the logging function pointer as per requested Level */\
160  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_INFO);\
161  /* check for NULL Pointer */\
162  if(fPtr != NULL)\
163  {\
164  /* log the data with function name, line no and passed arg */\
165  (void)fPtr("[INFO] %s:%d::" x,\
166  __FUNCTION__, __LINE__, (y));\
167  }\
168  }
169 
170 #define RL_LOGW_ARG0(x) {\
171  /* get the logging function pointer as per requested Level */\
172  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_WARNING);\
173  /* check for NULL Pointer */\
174  if(fPtr != NULL)\
175  {\
176  /* log the data with function name, line no and passed arg */\
177  (void)fPtr("[WARN] %s:%d::", x, __FUNCTION__, __LINE__);\
178  }\
179  }
180 
181 #define RL_LOGW_ARG1(x,y) {\
182  /* get the logging function pointer as per requested Level */\
183  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_WARNING);\
184  /* check for NULL Pointer */\
185  if(fPtr != NULL)\
186  {\
187  /* log the data with function name, line no and passed arg */\
188  (void)fPtr("[WARN] %s:%d::" x,\
189  __FUNCTION__, __LINE__, (y));\
190  }\
191  }
192 
193 #define RL_LOGE_ARG0(x) {\
194  /* get the logging function pointer as per requested Level */\
195  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
196  /* check for NULL Pointer */\
197  if(fPtr != NULL)\
198  {\
199  /* log the data with function name, line no and passed arg */\
200  (void)fPtr("[ERR ] %s:%d::" x,\
201  __FUNCTION__, __LINE__);\
202  }\
203  }
204 
205 #define RL_LOGE_ARG1(x,y) {\
206  /* get the logging function pointer as per requested Level */\
207  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
208  /* check for NULL Pointer */\
209  if(fPtr != NULL)\
210  {\
211  /* log the data with function name, line no and passed arg */\
212  (void)fPtr("[ERR ] %s:%d::" x,\
213  __FUNCTION__, __LINE__, (y));\
214  }\
215  }
216 
217 #define RL_LOGE_ARG2(x,y,z) {\
218  /* get the logging function pointer as per requested Level */\
219  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_ERROR);\
220  /* check for NULL Pointer */\
221  if(fPtr != NULL)\
222  {\
223  /* log the data with function name, line no and passed arg */\
224  (void)fPtr("[ERR ] %s:%d::" x,\
225  __FUNCTION__, __LINE__, (y), (z));\
226  }\
227  }
228 
229 #define RL_LOGDB_ARG0(x) {\
230  /* get the logging function pointer as per requested Level */\
231  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DATABYTE);\
232  /* check for NULL Pointer */\
233  if(fPtr != NULL)\
234  {\
235  /* log the data with function name, line no and passed arg */\
236  (void)fPtr("[SPI ] %s:%d::" x,\
237  __FUNCTION__, __LINE__);\
238  }\
239  }
240 
241 #define RL_LOGDB_ARG1(x,y) {\
242  /* get the logging function pointer as per requested Level */\
243  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DATABYTE);\
244  /* check for NULL Pointer */\
245  if(fPtr != NULL)\
246  {\
247  /* log the data with function name, line no and passed arg */\
248  (void)fPtr("[SPI ] %s:%d::" x,\
249  __FUNCTION__, __LINE__, (y));\
250  }\
251  }
252 
253 #define RL_LOGDB_ARG2(x,y,z) {\
254  /* get the logging function pointer as per requested Level */\
255  rlPrintFptr fPtr = rlGetLogFptr(RL_DBG_LEVEL_DATABYTE);\
256  /* check for NULL Pointer */\
257  if(fPtr != NULL)\
258  {\
259  /* log the data with function name, line no and passed arg */\
260  (void)fPtr("[SPI ] %s:%d::" x,\
261  __FUNCTION__, __LINE__, (y), (z));\
262  }\
263  }
264 
265 #endif
266 
267 /* Debug fuunction */
268 rlPrintFptr rlGetLogFptr(rlUInt8_t dbgLevel);
269 rlReturnVal_t rlLogInit(void);
270 
271 
272 #ifdef __cplusplus
273 }
274 #endif
275 
276 #endif
277 /*
278  * END OF rl_trace.h
279  */
280 

Copyright 2020, Texas Instruments Incorporated