diff options
Diffstat (limited to 'platform')
| -rw-r--r-- | platform/common/include/plat/serial/sifive-uart.h | 2 | ||||
| -rw-r--r-- | platform/common/include/plat/serial/uart8250.h | 2 | ||||
| -rw-r--r-- | platform/common/serial/sifive-uart.c | 4 | ||||
| -rw-r--r-- | platform/common/serial/uart8250.c | 4 | ||||
| -rw-r--r-- | platform/kendryte/k210/platform.c | 2 | ||||
| -rw-r--r-- | platform/kendryte/k210/uarths.c | 4 | ||||
| -rw-r--r-- | platform/kendryte/k210/uarths.h | 2 | ||||
| -rw-r--r-- | platform/template/platform.c | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/platform/common/include/plat/serial/sifive-uart.h b/platform/common/include/plat/serial/sifive-uart.h index 2c4e7f3d..6a645951 100644 --- a/platform/common/include/plat/serial/sifive-uart.h +++ b/platform/common/include/plat/serial/sifive-uart.h @@ -14,7 +14,7 @@ void sifive_uart_putc(char ch); -char sifive_uart_getc(void); +int sifive_uart_getc(void); int sifive_uart_init(unsigned long base, u32 in_freq, u32 baudrate); diff --git a/platform/common/include/plat/serial/uart8250.h b/platform/common/include/plat/serial/uart8250.h index c1ffc0d7..3d58050a 100644 --- a/platform/common/include/plat/serial/uart8250.h +++ b/platform/common/include/plat/serial/uart8250.h @@ -14,7 +14,7 @@ void uart8250_putc(char ch); -char uart8250_getc(void); +int uart8250_getc(void); int uart8250_init(unsigned long base, u32 in_freq, u32 baudrate, diff --git a/platform/common/serial/sifive-uart.c b/platform/common/serial/sifive-uart.c index 2c0e1f1e..08cc485c 100644 --- a/platform/common/serial/sifive-uart.c +++ b/platform/common/serial/sifive-uart.c @@ -69,12 +69,12 @@ void sifive_uart_putc(char ch) set_reg(UART_REG_TXFIFO, ch); } -char sifive_uart_getc(void) +int sifive_uart_getc(void) { u32 ret = get_reg(UART_REG_RXFIFO); if (!(ret & UART_RXFIFO_EMPTY)) return ret & UART_RXFIFO_DATA; - return 0; + return -1; } int sifive_uart_init(unsigned long base, diff --git a/platform/common/serial/uart8250.c b/platform/common/serial/uart8250.c index 02eabbe0..ce0f4ca4 100644 --- a/platform/common/serial/uart8250.c +++ b/platform/common/serial/uart8250.c @@ -71,11 +71,11 @@ void uart8250_putc(char ch) set_reg(UART_THR_OFFSET, ch); } -char uart8250_getc(void) +int uart8250_getc(void) { if (get_reg(UART_LSR_OFFSET) & UART_LSR_DR) return get_reg(UART_RBR_OFFSET); - return 0; + return -1; } int uart8250_init(unsigned long base, diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index f1e19b79..104edccb 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -31,7 +31,7 @@ static void k210_console_putc(char c) uarths_putc(c); } -static char k210_console_getc(void) +static int k210_console_getc(void) { return uarths_getc(); } diff --git a/platform/kendryte/k210/uarths.c b/platform/kendryte/k210/uarths.c index f8f4974c..34fcf394 100644 --- a/platform/kendryte/k210/uarths.c +++ b/platform/kendryte/k210/uarths.c @@ -48,12 +48,12 @@ void uarths_putc(char c) uarths->txdata.data = (u8)c; } -char uarths_getc(void) +int uarths_getc(void) { struct uarths_rxdata rx = uarths->rxdata; if (rx.empty) - return '\0'; + return -1; return rx.data; } diff --git a/platform/kendryte/k210/uarths.h b/platform/kendryte/k210/uarths.h index dd0433cf..f247a63a 100644 --- a/platform/kendryte/k210/uarths.h +++ b/platform/kendryte/k210/uarths.h @@ -161,6 +161,6 @@ enum uarths_stopbit { void uarths_init(u32 baud_rate, enum uarths_stopbit stopbit); void uarths_putc(char c); -char uarths_getc(void); +int uarths_getc(void); #endif /* _K210_UARTHS_H_ */ diff --git a/platform/template/platform.c b/platform/template/platform.c index e7a70aa9..c14398f8 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -73,7 +73,7 @@ static void platform_console_putc(char ch) /* * Read a character from the platform console input. */ -static char platform_console_getc(void) +static int platform_console_getc(void) { return uart8250_getc(); } |
