summaryrefslogtreecommitdiff
path: root/platform/common
diff options
context:
space:
mode:
authorAtish Patra <[email protected]>2019-02-27 17:42:17 -0800
committerAnup Patel <[email protected]>2019-03-05 14:05:12 +0530
commit86cc9b8633bea3bc6fbda145424f871ea553af9e (patch)
treedd63e0eee35ed225059db03f36405842715792bb /platform/common
parent05602e2bf4812533adcb7acb1a67e43726c0e7bb (diff)
lib:platform: Fix sbi_getc return type.
As per the current SBI specification, sbi_getc should return an int instead of char. In case of FIFO is empty, return -1 as per the specification. Reported-by: Sergi Granell <[email protected]> Suggested-by:Thadeu Lima de Souza Cascardo <[email protected]> Signed-off-by: Atish Patra <[email protected]>
Diffstat (limited to 'platform/common')
-rw-r--r--platform/common/include/plat/serial/sifive-uart.h2
-rw-r--r--platform/common/include/plat/serial/uart8250.h2
-rw-r--r--platform/common/serial/sifive-uart.c4
-rw-r--r--platform/common/serial/uart8250.c4
4 files changed, 6 insertions, 6 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,