1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13#include <config.h>
14#include <stdint.h>
15#include <util.h>
16#include <machine/io.h>
17#include <plat/machine/devices.h>
18
19#define UTHR        0x0
20#define ULSR        0x14
21#define ULSR_THRE   (1 << 5)
22
23#define UART_REG(x) ((volatile uint32_t *)(UARTA_PPTR + (x)))
24
25#if defined(CONFIG_DEBUG_BUILD) || defined(CONFIG_PRINTING)
26void
27putDebugChar(unsigned char c)
28{
29    while ((*UART_REG(ULSR) & ULSR_THRE) == 0);
30
31    *UART_REG(UTHR) = c;
32}
33#endif
34
35#ifdef CONFIG_DEBUG_BUILD
36unsigned char
37getDebugChar(void)
38{
39    return 0;
40}
41#endif
42
43