1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2012. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <tmacros.h> |
---|
15 | #include <intrcritical.h> |
---|
16 | |
---|
17 | /* forward declarations to avoid warnings */ |
---|
18 | rtems_task Init(rtems_task_argument argument); |
---|
19 | rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg); |
---|
20 | |
---|
21 | rtems_id Main_task; |
---|
22 | |
---|
23 | #if defined(EVENT_ANY) |
---|
24 | #define TEST_NAME "11" |
---|
25 | #define TEST_STRING "Event Any condition" |
---|
26 | #define EVENTS_TO_SEND 0x1 |
---|
27 | #define EVENTS_TO_RECEIVE 0x3 |
---|
28 | |
---|
29 | #elif defined(EVENT_ALL) |
---|
30 | #define TEST_NAME "12" |
---|
31 | #define TEST_STRING "Event All condition" |
---|
32 | #define EVENTS_TO_SEND 0x3 |
---|
33 | #define EVENTS_TO_RECEIVE 0x3 |
---|
34 | |
---|
35 | #else |
---|
36 | #error "Test Mode not defined" |
---|
37 | |
---|
38 | #endif |
---|
39 | |
---|
40 | const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME; |
---|
41 | |
---|
42 | rtems_timer_service_routine test_release_from_isr( |
---|
43 | rtems_id timer, |
---|
44 | void *arg |
---|
45 | ) |
---|
46 | { |
---|
47 | (void) rtems_event_send( Main_task, EVENTS_TO_SEND ); |
---|
48 | } |
---|
49 | |
---|
50 | static bool test_body( void *arg ) |
---|
51 | { |
---|
52 | rtems_event_set out; |
---|
53 | |
---|
54 | (void) arg; |
---|
55 | |
---|
56 | rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); |
---|
57 | |
---|
58 | return false; |
---|
59 | } |
---|
60 | |
---|
61 | rtems_task Init( |
---|
62 | rtems_task_argument ignored |
---|
63 | ) |
---|
64 | { |
---|
65 | TEST_BEGIN(); |
---|
66 | |
---|
67 | puts( "Init - Test may not be able to detect case is hit reliably" ); |
---|
68 | puts( "Init - Trying to generate event send from ISR while blocking" ); |
---|
69 | puts( "Init - Variation is: " TEST_STRING ); |
---|
70 | |
---|
71 | Main_task = rtems_task_self(); |
---|
72 | |
---|
73 | interrupt_critical_section_test( test_body, NULL, test_release_from_isr ); |
---|
74 | |
---|
75 | TEST_END(); |
---|
76 | rtems_test_exit(0); |
---|
77 | } |
---|
78 | |
---|
79 | /* configuration information */ |
---|
80 | |
---|
81 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
82 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
83 | |
---|
84 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
85 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
86 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
87 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
88 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
89 | |
---|
90 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
91 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 |
---|
92 | |
---|
93 | #define CONFIGURE_INIT |
---|
94 | #include <rtems/confdefs.h> |
---|
95 | |
---|
96 | /* global variables */ |
---|