RFC: Function prototype to set the interrupt priority
Thomas Doerfler
Thomas.Doerfler at embedded-brains.de
Mon Jan 10 20:06:56 UTC 2011
Sebastian,
what I am missing in the comments (and possibly in the API):
- How should this API extension work, if the interrupt controller
hardware gives fixed priorities to certains interrupt sources?
- How should this API extension work, if each priority level can only be
assigned to ONE source. In this case, setting a certain priority to a
certain source will force, that a different source may also change its
priority.
I doubt that the model will cover all possible interrupt controller
implementations.
wkr,
Thomas.
Am 10.01.2011 15:05, schrieb Sebastian Huber:
> 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
>
--
--------------------------------------------
Embedded Brains GmbH
Thomas Doerfler Obere Lagerstr. 30
D-82178 Puchheim Germany
email: Thomas.Doerfler at embedded-brains.de
Phone: +49-89-18908079-2
Fax: +49-89-18908079-9
More information about the users
mailing list