diff options
author | Robert Morris <[email protected]> | 2019-06-03 17:59:17 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-06-03 17:59:17 -0400 |
commit | cefe223bf5e4b68e5c1202f2f089a164ad656621 (patch) | |
tree | b2bf9fdb2c94e3159ce595c6b4a88daf5c35e878 /uart.c | |
parent | efecbee7c0c265b0b2fe956f308e1a73cc63eda6 (diff) | |
download | xv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.tar.gz xv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.tar.bz2 xv6-labs-cefe223bf5e4b68e5c1202f2f089a164ad656621.zip |
console input and sbrk
Diffstat (limited to 'uart.c')
-rw-r--r-- | uart.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -52,17 +52,21 @@ uartputc(int c) int uartgetc(void) { - if(*(5) & 0x01){ + if(*R(5) & 0x01){ // input data is ready. return *R(0); } else { return -1; - }; + } } void uartintr(void) { - int c = uartgetc(); - printf("%x ", c & 0xff); + while(1){ + int c = uartgetc(); + if(c == -1) + break; + consoleintr(c); + } } |