1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stdint.h>
6 #include "debug.h"
7 
8 #define UART_THR                    (0x0)   // TX Buffer Register (write-only)
9 #define UART_LSR                    (0x14)  // Line Status Register
10 #define UART_LSR_THRE               (1 << 5)
11 
12 #define UARTREG(reg) (*(volatile uint32_t*)(0x11005000 + (reg)))
13 
uart_pputc(char c)14 void uart_pputc(char c) {
15     while (!(UARTREG(UART_LSR) & UART_LSR_THRE))
16         ;
17     UARTREG(UART_THR) = c;
18 }
19