1 /*
2  * Copyright (c) 2025 Mykola Hohsadze
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #include <stdarg.h>
9 #include <lk/reg.h>
10 #include <kernel/thread.h>
11 #include <dev/uart.h>
12 #include <platform/debug.h>
13 #include <platform/fvp-base.h>
14 #include <target/debugconfig.h>
15 
16 /* DEBUG_UART must be defined to 0 */
17 #if !defined(DEBUG_UART) || DEBUG_UART != 0
18 #error define DEBUG_UART to 0
19 #endif
20 
platform_dputc(char c)21 void platform_dputc(char c) {
22     if (c == '\n')
23         uart_putc(DEBUG_UART, '\r');
24     uart_putc(DEBUG_UART, c);
25 }
26 
platform_dgetc(char * c,bool wait)27 int platform_dgetc(char *c, bool wait) {
28     int ret = uart_getc(DEBUG_UART, wait);
29     if (ret < 0) {
30         return ret;
31     }
32     *c = ret;
33     return 0;
34 }
35