diff options
author | Andrew Waterman <andrew@sifive.com> | 2023-01-11 15:38:00 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2023-01-11 15:41:28 -0800 |
commit | 32cf5bb54a088385f8e27174c2caf4722cf7f0de (patch) | |
tree | 6abb4fefdd7388cb6e554f8b2fb3a9dc95b8158b /riscv/devices.h | |
parent | 9874c1767179250e25094ccc6757a5faad9d99d1 (diff) | |
download | spike-32cf5bb54a088385f8e27174c2caf4722cf7f0de.zip spike-32cf5bb54a088385f8e27174c2caf4722cf7f0de.tar.gz spike-32cf5bb54a088385f8e27174c2caf4722cf7f0de.tar.bz2 |
For NS16550 UART, poll stdin less often
On my Mac Mini, calling `poll()` on stdin takes around 10 us, and we
are invoking it every 20 us or so. Reduce the frequency of polling
by 16x when not actively receiving data, thereby reducing the fraction
of time spent in `poll()` to a trivial amount.
Diffstat (limited to 'riscv/devices.h')
-rw-r--r-- | riscv/devices.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/riscv/devices.h b/riscv/devices.h index 0030da8..040fe3e 100644 --- a/riscv/devices.h +++ b/riscv/devices.h @@ -148,6 +148,9 @@ class ns16550_t : public abstract_device_t { void update_interrupt(void); uint8_t rx_byte(void); void tx_byte(uint8_t val); + + int backoff_counter; + static const int MAX_BACKOFF = 16; }; class mmio_plugin_device_t : public abstract_device_t { |