RFC: Function prototype to set the interrupt priority

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jan 10 14:05:06 UTC 2011


Hello,

I want to add a function to set and get the interrupt priority to the interrupt
extension API.  Comments are welcome.

Index: include/rtems/irq-extension.h
===================================================================
--- include/rtems/irq-extension.h       (revision 4088)
+++ include/rtems/irq-extension.h       (working copy)
@@ -66,6 +66,18 @@
   (!RTEMS_INTERRUPT_IS_UNIQUE( options))

 /**
+ * @brief Special interrupt priority value used to get the current priority
+ * value.
+ */
+#define RTEMS_INTERRUPT_PRIORITY_CURRENT UINT32_MAX
+
+/**
+ * @brief Special interrupt priority value used to get the lowest priority
+ * value.
+ */
+#define RTEMS_INTERRUPT_PRIORITY_LOWEST (UINT32_MAX - 1)
+
+/**
  * @brief Interrupt handler routine type.
  */
 typedef void (*rtems_interrupt_handler)(void *);
@@ -261,6 +273,45 @@
   void *arg
 );

+/**
+ * @brief Sets the interrupt priority to @a new_priority for the interrupt
+ * vector with number @a vector and returns the current priority in
+ * @a current_priority.
+ *
+ * The value of the highest priority is zero in analogy to the RTEMS task
+ * priorities.  The value of the lowest priority is board support package
+ * specific.  A priority value of p has a higher priority than p + 1.
+ *
+ * You can use one of the following special values for @a new_priority:
+ *
+ * - @ref RTEMS_INTERRUPT_PRIORITY_CURRENT, and
+ * - @ref RTEMS_INTERRUPT_PRIORITY_LOWEST.
+ *
+ * In case RTEMS_INTERRUPT_PRIORITY_CURRENT is used as @a new_priority, the
+ * current priority shall be returned in @a current_priority.  In case
+ * RTEMS_INTERRUPT_PRIORITY_LOWEST is used as @a new_priority, the value of
+ * lowest priority shall be returned in @a current_priority.  The current
+ * priority shall remain unchanged in both cases.
+ *
+ * The @a current_priority pointer may be @c NULL.
+ *
+ * This function must not block and must be available in every context.
+ * Interrupts may be disabled to protect critical sections.
+ *
+ * @retval RTEMS_SUCCESSFUL Shall be returned in case of success.
+ * @retval RTEMS_INVALID_ID If the vector number is out of range this shall be
+ * returned.
+ * @retval RTEMS_INVALID_NUMBER If the priority value is out of range this
+ * shall be returned.
+ * @retval RTEMS_IO_ERROR Reserved for board support package specific error
+ * conditions.
+ */
+rtems_status_code rtems_interrupt_set_priority(
+  rtems_vector_number vector,
+  uint32_t new_priority,
+  uint32_t *current_priority
+);
+
 /** @} */

 #ifdef __cplusplus

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list