bsp/shared: Add bsp_interrupt_handler_is_empty.

This commit is contained in:
Chris Johns
2016-05-06 17:40:22 +10:00
parent 8ce75671eb
commit 43f18a14ae
2 changed files with 33 additions and 1 deletions

View File

@@ -17,6 +17,8 @@
* Germany
* <rtems@embedded-brains.de>
*
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
@@ -106,7 +108,7 @@ static inline rtems_vector_number bsp_interrupt_handler_index(
* @defgroup bsp_interrupt BSP Interrupt Support
*
* @ingroup bsp_shared
*
*
* @brief Generic BSP Interrupt Support
*
* The BSP interrupt support manages a sequence of interrupt vector numbers
@@ -272,6 +274,17 @@ static inline void bsp_interrupt_handler_dispatch(rtems_vector_number vector)
}
}
/**
* @brief Is interrupt handler empty.
*
* This routine returns true if the handler is empty and has not been
* initialised else false is returned. The interrupt lock is not used
* so this call can be used from within interrupts.
*
* @return If empty true shall be returned else false is returned.
*/
bool bsp_interrupt_handler_is_empty(rtems_vector_number vector);
/** @} */
/* For internal use only */

View File

@@ -566,3 +566,22 @@ rtems_status_code rtems_interrupt_handler_iterate(
{
return bsp_interrupt_handler_iterate(vector, routine, arg);
}
bool bsp_interrupt_handler_is_empty(rtems_vector_number vector)
{
rtems_vector_number index = 0;
bsp_interrupt_handler_entry *head = NULL;
bool empty;
/* For use in interrupts so no lock. */
/* Get handler table index */
index = bsp_interrupt_handler_index(vector);
/* Get head entry of the handler list for the vector */
head = &bsp_interrupt_handler_table [index];
empty = bsp_interrupt_is_empty_handler_entry(head);
return empty;
}