xx
This commit is contained in:
parent
6eae1be755
commit
efecbee7c0
2 changed files with 8 additions and 3 deletions
1
defs.h
1
defs.h
|
@ -174,6 +174,7 @@ void usertrapret(void);
|
||||||
void uartinit(void);
|
void uartinit(void);
|
||||||
void uartintr(void);
|
void uartintr(void);
|
||||||
void uartputc(int);
|
void uartputc(int);
|
||||||
|
int uartgetc(void);
|
||||||
|
|
||||||
// vm.c
|
// vm.c
|
||||||
void kvminit(void);
|
void kvminit(void);
|
||||||
|
|
10
uart.c
10
uart.c
|
@ -49,11 +49,15 @@ uartputc(int c)
|
||||||
*R(0) = c;
|
*R(0) = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
int
|
||||||
uartgetc(void)
|
uartgetc(void)
|
||||||
{
|
{
|
||||||
// XXX this isn't right, must check there's data in the FIFO.
|
if(*(5) & 0x01){
|
||||||
return *R(0);
|
// input data is ready.
|
||||||
|
return *R(0);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue