diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-06-19 14:57:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-06-22 08:40:26 +0200 |
commit | cdf30f0550432648ac005e3f71814b7f708a4ce3 (patch) | |
tree | 7dc1af2af9a1de7565a9e79736166994495486a2 /c | |
parent | tmtests/tm27: Use scheduler lock (diff) | |
download | rtems-cdf30f0550432648ac005e3f71814b7f708a4ce3.tar.bz2 |
rtems: Add rtems_interrupt_local_disable|enable()
Add rtems_interrupt_local_disable|enable() as suggested by Pavel Pisa to
emphasize that interrupts are only disabled on the current processor.
Do not define the rtems_interrupt_disable|enable|flash() macros and
functions on SMP configurations since they don't ensure system wide
mutual exclusion.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/shared/bootcard.c | 2 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/intr.h | 38 | ||||
-rw-r--r-- | cpukit/rtems/src/intrbody.c | 9 |
3 files changed, 46 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c index 4f91aa9c4e..0ee5e12cd0 100644 --- a/c/src/lib/libbsp/shared/bootcard.c +++ b/c/src/lib/libbsp/shared/bootcard.c @@ -72,7 +72,7 @@ void boot_card( * Make sure interrupts are disabled. */ (void) bsp_isr_level; - rtems_interrupt_disable( bsp_isr_level ); + rtems_interrupt_local_disable( bsp_isr_level ); bsp_boot_cmdline = cmdline; diff --git a/cpukit/rtems/include/rtems/rtems/intr.h b/cpukit/rtems/include/rtems/rtems/intr.h index 259120fdc2..d084959fa9 100644 --- a/cpukit/rtems/include/rtems/rtems/intr.h +++ b/cpukit/rtems/include/rtems/rtems/intr.h @@ -89,10 +89,15 @@ rtems_status_code rtems_interrupt_catch( ); #endif +#if !defined(RTEMS_SMP) + /** * @brief Disable RTEMS Interrupt * * @note The interrupt level shall be of type @ref rtems_interrupt_level. + * + * This macro is only available on uni-processor configurations. The macro + * rtems_interrupt_local_disable() is available on all configurations. */ #define rtems_interrupt_disable( _isr_cookie ) \ _ISR_Disable(_isr_cookie) @@ -101,6 +106,9 @@ rtems_status_code rtems_interrupt_catch( * @brief Enable RTEMS Interrupt * * @note The interrupt level shall be of type @ref rtems_interrupt_level. + * + * This macro is only available on uni-processor configurations. The macro + * rtems_interrupt_local_enable() is available on all configurations. */ #define rtems_interrupt_enable( _isr_cookie ) \ _ISR_Enable(_isr_cookie) @@ -109,10 +117,40 @@ rtems_status_code rtems_interrupt_catch( * @brief Flash RTEMS Interrupt * * @note The interrupt level shall be of type @ref rtems_interrupt_level. + * + * This macro is only available on uni-processor configurations. The macro + * rtems_interrupt_local_disable() and rtems_interrupt_local_enable() is + * available on all configurations. */ #define rtems_interrupt_flash( _isr_cookie ) \ _ISR_Flash(_isr_cookie) +#endif /* RTEMS_SMP */ + +/** + * @brief This macro disables the interrupts on the current processor. + * + * On SMP configurations this will not ensure system wide mutual exclusion. + * Use interrupt locks instead. + * + * @param[in] _isr_cookie The previous interrupt level is returned. The type + * of this variable must be rtems_interrupt_level. + * + * @see rtems_interrupt_local_enable(). + */ +#define rtems_interrupt_local_disable( _isr_cookie ) \ + _ISR_Disable_without_giant( _isr_cookie ) + +/** + * @brief This macro restores the previous interrupt level on the current + * processor. + * + * @param[in] _isr_cookie The previous interrupt level returned by + * rtems_interrupt_local_disable(). + */ +#define rtems_interrupt_local_enable( _isr_cookie ) \ + _ISR_Enable_without_giant( _isr_cookie ) + /** * @brief RTEMS Interrupt Is in Progress * diff --git a/cpukit/rtems/src/intrbody.c b/cpukit/rtems/src/intrbody.c index 6b37eb26ca..a82dc101e6 100644 --- a/cpukit/rtems/src/intrbody.c +++ b/cpukit/rtems/src/intrbody.c @@ -23,6 +23,8 @@ #include <rtems/score/isr.h> #include <rtems/rtems/intr.h> +#if !defined(RTEMS_SMP) + /* * Undefine all of these is normally a macro and we want a real body in * the library for other language bindings. @@ -30,7 +32,6 @@ #undef rtems_interrupt_disable #undef rtems_interrupt_enable #undef rtems_interrupt_flash -#undef rtems_interrupt_is_in_progress /* * Prototype them to avoid warnings @@ -38,7 +39,6 @@ rtems_interrupt_level rtems_interrupt_disable( void ); void rtems_interrupt_enable( rtems_interrupt_level previous_level ); void rtems_interrupt_flash( rtems_interrupt_level previous_level ); -bool rtems_interrupt_is_in_progress( void ); /* * Now define real bodies @@ -66,6 +66,11 @@ void rtems_interrupt_flash( _ISR_Flash( previous_level ); } +#endif /* RTEMS_SMP */ + +#undef rtems_interrupt_is_in_progress +bool rtems_interrupt_is_in_progress( void ); + bool rtems_interrupt_is_in_progress( void ) { return _ISR_Is_in_progress(); |