summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c')
-rw-r--r--c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
index 6591cd88fd..a52c360f21 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
@@ -806,7 +806,7 @@ static void apbuart_cons_isr(void *arg)
struct apbuart_priv *uart = condev_get_priv(condev);
struct apbuart_regs *regs = uart->regs;
unsigned int status;
- char data;
+ char buf[33];
int cnt;
if (uart->mode == TERMIOS_TASK_DRIVEN) {
@@ -824,13 +824,22 @@ static void apbuart_cons_isr(void *arg)
rtems_termios_rxirq_occured(tty);
}
} else {
- /* Get all received characters */
- while ((status=regs->status) & APBUART_STATUS_DR) {
- /* Data has arrived, get new data */
- data = regs->data;
-
- /* Tell termios layer about new character */
- rtems_termios_enqueue_raw_characters(tty, &data, 1);
+ /*
+ * Get all new characters from APBUART RX (FIFO) and store them
+ * on the stack. Then tell termios about the new characters.
+ * Maximum APBUART RX FIFO size is 32 characters.
+ */
+ cnt = 0;
+ while (
+ ((status=regs->status) & APBUART_STATUS_DR) &&
+ (cnt < sizeof(buf))
+ ) {
+ buf[cnt] = regs->data;
+ cnt++;
+ }
+ if (0 < cnt) {
+ /* Tell termios layer about new characters */
+ rtems_termios_enqueue_raw_characters(tty, &buf[0], cnt);
}
}