]> rtime.felk.cvut.cz Git - arc.git/blob - include/Trace.h
Initial ARM port
[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
26 #include "simple_printf.h"\r
27 /**\r
28  *\r
29  * NOTE!!!!\r
30  * Do not use this in a header file. Should be used in the *.c file like this.\r
31  *\r
32  * #define USE_TRACE\r
33  * #include "Trace.h"\r
34  *\r
35  * Macro's for debugging and tracing\r
36  *\r
37  * Define USE_DEBUG and DBG_LEVEL either globally( e.g. a makefile )\r
38  * or in a specific file.  The DBG_LEVEL macro controls the amount\r
39  * of detail you want in the debug printout.\r
40  * There are 3 levels:\r
41  * DEBUG_LOW    - Used mainly by drivers to get very detailed\r
42  * DEBUG_MEDIUM - Medium detail\r
43  * DEBUG_HIGH   - General init\r
44  *\r
45  * Example:\r
46  * #define DEBUG_LVL    DEBUG_HIGH\r
47  * DEBUG(DEBUG_HIGH,"Starting GPT");\r
48  *\r
49  * TRACE\r
50  *   TODO:\r
51  *\r
52  */\r
53 \r
54 #define DEBUG_LOW               1\r
55 #define DEBUG_MEDIUM    2\r
56 #define DEBUG_HIGH              3\r
57 \r
58 #ifndef DEBUG_LVL\r
59 #define DEBUG_LVL               2\r
60 #endif\r
61 \r
62 #define CH_ISR          0\r
63 #define CH_PROC         1\r
64 \r
65 #if defined(USE_DEBUG)\r
66 #define DEBUG(_level,...) \\r
67         do { \\r
68                 if(_level>=DEBUG_LVL) { \\r
69                         simple_printf (__VA_ARGS__); \\r
70                 }; \\r
71         } while(0);\r
72 \r
73 #else\r
74 #define DEBUG(_level,...)\r
75 #endif\r
76 \r
77 #if defined(USE_DEBUG)\r
78 #define dbg_printf(format,...) simple_printf(format,## __VA_ARGS__ )\r
79 #else\r
80 #define dbg_printf(format,...)\r
81 #endif\r
82 \r
83 \r
84 #endif /*RAMLOG_H_*/\r