diff options
| author | Prashanth Mundkur | 2018-10-02 12:02:00 -0700 |
|---|---|---|
| committer | Prashanth Mundkur | 2018-10-23 15:32:15 -0700 |
| commit | 2a511449bcd694a5a8e2d16fb65262c914861ba3 (patch) | |
| tree | ab1c1e0d45cad5937b339773cf723320766ca9b3 /riscv/riscv_platform_impl.c | |
| parent | 8525e0b26eaec05c2c031279693cd61c544fc12a (diff) | |
RISC-V: implement terminal output for C platform.
Diffstat (limited to 'riscv/riscv_platform_impl.c')
| -rw-r--r-- | riscv/riscv_platform_impl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/riscv/riscv_platform_impl.c b/riscv/riscv_platform_impl.c index 3135895d..d8d52da0 100644 --- a/riscv/riscv_platform_impl.c +++ b/riscv/riscv_platform_impl.c @@ -1,4 +1,6 @@ #include "riscv_platform_impl.h" +#include <unistd.h> +#include <stdio.h> /* Settings of the platform implementation, with common defaults. */ @@ -16,3 +18,11 @@ uint64_t rv_clint_size = UINT64_C(0xc0000); uint64_t rv_htif_tohost = UINT64_C(0x80001000); uint64_t rv_insns_per_tick = UINT64_C(100); + +int term_fd = 1; // set during startup +void plat_term_write_impl(char c) +{ + if (write(term_fd, &c, sizeof(c)) < 0) { + fprintf(stderr, "Unable to write to terminal!\n"); + } +} |
