The unified diff between revisions [1dfe3b7e..] and [65df00aa..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'uart.c'
# # old_revision [1dfe3b7eee76f3c8aea3b33932857682ee17701c] # new_revision [65df00aa2705ce33fd74f4dd706d2879fe99b2b0] # # patch "uart.c" # from [07a014210246046a28c0b690de8dd6dd8af95e2d] # to [7c57b3658cbce3a90ff7773d9e4a0b1d626c68af] # ============================================================ --- uart.c 07a014210246046a28c0b690de8dd6dd8af95e2d +++ uart.c 7c57b3658cbce3a90ff7773d9e4a0b1d626c68af @@ -1,11 +1,10 @@ #include "uart.h" #include "types.h" #include "interrupt.h" +#include "event.h" #define UARTBASE 0xE000C000 -#define FP0XVAL (*((volatile unsigned int *) 0x3FFFC014)) - #define RBR 0x00 #define THR 0x00 #define DLL 0x00 @@ -114,6 +113,7 @@ void __attribute__((interrupt("IRQ"))) u } } uart_rxwrite = local_rxwrite; + event_set(EVENT_UART_INPUT); break; case 0x2: /* THRE interrupt */ @@ -172,14 +172,11 @@ void puthex(unsigned int n) { putstr(s+i); } -char getch(void) { - char c; +bool getch(char *c) { + if (uart_rxread == uart_rxwrite) + return FALSE; - while (uart_rxread == uart_rxwrite) { - FP0XVAL ^= 0x04000000; - } - - c = uart_rxbuf[uart_rxread]; + *c = uart_rxbuf[uart_rxread]; uart_rxread = (uart_rxread + 1) % UART_RXBUFSIZE; - return c; + return TRUE; }