blob: de69f5c08efb9ea91d1ffdad6318bb3dcc69eaff [file] [log] [blame]
Ambroise Vincent4128f9f2019-02-11 13:34:41 +00001/*
2 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdio.h>
8
9#include <drivers/console.h>
10
11int putchar(int c)
12{
13 int res;
Mark Dykesf41d8ee2025-07-10 16:41:28 -050014#ifdef SMC_FUZZ_VARIABLE_COVERAGE
15 if(tftf_get_console_state() == CONSOLE_FLAG_SMC_FUZZER) {
16 if (console_putc_fuzzer((unsigned char)c) >= 0)
17 res = c;
18 else
19 res = EOF;
20 }
21 else {
22 if (console_putc((unsigned char)c) >= 0)
23 res = c;
24 else
25 res = EOF;
26 }
27#else
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000028 if (console_putc((unsigned char)c) >= 0)
29 res = c;
30 else
31 res = EOF;
Mark Dykesf41d8ee2025-07-10 16:41:28 -050032#endif
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000033 return res;
34}