blob: f0034ba06a5f0df4feba03e60fc4ec91db96515a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* debug_ll.h
*
* written by Marc Singer
* 12 Feb 2005
*
* Copyright (C) 2005 Marc Singer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __INCLUDE_DEBUG_LL_H__
#define __INCLUDE_DEBUG_LL_H__
#if defined (CONFIG_DEBUG_LL)
/*
* mach/debug_ll.h should implement PUTC_LL. This can be a macro or a static
* inline function. Note that several SoCs expect the UART to be initialized
* by a debugger or a first stage bootloader. You won't see anything without
* this initialization. Depending on the PUTC_LL implementation the board might
* also hang in PUTC_LL without proper initialization.
*/
# include <mach/debug_ll.h>
# define PUTHEX_LL(value) ({ unsigned long v = (unsigned long) (value); \
int i; unsigned char ch; \
for (i = 8; i--; ) {\
ch = ((v >> (i*4)) & 0xf);\
ch += (ch >= 10) ? 'a' - 10 : '0';\
PUTC_LL (ch); }})
/*
* Be careful with PUTS_LL, it only works if the binary is running at the
* link address which often is not the case during early startup. If in doubt
* don't use it.
*/
static __inline__ void PUTS_LL(const char * str)
{
while (*str) {
if (*str == '\n') {
PUTC_LL('\r');
}
PUTC_LL(*str);
str++;
}
}
#else
# define PUTC_LL(c) do {} while (0)
# define PUTHEX_LL(v) do {} while (0)
# define PUTS_LL(c) do {} while (0)
#endif
#endif /* __INCLUDE_DEBUG_LL_H__ */
|