My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sw_debug.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Header for Helper functions for debugging
25  *
26  */
27 
28 #ifndef __LIB_DEBUG_H__
29 #define __LIB_DEBUG_H__
30 
31 #include <sw_types.h>
32 
33 
34 #ifndef ARM_ARCH_ARMV7
35 #include <stdarg.h>
36 #endif
37 
38 #ifdef ARM_ARCH_ARMV7
39 
40 typedef char *va_list;
41 
42 #define ALIGNBND (sizeof (signed int) - 1)
43 #define bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
44 #define va_arg(ap, T) \
45  (*(T *)(((ap) += (bnd (T, ALIGNBND))) - (bnd (T,ALIGNBND))))
46 #define va_end(ap) (void) 0
47 #define va_start(ap, A) \
48  (void) ((ap) = (((char *) &(A)) + (bnd (A,ALIGNBND))))
49 
50 #endif
51 #define LINE_FEED 0xA
52 #define CARRIAGE_RETURN 0xD
53 #define PRINTABLE_START 0x20
54 #define PRINTABLE_END 0x7E
55 
56 #ifdef __CCODE__
57 
58 __attribute((noreturn)) void DIE_NOW(void * context, char* msg);
59 
60 /* output to serial */
69 u32 sw_printf(const char *fmt, ...);
70 
79 u32 sw_printk(const char *fmt, ...);
80 
90 u32 sw_vsprintf(char *buf, const char *fmt, va_list args);
91 
99 int printable_char(char c);
100 
107 void DIE_NOW(void* context, char* msg);
108 
109 
110 #endif /* __CODE__ */
111 
112 #endif
u32 sw_printk(const char *fmt,...)
Writes directly to device, with no permission check.
Definition: sw_debug.c:71
int printable_char(char c)
Checks for printable character.
Definition: sw_debug.c:337
u32 sw_vsprintf(char *buf, const char *fmt, va_list args)
Definition: sw_debug.c:101
void DIE_NOW(void *context, char *msg)
Prints the error message and goes on infinte loop.
Definition: sw_debug.c:356