1 /* 2 * Copyright 2007, François Revol, revol@free.fr. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. 6 * Distributed under the terms of the MIT License. 7 * 8 * Copyright 2001, Travis Geiselbrecht. All rights reserved. 9 * Distributed under the terms of the NewOS License. 10 */ 11 12 13 //#include <arch_platform.h> 14 #include <arch/debug_console.h> 15 #include <arch/generic/debug_uart_8250.h> 16 #include <arch/arm/arch_uart_pl011.h> 17 #include <boot/kernel_args.h> 18 #include <kernel.h> 19 #include <vm/vm.h> 20 #include <string.h> 21 22 #include "board_config.h" 23 24 25 DebugUART *gArchDebugUART; 26 27 28 void 29 arch_debug_remove_interrupt_handler(uint32 line) 30 { 31 } 32 33 34 void 35 arch_debug_install_interrupt_handlers(void) 36 { 37 } 38 39 40 int 41 arch_debug_blue_screen_try_getchar(void) 42 { 43 // TODO: Implement correctly! 44 return arch_debug_blue_screen_getchar(); 45 } 46 47 48 char 49 arch_debug_blue_screen_getchar(void) 50 { 51 return arch_debug_serial_getchar(); 52 } 53 54 55 int 56 arch_debug_serial_try_getchar(void) 57 { 58 // TODO: Implement correctly! 59 return arch_debug_serial_getchar(); 60 } 61 62 63 char 64 arch_debug_serial_getchar(void) 65 { 66 return gArchDebugUART->GetChar(false); 67 } 68 69 70 void 71 arch_debug_serial_putchar(const char c) 72 { 73 gArchDebugUART->PutChar(c); 74 } 75 76 77 void 78 arch_debug_serial_puts(const char *s) 79 { 80 while (*s != '\0') { 81 arch_debug_serial_putchar(*s); 82 s++; 83 } 84 } 85 86 87 void 88 arch_debug_serial_early_boot_message(const char *string) 89 { 90 // this function will only be called in fatal situations 91 arch_debug_serial_puts(string); 92 } 93 94 95 status_t 96 arch_debug_console_init(kernel_args *args) 97 { 98 #if defined(BOARD_UART_AMBA_PL011) 99 gArchDebugUART = arch_get_uart_pl011(BOARD_UART_DEBUG, BOARD_UART_CLOCK); 100 #else 101 // More Generic 8250 102 gArchDebugUART = arch_get_uart_8250(BOARD_UART_DEBUG, BOARD_UART_CLOCK); 103 #endif 104 105 gArchDebugUART->InitEarly(); 106 107 return B_OK; 108 } 109 110 111 status_t 112 arch_debug_console_init_settings(kernel_args *args) 113 { 114 return B_OK; 115 } 116