1 /* 2 * Copyright (c) 2012 Travis Geiselbrecht 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 20 nrf51_debug_early_init(void)21void nrf51_debug_early_init(void) { 22 uart_init_early(); 23 } 24 25 /* later in the init process */ nrf51_debug_init(void)26void nrf51_debug_init(void) { 27 uart_init(); 28 } 29 30 31 platform_dputc(char c)32void platform_dputc(char c) { 33 if (c == '\n') 34 uart_putc(DEBUG_UART, '\r'); 35 uart_putc(DEBUG_UART, c); 36 } 37 platform_dgetc(char * c,bool wait)38int platform_dgetc(char *c, bool wait) { 39 int ret = uart_getc(DEBUG_UART, wait); 40 if (ret == -1) 41 return -1; 42 *c = ret; 43 return 0; 44 } 45 46