1/*
2 * Copyright 2016, 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        0x0
18#define ULSR        0x14
19#define ULSR_THRE   (1 << 5)
20
21#define UART_REG(x) ((volatile uint32_t *)(UARTD_PPTR + (x)))
22
23#if defined(CONFIG_DEBUG_BUILD) || defined(CONFIG_PRINTING)
24void
25putDebugChar(unsigned char c)
26{
27    while ((*UART_REG(ULSR) & ULSR_THRE) == 0);
28
29    *UART_REG(UTHR) = c;
30}
31#endif
32
33#ifdef CONFIG_DEBUG_BUILD
34unsigned char
35getDebugChar(void)
36{
37    return 0;
38}
39#endif
40