diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-11-09 14:46:11 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-11-10 08:55:38 +0100 |
commit | 9c80a88694e863081a6485fa07ba234b2b03da99 (patch) | |
tree | 4c15a45e5337b401973ce637466491720556e3d6 /bsps/riscv/riscv | |
parent | bsps/riscv: RISCV_MAXIMUM_EXTERNAL_INTERRUPTS (diff) | |
download | rtems-9c80a88694e863081a6485fa07ba234b2b03da99.tar.bz2 |
bsps/riscv: bsp_interrupt_is_valid_vector()
Implement this function.
Diffstat (limited to 'bsps/riscv/riscv')
-rw-r--r-- | bsps/riscv/riscv/include/bsp/irq.h | 2 | ||||
-rw-r--r-- | bsps/riscv/riscv/irq/irq.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/bsps/riscv/riscv/include/bsp/irq.h b/bsps/riscv/riscv/include/bsp/irq.h index ae1ba3c757..93c9780111 100644 --- a/bsps/riscv/riscv/include/bsp/irq.h +++ b/bsps/riscv/riscv/include/bsp/irq.h @@ -58,6 +58,8 @@ #define BSP_INTERRUPT_VECTOR_COUNT RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS) +#define BSP_INTERRUPT_CUSTOM_VALID_VECTOR + rtems_status_code bsp_interrupt_set_affinity( rtems_vector_number vector, const Processor_mask *affinity diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c index 1f383ebb89..943dd4a68b 100644 --- a/bsps/riscv/riscv/irq/irq.c +++ b/bsps/riscv/riscv/irq/irq.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -7,7 +9,7 @@ */ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (C) 2018, 2022 embedded brains GmbH * * Copyright (c) 2015 University of York. * Hesham Almatary <hesham@alumni.york.ac.uk> @@ -274,6 +276,19 @@ void bsp_interrupt_facility_initialize(void) riscv_plic_init(fdt); } +bool bsp_interrupt_is_valid_vector(rtems_vector_number vector) +{ + /* + * The PLIC interrupt ID of zero is reserved. For example, this ID is used + * to indicate that no interrupt was claimed. + */ + if (vector == RISCV_INTERRUPT_VECTOR_EXTERNAL(0)) { + return false; + } + + return vector < (rtems_vector_number) BSP_INTERRUPT_VECTOR_COUNT; +} + rtems_status_code bsp_interrupt_get_attributes( rtems_vector_number vector, rtems_interrupt_attributes *attributes |