4 * Copyright (c) 2019 Linaro Ltd
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #ifndef SEMIHOST_CONSOLE_H
10 #define SEMIHOST_CONSOLE_H
15 * qemu_semihosting_console_read:
20 * Receive at least one character from debug console. As this call may
21 * block if no data is available we suspend the CPU and will re-execute the
22 * instruction when data is there. Therefore two conditions must be met:
24 * - CPUState is synchronized before calling this function
25 * - pc is only updated once the character is successfully returned
27 * Returns: number of characters read, OR cpu_loop_exit!
29 int qemu_semihosting_console_read(CPUState
*cs
, void *buf
, int len
);
32 * qemu_semihosting_console_write:
36 * Write len bytes from buf to the debug console.
38 * Returns: number of bytes written -- this should only ever be short
39 * on some sort of i/o error.
41 int qemu_semihosting_console_write(void *buf
, int len
);
44 * qemu_semihosting_console_block_until_ready:
47 * If no data is available we suspend the CPU and will re-execute the
48 * instruction when data is available.
50 void qemu_semihosting_console_block_until_ready(CPUState
*cs
);
53 * qemu_semihosting_console_ready:
55 * Return true if characters are available for read; does not block.
57 bool qemu_semihosting_console_ready(void);
59 #endif /* SEMIHOST_CONSOLE_H */