diff options
Diffstat (limited to 'testsuites/sptests/sp37/init.c')
-rw-r--r-- | testsuites/sptests/sp37/init.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c index 4c8e1a7f64..e8af725a75 100644 --- a/testsuites/sptests/sp37/init.c +++ b/testsuites/sptests/sp37/init.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @brief Test for Bodies of Macros * @@ -9,9 +11,26 @@ * COPYRIGHT (c) 1989-2012. * On-Line Applications Research Corporation (OAR). * - * 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. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -21,6 +40,8 @@ #define CONFIGURE_INIT #include "system.h" +#include <rtems/sysinit.h> + const char rtems_test_name[] = "SP 37"; /* prototypes */ @@ -48,6 +69,19 @@ rtems_timer_service_routine test_isr_in_progress( #define TEST_ISR_EVENT RTEMS_EVENT_0 +static uint32_t boot_isr_level; + +static void set_boot_isr_level( void ) +{ + boot_isr_level = _ISR_Get_level(); +} + +RTEMS_SYSINIT_ITEM( + set_boot_isr_level, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + typedef struct { ISR_Level actual_level; rtems_id master_task_id; @@ -135,6 +169,9 @@ static void test_isr_level( void ) ISR_Level current = 0; ISR_Level last_proper_level; + /* Interrupts shall be disabled during system initialization */ + rtems_test_assert( boot_isr_level != 0 ); + _ISR_Set_level( current ); rtems_test_assert( _ISR_Get_level() == current ); |