summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spintrcritical21/init.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testsuites/sptests/spintrcritical21/init.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/testsuites/sptests/spintrcritical21/init.c b/testsuites/sptests/spintrcritical21/init.c
index 032ee89eac..6c675e1669 100644
--- a/testsuites/sptests/spintrcritical21/init.c
+++ b/testsuites/sptests/spintrcritical21/init.c
@@ -1,14 +1,33 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/*
* Classic API Signal to Task from ISR
*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020 embedded brains GmbH & Co. KG
*
* COPYRIGHT (c) 1989-2011.
* 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
@@ -31,6 +50,18 @@ typedef struct {
rtems_id other_task;
} test_context;
+static void clear_pending_events( void )
+{
+ rtems_event_set out;
+
+ (void) rtems_event_receive(
+ RTEMS_ALL_EVENTS,
+ RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
+ 0,
+ &out
+ );
+}
+
static bool is_blocked( Thread_Wait_flags flags )
{
return flags == ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_BLOCKED );
@@ -123,6 +154,8 @@ T_TEST_CASE(EventFromISR)
status = rtems_task_delete( ctx.other_task );
T_rsc_success( status );
+
+ clear_pending_events();
}
static T_interrupt_test_state event_with_timeout_from_isr_interrupt(
@@ -183,6 +216,8 @@ T_TEST_CASE( EventWithTimeoutFromISR )
state = T_interrupt_test( &event_with_timeout_from_isr_config, &ctx );
T_eq_int( state, T_INTERRUPT_TEST_DONE );
+
+ clear_pending_events();
}
static rtems_task Init( rtems_task_argument argument )