summaryrefslogtreecommitdiff
path: root/uart.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-06-04 10:43:45 -0400
committerRobert Morris <[email protected]>2019-06-04 10:43:45 -0400
commit0e131b226336808c135795f5b9d7defc5a58b2ae (patch)
tree226cf0c8f1043d99175aee8835baf570cdf662e6 /uart.c
parentb78894f34ebbceb23bcf36ff820fefb942b54ccf (diff)
downloadxv6-labs-0e131b226336808c135795f5b9d7defc5a58b2ae.tar.gz
xv6-labs-0e131b226336808c135795f5b9d7defc5a58b2ae.tar.bz2
xv6-labs-0e131b226336808c135795f5b9d7defc5a58b2ae.zip
fix a problem with end. make uartputc() wait until h/w is ready.
Diffstat (limited to 'uart.c')
-rw-r--r--uart.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/uart.c b/uart.c
index 29f6df4..35fac1b 100644
--- a/uart.c
+++ b/uart.c
@@ -46,6 +46,9 @@ uartinit(void)
void
uartputc(int c)
{
+ // wait for Transmit Holding Empty to be set in LSR.
+ while((*R(5) & (1 << 5)) == 0)
+ ;
*R(0) = c;
}