Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 Travis Geiselbrecht |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <stdarg.h> |
| 24 | #include <reg.h> |
| 25 | #include <debug.h> |
| 26 | #include <printf.h> |
| 27 | #include <kernel/thread.h> |
| 28 | #include <platform/debug.h> |
| 29 | #include <arch/ops.h> |
| 30 | #include <dev/uart.h> |
| 31 | #include <target/debugconfig.h> |
| 32 | |
Travis Geiselbrecht | eb94605 | 2008-09-07 22:32:49 -0700 | [diff] [blame] | 33 | void _dputc(char c) |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 34 | { |
| 35 | if (c == '\n') |
| 36 | uart_putc(DEBUG_UART, '\r'); |
| 37 | uart_putc(DEBUG_UART, c); |
| 38 | } |
| 39 | |
Travis Geiselbrecht | dbc2c68 | 2009-06-28 12:18:39 -0700 | [diff] [blame] | 40 | int dgetc(char *c, bool wait) |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 41 | { |
| 42 | int _c; |
| 43 | |
| 44 | if ((_c = uart_getc(DEBUG_UART, false)) < 0) |
| 45 | return -1; |
| 46 | |
| 47 | *c = _c; |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | void debug_dump_regs(void) |
| 52 | { |
| 53 | PANIC_UNIMPLEMENTED; |
| 54 | } |
| 55 | |
Travis Geiselbrecht | eb94605 | 2008-09-07 22:32:49 -0700 | [diff] [blame] | 56 | void platform_halt(void) |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 57 | { |
Travis Geiselbrecht | eb94605 | 2008-09-07 22:32:49 -0700 | [diff] [blame] | 58 | dprintf(ALWAYS, "HALT: spinning forever...\n"); |
Travis Geiselbrecht | 1d0df69 | 2008-09-01 02:26:09 -0700 | [diff] [blame] | 59 | for(;;); |
| 60 | } |
| 61 | |
| 62 | void debug_dump_memory_bytes(void *mem, int len) |
| 63 | { |
| 64 | PANIC_UNIMPLEMENTED; |
| 65 | } |
| 66 | |
| 67 | void debug_dump_memory_halfwords(void *mem, int len) |
| 68 | { |
| 69 | PANIC_UNIMPLEMENTED; |
| 70 | } |
| 71 | |
| 72 | void debug_dump_memory_words(void *mem, int len) |
| 73 | { |
| 74 | PANIC_UNIMPLEMENTED; |
| 75 | } |
| 76 | |
| 77 | void debug_set_trace_level(int trace_type, int level) |
| 78 | { |
| 79 | PANIC_UNIMPLEMENTED; |
| 80 | } |
| 81 | |