[PATCH v3 07/42] rtems: Add rtems_interrupt_vector_enable()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 23 13:56:15 UTC 2021


Add rtems_interrupt_vector_disable().

Update #3269.
---
 bsps/shared/irq-default-sources.am           |  1 +
 bsps/shared/irq-sources.am                   |  1 +
 bsps/shared/irq/irq-enable-disable.c         | 59 +++++++++++++
 c/src/lib/libbsp/m68k/genmcf548x/Makefile.am |  1 +
 c/src/lib/libbsp/powerpc/ss555/Makefile.am   |  1 +
 cpukit/include/rtems/irq-extension.h         | 88 ++++++++++++++++++++
 spec/build/bsps/m68k/genmcf548x/obj.yml      |  1 +
 spec/build/bsps/objirq.yml                   |  1 +
 spec/build/bsps/powerpc/ss555/bspss555.yml   |  1 +
 9 files changed, 154 insertions(+)
 create mode 100644 bsps/shared/irq/irq-enable-disable.c

diff --git a/bsps/shared/irq-default-sources.am b/bsps/shared/irq-default-sources.am
index 9f0e4686f7..fe3352f7e5 100644
--- a/bsps/shared/irq-default-sources.am
+++ b/bsps/shared/irq-default-sources.am
@@ -1,6 +1,7 @@
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-affinity.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-enable-disable.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-generic.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-handler-iterate.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-info.c
diff --git a/bsps/shared/irq-sources.am b/bsps/shared/irq-sources.am
index 776958dd8f..d2536eb56d 100644
--- a/bsps/shared/irq-sources.am
+++ b/bsps/shared/irq-sources.am
@@ -1,4 +1,5 @@
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-affinity.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-enable-disable.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-generic.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-handler-iterate.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-info.c
diff --git a/bsps/shared/irq/irq-enable-disable.c b/bsps/shared/irq/irq-enable-disable.c
new file mode 100644
index 0000000000..792f5e60c6
--- /dev/null
+++ b/bsps/shared/irq/irq-enable-disable.c
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup bsp_interrupt
+ *
+ * @brief This source file contains the implementation of
+ *   rtems_interrupt_vector_enable() and rtems_interrupt_vector_disable().
+ */
+
+/*
+ * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <bsp/irq-generic.h>
+
+rtems_status_code rtems_interrupt_vector_enable( rtems_vector_number vector )
+{
+  if ( !bsp_interrupt_is_valid_vector( vector ) ) {
+    return RTEMS_INVALID_ID;
+  }
+
+  bsp_interrupt_vector_enable( vector );
+
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code rtems_interrupt_vector_disable( rtems_vector_number vector )
+{
+  if ( !bsp_interrupt_is_valid_vector( vector ) ) {
+    return RTEMS_INVALID_ID;
+  }
+
+  bsp_interrupt_vector_disable( vector );
+
+  return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/m68k/genmcf548x/Makefile.am b/c/src/lib/libbsp/m68k/genmcf548x/Makefile.am
index 88a1ab0e5b..ecc8c99b26 100644
--- a/c/src/lib/libbsp/m68k/genmcf548x/Makefile.am
+++ b/c/src/lib/libbsp/m68k/genmcf548x/Makefile.am
@@ -40,6 +40,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/m68k/genmcf548x/btimer/btimer.c
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-affinity.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-enable-disable.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-handler-iterate.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-info.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-legacy.c
diff --git a/c/src/lib/libbsp/powerpc/ss555/Makefile.am b/c/src/lib/libbsp/powerpc/ss555/Makefile.am
index e1a79a6293..2dc5a98e33 100644
--- a/c/src/lib/libbsp/powerpc/ss555/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/ss555/Makefile.am
@@ -49,6 +49,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/vectors.S
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-affinity.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-enable-disable.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-generic.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-handler-iterate.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-info.c
diff --git a/cpukit/include/rtems/irq-extension.h b/cpukit/include/rtems/irq-extension.h
index 81de54d334..e0d63c9dcb 100644
--- a/cpukit/include/rtems/irq-extension.h
+++ b/cpukit/include/rtems/irq-extension.h
@@ -315,6 +315,94 @@ rtems_status_code rtems_interrupt_handler_remove(
   void                   *arg
 );
 
+/* Generated from spec:/rtems/intr/if/vector-enable */
+
+/**
+ * @ingroup RTEMSAPIClassicIntr
+ *
+ * @brief Enables the interrupt vector.
+ *
+ * @param vector is the number of the interrupt vector to enable.
+ *
+ * The directive enables the interrupt vector specified by ``vector``. This
+ * allows that interrupt service requests are issued to the target processors
+ * of the interrupt vector.  Interrupt service requests for an interrupt vector
+ * may be raised by rtems_interrupt_raise(), rtems_interrupt_raise_on(),
+ * external signals, or messages.
+ *
+ * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
+ *
+ * @retval ::RTEMS_INVALID_ID There was no interrupt vector associated with the
+ *   number specified by ``vector``.
+ *
+ * @retval ::RTEMS_UNSATISFIED The request to enable the interrupt vector has
+ *   not been satisfied.
+ *
+ * @par Notes
+ * The rtems_interrupt_get_attributes() directive may be used to check if an
+ * interrupt vector can be enabled.  Interrupt vectors may be disabled by
+ * rtems_interrupt_vector_disable().
+ *
+ * @par Constraints
+ * @parblock
+ * The following constraints apply to this directive:
+ *
+ * * The directive may be called from within interrupt context.
+ *
+ * * The directive may be called from within device driver initialization
+ *   context.
+ *
+ * * The directive may be called from within task context.
+ *
+ * * The directive will not cause the calling task to be preempted.
+ * @endparblock
+ */
+rtems_status_code rtems_interrupt_vector_enable( rtems_vector_number vector );
+
+/* Generated from spec:/rtems/intr/if/vector-disable */
+
+/**
+ * @ingroup RTEMSAPIClassicIntr
+ *
+ * @brief Disables the interrupt vector.
+ *
+ * @param vector is the number of the interrupt vector to disable.
+ *
+ * The directive disables the interrupt vector specified by ``vector``.  This
+ * prevents that an interrupt service request is issued to the target
+ * processors of the interrupt vector.
+ *
+ * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
+ *
+ * @retval ::RTEMS_INVALID_ID There was no interrupt vector associated with the
+ *   number specified by ``vector``.
+ *
+ * @retval ::RTEMS_UNSATISFIED The request to disable the interrupt vector has
+ *   not been satisfied.
+ *
+ * @par Notes
+ * The rtems_interrupt_get_attributes() directive may be used to check if an
+ * interrupt vector can be disabled.  Interrupt vectors may be enabled by
+ * rtems_interrupt_vector_enable().  There may be targets on which some
+ * interrupt vectors cannot be disabled, for example a hardware watchdog
+ * interrupt or software generated interrupts.
+ *
+ * @par Constraints
+ * @parblock
+ * The following constraints apply to this directive:
+ *
+ * * The directive may be called from within interrupt context.
+ *
+ * * The directive may be called from within device driver initialization
+ *   context.
+ *
+ * * The directive may be called from within task context.
+ *
+ * * The directive will not cause the calling task to be preempted.
+ * @endparblock
+ */
+rtems_status_code rtems_interrupt_vector_disable( rtems_vector_number vector );
+
 /* Generated from spec:/rtems/intr/if/get-affinity */
 
 /**
diff --git a/spec/build/bsps/m68k/genmcf548x/obj.yml b/spec/build/bsps/m68k/genmcf548x/obj.yml
index 252b350f70..538279e196 100644
--- a/spec/build/bsps/m68k/genmcf548x/obj.yml
+++ b/spec/build/bsps/m68k/genmcf548x/obj.yml
@@ -40,6 +40,7 @@ source:
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/irq/irq-affinity.c
 - bsps/shared/irq/irq-default-handler.c
+- bsps/shared/irq/irq-enable-disable.c
 - bsps/shared/irq/irq-handler-iterate.c
 - bsps/shared/irq/irq-info.c
 - bsps/shared/irq/irq-legacy.c
diff --git a/spec/build/bsps/objirq.yml b/spec/build/bsps/objirq.yml
index 616a3ea83f..b6e725832f 100644
--- a/spec/build/bsps/objirq.yml
+++ b/spec/build/bsps/objirq.yml
@@ -11,6 +11,7 @@ install: []
 links: []
 source:
 - bsps/shared/irq/irq-affinity.c
+- bsps/shared/irq/irq-enable-disable.c
 - bsps/shared/irq/irq-generic.c
 - bsps/shared/irq/irq-handler-iterate.c
 - bsps/shared/irq/irq-info.c
diff --git a/spec/build/bsps/powerpc/ss555/bspss555.yml b/spec/build/bsps/powerpc/ss555/bspss555.yml
index e011ceb9b5..a209db3238 100644
--- a/spec/build/bsps/powerpc/ss555/bspss555.yml
+++ b/spec/build/bsps/powerpc/ss555/bspss555.yml
@@ -70,6 +70,7 @@ source:
 - bsps/shared/irq/irq-affinity.c
 - bsps/shared/irq/irq-default-handler.c
 - bsps/shared/irq/irq-default.c
+- bsps/shared/irq/irq-enable-disable.c
 - bsps/shared/irq/irq-generic.c
 - bsps/shared/irq/irq-handler-iterate.c
 - bsps/shared/irq/irq-info.c
-- 
2.26.2



More information about the devel mailing list