1 /* 2 * Copyright (c) 2016 Eric Holland 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #include <stdarg.h> 9 #include <lk/reg.h> 10 #include <lk/debug.h> 11 #include <stdio.h> 12 #include <kernel/thread.h> 13 #include <dev/uart.h> 14 #include <arch/ops.h> 15 #include <arch/arm/cm.h> 16 #include <platform/debug.h> 17 #include <target/debugconfig.h> 18 19 nrf52_debug_early_init(void)20void nrf52_debug_early_init(void) { 21 uart_init_early(); 22 } 23 24 /* later in the init process */ nrf52_debug_init(void)25void nrf52_debug_init(void) { 26 uart_init(); 27 } 28 29 30 platform_dputc(char c)31void platform_dputc(char c) { 32 if (c == '\n') 33 uart_putc(DEBUG_UART, '\r'); 34 uart_putc(DEBUG_UART, c); 35 } 36 platform_dgetc(char * c,bool wait)37int platform_dgetc(char *c, bool wait) { 38 int ret = uart_getc(DEBUG_UART, wait); 39 if (ret == -1) 40 return -1; 41 *c = ret; 42 return 0; 43 } 44 45