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#if DEBUG_UART 9void uart_puts(const char* str) { 10 char ch; 11 while ((ch = *str++)) { 12 uart_pputc(ch); 13 } 14} 15 16void uart_print_hex(uint64_t value) { 17 const char digits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', 18 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; 19 for (int i = 60; i >= 0; i -= 4) { 20 uart_pputc(digits[(value >> i) & 0xf]); 21 } 22} 23 24#else 25 26void uart_puts(const char* str) { 27} 28 29void uart_print_hex(uint64_t value) { 30} 31 32#endif // DEBUG_UART 33