1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
9 * @brief API for emulated serial teriminals
13 * @brief Write a character to the default output device
15 * Write a character to the default output device, which for most
16 * targets is the UART serial port.
18 * putc() does CR/LF mapping.
19 * putc_raw() does not.
21 * @param c The character to write to the terminal
22 * @return 0 on success, or -1 on failure.
24 int metal_tty_putc(int c);
27 * @brief Write a raw character to the default output device
29 * Write a character to the default output device, which for most
30 * targets is the UART serial port.
32 * putc() does CR/LF mapping.
33 * putc_raw() does not.
35 * @param c The character to write to the terminal
36 * @return 0 on success, or -1 on failure.
38 int metal_tty_putc_raw(int c);
41 * @brief Get a byte from the default output device
43 * The default output device, is typically the UART serial port.
45 * This call is non-blocking, if nothing is ready c==-1
46 * if something is ready, then c=[0x00 to 0xff] byte value.
48 * @return 0 on success, or -1 on failure.
50 int metal_tty_getc(int *c);