common: Move serial functions out of common.h
[platform/kernel/u-boot.git] / common / kgdb_stubs.c
1 /*
2  * U-Boot - stub functions for common kgdb code,
3  *          can be overridden in board specific files
4  *
5  * Copyright 2009 Analog Devices Inc.
6  *
7  * Licensed under the GPL-2 or later.
8  */
9
10 #include <common.h>
11 #include <kgdb.h>
12 #include <serial.h>
13
14 int (*debugger_exception_handler)(struct pt_regs *);
15
16 __attribute__((weak))
17 void kgdb_serial_init(void)
18 {
19         puts("[on serial] ");
20 }
21
22 __attribute__((weak))
23 void putDebugChar(int c)
24 {
25         serial_putc(c);
26 }
27
28 __attribute__((weak))
29 void putDebugStr(const char *str)
30 {
31 #ifdef DEBUG
32         serial_puts(str);
33 #endif
34 }
35
36 __attribute__((weak))
37 int getDebugChar(void)
38 {
39         return serial_getc();
40 }
41
42 __attribute__((weak))
43 void kgdb_interruptible(int yes)
44 {
45         return;
46 }
47
48 __attribute__((weak))
49 void kgdb_flush_cache_range(void *from, void *to)
50 {
51         flush_cache((unsigned long)from, (unsigned long)(to - from));
52 }
53
54 __attribute__((weak))
55 void kgdb_flush_cache_all(void)
56 {
57         if (dcache_status()) {
58                 dcache_disable();
59                 dcache_enable();
60         }
61         if (icache_status()) {
62                 icache_disable();
63                 icache_enable();
64         }
65 }