summaryrefslogtreecommitdiff
path: root/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'uart.c')
-rw-r--r--uart.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/uart.c b/uart.c
index 56e1cc7..cf2615e 100644
--- a/uart.c
+++ b/uart.c
@@ -46,8 +46,17 @@ uart_charav(int offset)
int
uart_getchar(int offset)
{
- while (!uart_charav(offset))
- continue;
+ /* If interrupts are enabled, use wtint assuming that either the
+ device itself will wake us, or that a clock interrupt will. */
+ if ((rdps() & 7) == 0) {
+ while (!uart_charav(offset)) {
+ wtint(0);
+ }
+ } else {
+ while (!uart_charav(offset))
+ continue;
+ }
+
return inb(com2Rbr + offset);
}