diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-18 19:59:00 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-23 15:18:39 +0100 |
commit | 90de17fe95782479b61b58446ccc815f5cbf04fa (patch) | |
tree | d847210b0a382af14ab91524fe60c5102de38f11 | |
parent | 7be0563f8833b1aa611d3b498205acf4cac3aa9e (diff) |
testsuites/validation/tc-intr-smp-only.c
-rw-r--r-- | testsuites/validation/tc-intr-smp-only.c | 145 |
1 files changed, 72 insertions, 73 deletions
diff --git a/testsuites/validation/tc-intr-smp-only.c b/testsuites/validation/tc-intr-smp-only.c index 5cb83c3e4b..4bf596141c 100644 --- a/testsuites/validation/tc-intr-smp-only.c +++ b/testsuites/validation/tc-intr-smp-only.c @@ -53,7 +53,6 @@ #endif #include <rtems.h> -#include <rtems/irq-extension.h> #include "tx-support.h" @@ -69,42 +68,38 @@ * * This test case performs the following actions: * - * - Validate rtems_interrupt_local_disable() and - * rtems_interrupt_local_enable(). - * - * - Check that maskable interrupts are enabled before the call to - * rtems_interrupt_local_disable() and disabled afterwards. + * - Validate the interrupt lock directives. * - * - Check that maskable interrupts are disabled before the call to - * rtems_interrupt_local_disable() and disabled afterwards. + * - Check that RTEMS_INTERRUPT_LOCK_REFERENCE() expanded to a lock reference + * definition. Check that the lock is available after static + * initialization. * - * - Check that the maskable interrupt status is restored by the call to - * rtems_interrupt_local_enable() according to the ``_isr_cookie`` - * parameter. In this case maskable interrupts are still disabled - * afterwards. - * - * - Check that the maskable interrupt status is restored by the call to - * rtems_interrupt_local_enable() according to the ``_isr_cookie`` - * parameter. In this case maskable interrupts are enabled afterwards. - * - * - Validate the interrupt lock directives. + * - Check that the lock is available after initialization. * * - Check that maskable interrupts are disabled before the call to * rtems_interrupt_lock_interrupt_disable() and disabled afterwards. * * - Check that the maskable interrupt status is not changed by the - * rtems_interrupt_lock_acquire_isr() call. + * rtems_interrupt_lock_acquire_isr() call. Check that the lock is no + * longer available. * * - Check that the maskable interrupt status is restored by the call to * rtems_interrupt_lock_release() according to the ``_lock_context`` - * parameter. + * parameter. Check that the lock is available afterwards. + * + * - Check that the maskable interrupt status is not changed by the + * rtems_interrupt_lock_destroy() call. + * + * - Initialize the lock using rtems_interrupt_lock_initialize(). Check that + * the lock is available after initialization. * * - Check that maskable interrupts are disabled before the call to - * rtems_interrupt_lock_acquire() and disabled afterwards. + * rtems_interrupt_lock_acquire() and disabled afterwards. Check that the + * lock is no longer available. * * - Check that the maskable interrupt status is restored by the call to * rtems_interrupt_lock_release() according to the ``_lock_context`` - * parameter. + * parameter. Check that the lock is available afterwards. * * - Check that the maskable interrupt status is not changed by the * rtems_interrupt_lock_destroy() call. @@ -112,106 +107,111 @@ * @{ */ +RTEMS_INTERRUPT_LOCK_DECLARE( static, the_lock ) +RTEMS_INTERRUPT_LOCK_DEFINE( static, the_lock, "name " ) + /** - * @brief Validate rtems_interrupt_local_disable() and - * rtems_interrupt_local_enable(). + * @brief Validate the interrupt lock directives. */ static void RtemsIntrValIntrSmpOnly_Action_0( void ) { - rtems_interrupt_level level; - rtems_interrupt_level level_2; - - /* - * Check that maskable interrupts are enabled before the call to - * rtems_interrupt_local_disable() and disabled afterwards. - */ - T_true( AreInterruptsEnabled() ); - rtems_interrupt_local_disable( level ); - T_false( AreInterruptsEnabled() ); - - /* - * Check that maskable interrupts are disabled before the call to - * rtems_interrupt_local_disable() and disabled afterwards. - */ - T_false( AreInterruptsEnabled() ); - rtems_interrupt_local_disable( level_2 ); - T_false( AreInterruptsEnabled() ); + struct { + int a; + RTEMS_INTERRUPT_LOCK_MEMBER( member ) + int b; + } lock = { + .member = RTEMS_INTERRUPT_LOCK_INITIALIZER( "name" ) + }; + + RTEMS_INTERRUPT_LOCK_REFERENCE( ref, &the_lock ) + rtems_interrupt_lock_context lock_context; /* - * Check that the maskable interrupt status is restored by the call to - * rtems_interrupt_local_enable() according to the ``_isr_cookie`` parameter. - * In this case maskable interrupts are still disabled afterwards. + * Check that RTEMS_INTERRUPT_LOCK_REFERENCE() expanded to a lock reference + * definition. Check that the lock is available after static initialization. */ - T_false( AreInterruptsEnabled() ); - rtems_interrupt_local_enable( level_2 ); - T_false( AreInterruptsEnabled() ); + T_true( ISRLockIsAvailable( ref ) ); /* - * Check that the maskable interrupt status is restored by the call to - * rtems_interrupt_local_enable() according to the ``_isr_cookie`` parameter. - * In this case maskable interrupts are enabled afterwards. + * Check that the lock is available after initialization. */ - T_false( AreInterruptsEnabled() ); - rtems_interrupt_local_enable( level ); - T_true( AreInterruptsEnabled() ); -} - -/** - * @brief Validate the interrupt lock directives. - */ -static void RtemsIntrValIntrSmpOnly_Action_1( void ) -{ - RTEMS_INTERRUPT_LOCK_DEFINE( , lock, "name" ); - rtems_interrupt_lock_context lock_context; + T_true( ISRLockIsAvailable( &lock.member ) ); /* * Check that maskable interrupts are disabled before the call to * rtems_interrupt_lock_interrupt_disable() and disabled afterwards. */ T_true( AreInterruptsEnabled() ); + T_true( ISRLockIsAvailable( &lock.member ) ); rtems_interrupt_lock_interrupt_disable( &lock_context ); T_false( AreInterruptsEnabled() ); + T_true( ISRLockIsAvailable( &lock.member ) ); /* * Check that the maskable interrupt status is not changed by the - * rtems_interrupt_lock_acquire_isr() call. + * rtems_interrupt_lock_acquire_isr() call. Check that the lock is no longer + * available. */ T_false( AreInterruptsEnabled() ); - rtems_interrupt_lock_acquire_isr( &lock, &lock_context ); + T_true( ISRLockIsAvailable( &lock.member ) ); + rtems_interrupt_lock_acquire_isr( &lock.member, &lock_context ); T_false( AreInterruptsEnabled() ); + T_false( ISRLockIsAvailable( &lock.member ) ); /* * Check that the maskable interrupt status is restored by the call to * rtems_interrupt_lock_release() according to the ``_lock_context`` - * parameter. + * parameter. Check that the lock is available afterwards. */ T_false( AreInterruptsEnabled() ); - rtems_interrupt_lock_release( &lock, &lock_context ); + T_false( ISRLockIsAvailable( &lock.member ) ); + rtems_interrupt_lock_release( &lock.member, &lock_context ); + T_true( AreInterruptsEnabled() ); + T_true( ISRLockIsAvailable( &lock.member ) ); + + /* + * Check that the maskable interrupt status is not changed by the + * rtems_interrupt_lock_destroy() call. + */ + T_true( AreInterruptsEnabled() ); + rtems_interrupt_lock_destroy( &lock.member ); T_true( AreInterruptsEnabled() ); /* + * Initialize the lock using rtems_interrupt_lock_initialize(). Check that + * the lock is available after initialization. + */ + rtems_interrupt_lock_initialize( &lock.member, "name" ); + T_true( ISRLockIsAvailable( &lock.member ) ); + + /* * Check that maskable interrupts are disabled before the call to - * rtems_interrupt_lock_acquire() and disabled afterwards. + * rtems_interrupt_lock_acquire() and disabled afterwards. Check that the + * lock is no longer available. */ T_true( AreInterruptsEnabled() ); - rtems_interrupt_lock_acquire( &lock, &lock_context ); + T_true( ISRLockIsAvailable( &lock.member ) ); + rtems_interrupt_lock_acquire( &lock.member, &lock_context ); T_false( AreInterruptsEnabled() ); + T_false( ISRLockIsAvailable( &lock.member ) ); /* * Check that the maskable interrupt status is restored by the call to * rtems_interrupt_lock_release() according to the ``_lock_context`` - * parameter. + * parameter. Check that the lock is available afterwards. */ T_false( AreInterruptsEnabled() ); - rtems_interrupt_lock_release( &lock, &lock_context ); + T_false( ISRLockIsAvailable( &lock.member ) ); + rtems_interrupt_lock_release( &lock.member, &lock_context ); T_true( AreInterruptsEnabled() ); + T_true( ISRLockIsAvailable( &lock.member ) ); /* * Check that the maskable interrupt status is not changed by the * rtems_interrupt_lock_destroy() call. */ T_true( AreInterruptsEnabled() ); - rtems_interrupt_lock_destroy( &lock ); + rtems_interrupt_lock_destroy( &lock.member ); T_true( AreInterruptsEnabled() ); } @@ -221,7 +221,6 @@ static void RtemsIntrValIntrSmpOnly_Action_1( void ) T_TEST_CASE( RtemsIntrValIntrSmpOnly ) { RtemsIntrValIntrSmpOnly_Action_0(); - RtemsIntrValIntrSmpOnly_Action_1(); } /** @} */ |