Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 11 | int putchar(int c) |
| 12 | { |
| 13 | int res; |
Mark Dykes | f41d8ee | 2025-07-10 16:41:28 -0500 | [diff] [blame] | 14 | #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 Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 28 | if (console_putc((unsigned char)c) >= 0) |
| 29 | res = c; |
| 30 | else |
| 31 | res = EOF; |
Mark Dykes | f41d8ee | 2025-07-10 16:41:28 -0500 | [diff] [blame] | 32 | #endif |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 33 | return res; |
| 34 | } |