1/* 2 * Copyright 2014, General Dynamics C4 Systems 3 * 4 * This software may be distributed and modified according to the terms of 5 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 6 * See "LICENSE_GPLv2.txt" for details. 7 * 8 * @TAG(GD_GPL) 9 */ 10 11#include <config.h> 12#include <stdint.h> 13#include <util.h> 14#include <machine/io.h> 15#include <plat/machine/devices.h> 16 17#define UTHR 0x00 /* UART Transmit Holding Register */ 18#define ULSR 0x14 /* UART Line Status Register */ 19#define ULSR_THRE BIT(5) /* Transmit Holding Register Empty */ 20 21#define UART_REG(x) ((volatile uint32_t *)(UART0_PPTR + (x))) 22 23#if defined(CONFIG_PRINTING) || defined(CONFIG_DEBUG_BUILD) 24void 25putDebugChar(unsigned char c) 26{ 27 while ((*UART_REG(ULSR) & ULSR_THRE) == 0); 28 *UART_REG(UTHR) = c; 29} 30#endif 31 32#ifdef CONFIG_DEBUG_BUILD 33unsigned char 34getDebugChar(void) 35{ 36 return 0; 37} 38#endif 39