[rtems commit] bsp/riscv: Use interrupt driven NS16550 driver
Sebastian Huber
sebh at rtems.org
Wed Jul 25 08:12:44 UTC 2018
Module: rtems
Branch: master
Commit: 581a0f8866401ab057f1b827c7b02c93e8f43fad
Changeset: http://git.rtems.org/rtems/commit/?id=581a0f8866401ab057f1b827c7b02c93e8f43fad
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jul 24 14:47:05 2018 +0200
bsp/riscv: Use interrupt driven NS16550 driver
Update #3433.
---
bsps/include/bsp/fatal.h | 3 ++-
bsps/riscv/riscv/console/console-config.c | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bsps/include/bsp/fatal.h b/bsps/include/bsp/fatal.h
index f9eca33..fae5461 100644
--- a/bsps/include/bsp/fatal.h
+++ b/bsps/include/bsp/fatal.h
@@ -151,7 +151,8 @@ typedef enum {
RISCV_FATAL_NO_PLIC_REG_IN_DEVICE_TREE,
RISCV_FATAL_INVALID_PLIC_NDEV_IN_DEVICE_TREE,
RISCV_FATAL_TOO_LARGE_PLIC_NDEV_IN_DEVICE_TREE,
- RISCV_FATAL_INVALID_INTERRUPT_AFFINITY
+ RISCV_FATAL_INVALID_INTERRUPT_AFFINITY,
+ RISCV_FATAL_NO_NS16550_INTERRUPTS_IN_DEVICE_TREE
} bsp_fatal_code;
RTEMS_NO_RETURN static inline void
diff --git a/bsps/riscv/riscv/console/console-config.c b/bsps/riscv/riscv/console/console-config.c
index 270646f..ceb6b785 100644
--- a/bsps/riscv/riscv/console/console-config.c
+++ b/bsps/riscv/riscv/console/console-config.c
@@ -133,6 +133,14 @@ static void riscv_console_probe(void)
ctx->clock = fdt32_to_cpu(val[0]);
+ val = (fdt32_t *) fdt_getprop(fdt, node, "interrupts", &len);
+
+ if (val == NULL || len != 4) {
+ bsp_fatal(RISCV_FATAL_NO_NS16550_INTERRUPTS_IN_DEVICE_TREE);
+ }
+
+ ctx->irq = RISCV_INTERRUPT_VECTOR_EXTERNAL(fdt32_to_cpu(val[0]));
+
if (node == console_node) {
riscv_console.context = &ctx->base;
riscv_console.putchar = ns16550_polled_putchar;
@@ -198,7 +206,7 @@ rtems_status_code console_initialize(
rtems_termios_device_install(
path,
- &ns16550_handler_polled,
+ &ns16550_handler_interrupt,
NULL,
&ctx->base
);
More information about the vc
mailing list