• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2010 Samsung Electronics S.LSI Co. LTD
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  * @file        SEC_OSAL_Log.h
20  * @brief
21  * @author      Yunji Kim (yunji.kim@samsung.com)
22  * @version     1.0
23  * @history
24  *   2010.7.15 : Create
25  *   2010.8.27 : Add trace function
26  */
27 
28 #ifndef SEC_OSAL_LOG
29 #define SEC_OSAL_LOG
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef SEC_LOG_OFF
36 #define SEC_LOG
37 #endif
38 
39 #ifndef SEC_LOG_TAG
40 #define SEC_LOG_TAG    "SEC_LOG"
41 #endif
42 
43 #ifdef SEC_TRACE_ON
44 #define SEC_TRACE
45 #endif
46 
47 typedef enum _LOG_LEVEL
48 {
49     SEC_LOG_TRACE,
50     SEC_LOG_WARNING,
51     SEC_LOG_ERROR
52 } SEC_LOG_LEVEL;
53 
54 #ifdef SEC_LOG
55 #define SEC_OSAL_Log(a, ...)    ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__))
56 #else
57 #define SEC_OSAL_Log(a, ...)                                                \
58     do {                                                                \
59         if (a == SEC_LOG_ERROR)                                     \
60             ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__)); \
61     } while (0)
62 #endif
63 
64 #ifdef SEC_TRACE
65 #define FunctionIn() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
66 #define FunctionOut() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
67 #else
68 #define FunctionIn() ((void *)0)
69 #define FunctionOut() ((void *)0)
70 #endif
71 
72 extern void _SEC_OSAL_Log(SEC_LOG_LEVEL logLevel, const char *tag, const char *msg, ...);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
79