blob: afa7d6403a62dd80b4a80314607f96d3042ec0ad [file] [log] [blame]
Robin Getz0c909552009-12-21 18:40:42 -05001/*
Bin Menga1875592016-02-05 19:30:11 -08002 * U-Boot - stub functions for common kgdb code,
Robin Getz0c909552009-12-21 18:40:42 -05003 * 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>
Simon Glassb03e0512019-11-14 12:57:24 -070012#include <serial.h>
Robin Getz0c909552009-12-21 18:40:42 -050013
14int (*debugger_exception_handler)(struct pt_regs *);
15
16__attribute__((weak))
17void kgdb_serial_init(void)
18{
19 puts("[on serial] ");
20}
21
22__attribute__((weak))
23void putDebugChar(int c)
24{
25 serial_putc(c);
26}
27
28__attribute__((weak))
29void putDebugStr(const char *str)
30{
31#ifdef DEBUG
32 serial_puts(str);
33#endif
34}
35
36__attribute__((weak))
37int getDebugChar(void)
38{
39 return serial_getc();
40}
41
42__attribute__((weak))
43void kgdb_interruptible(int yes)
44{
45 return;
46}
47
48__attribute__((weak))
49void kgdb_flush_cache_range(void *from, void *to)
50{
51 flush_cache((unsigned long)from, (unsigned long)(to - from));
52}
53
54__attribute__((weak))
55void 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}