]> rtime.felk.cvut.cz Git - arc.git/blob - include/Ramlog.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / Ramlog.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 #ifndef RAMLOG_H_\r
17 #define RAMLOG_H_\r
18 \r
19 #include <stdint.h>\r
20 #include "xtoa.h"\r
21 \r
22 #if !defined(USE_RAMLOG)\r
23 #define ramlog_str( _x)\r
24 #define ramlog_dec( _x)\r
25 #define ramlog_hex( _x)\r
26 \r
27 #else\r
28 \r
29 void ramlog_puts( char *str );\r
30 void ramlog_chr( char c );\r
31 \r
32 /*\r
33  * Fast ramlog functions\r
34  */\r
35 static inline void ramlog_str( char *str ) {\r
36   ramlog_puts(str);\r
37 }\r
38 \r
39 static inline void ramlog_dec( int val ) {\r
40   char str[10]; // include '-' and \0\r
41   ultoa(val,str,10);\r
42   ramlog_str(str);\r
43 }\r
44 \r
45 static inline void ramlog_hex( uint32_t val ) {\r
46   char str[10]; // include '-' and \0\r
47   ultoa(val,str,16);\r
48   ramlog_str(str);\r
49 }\r
50 #endif\r
51 \r
52 \r
53 /*\r
54  * var args ramlog functions\r
55  */\r
56 #if defined(USE_RAMLOG)\r
57 int ramlog_printf(const char *format, ...);\r
58 #else\r
59 #define ramlog_printf(format,...)\r
60 #endif\r
61 \r
62 #endif /* RAMLOG_H_ */\r
63 \r