]> rtime.felk.cvut.cz Git - arc.git/blob - include/Trace.h
67f1badff25ce7a243d2aaae94436b0970d67238
[arc.git] / include / Trace.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16
17
18
19
20
21
22
23 #ifndef TRACE_H_\r
24 #define TRACE_H_\r
25 \r
26 /**\r
27  *\r
28  * NOTE!!!!\r
29  * Do not use this in a header file. Should be used in the *.c file like this.\r
30  *\r
31  * #define USE_TRACE\r
32  * #include "Trace.h"\r
33  *\r
34  * Macro's for debugging and tracing\r
35  *\r
36  * Define USE_DEBUG and DBG_LEVEL either globally( e.g. a makefile )\r
37  * or in a specific file.  The DBG_LEVEL macro controls the amount\r
38  * of detail you want in the debug printout.\r
39  * There are 3 levels:\r
40  * DEBUG_LOW    - Used mainly by drivers to get very detailed\r
41  * DEBUG_MEDIUM - Medium detail\r
42  * DEBUG_HIGH   - General init\r
43  *\r
44  * Example:\r
45  * #define DEBUG_LVL    DEBUG_HIGH\r
46  * DEBUG(DEBUG_HIGH,"Starting GPT");\r
47  *\r
48  * TRACE\r
49  *   TODO:\r
50  *\r
51  */\r
52 \r
53 #define DEBUG_LOW               1\r
54 #define DEBUG_MEDIUM    2\r
55 #define DEBUG_HIGH              3\r
56 \r
57 #ifndef DEBUG_LVL\r
58 #define DEBUG_LVL               2\r
59 #endif\r
60 \r
61 extern int simple_printf(const char *format, ...);\r
62 \r
63 //#define USE_DEBUG\r
64 //#define USE_TRACE\r
65 \r
66 #define CH_ISR          0\r
67 #define CH_PROC         1\r
68 \r
69 #if defined(USE_DEBUG)\r
70 #define DEBUG(_level,...) \\r
71         do { \\r
72                 if(_level>=DEBUG_LVL) { \\r
73                         simple_printf (__VA_ARGS__); \\r
74                 }; \\r
75         } while(0);\r
76 \r
77 #else\r
78 #define DEBUG(_level,...)\r
79 #endif\r
80 \r
81 #if defined(USE_DEBUG)\r
82 #define dbg_printf(format,...) simple_printf(format,## __VA_ARGS__ )\r
83 #else\r
84 #define dbg_printf(format,...)\r
85 #endif\r
86 \r
87 \r
88 #endif /*RAMLOG_H_*/\r