1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2009. |
---|
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.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #include <tmacros.h> |
---|
13 | #include <intrcritical.h> |
---|
14 | |
---|
15 | rtems_id Main_task; |
---|
16 | |
---|
17 | #if defined(EVENT_ANY) |
---|
18 | #define TEST_NAME "11" |
---|
19 | #define TEST_STRING "Event Any condition" |
---|
20 | #define EVENTS_TO_SEND 0x1 |
---|
21 | #define EVENTS_TO_RECEIVE 0x3 |
---|
22 | |
---|
23 | #elif defined(EVENT_ALL) |
---|
24 | #define TEST_NAME "12" |
---|
25 | #define TEST_STRING "Event All condition" |
---|
26 | #define EVENTS_TO_SEND 0x3 |
---|
27 | #define EVENTS_TO_RECEIVE 0x3 |
---|
28 | |
---|
29 | #else |
---|
30 | #error "Test Mode not defined" |
---|
31 | |
---|
32 | #endif |
---|
33 | |
---|
34 | rtems_timer_service_routine test_release_from_isr( |
---|
35 | rtems_id timer, |
---|
36 | void *arg |
---|
37 | ) |
---|
38 | { |
---|
39 | (void) rtems_event_send( Main_task, EVENTS_TO_SEND ); |
---|
40 | } |
---|
41 | |
---|
42 | rtems_task Init( |
---|
43 | rtems_task_argument ignored |
---|
44 | ) |
---|
45 | { |
---|
46 | rtems_status_code sc; |
---|
47 | rtems_event_set out; |
---|
48 | int resets; |
---|
49 | |
---|
50 | puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" ); |
---|
51 | |
---|
52 | puts( "Init - Test may not be able to detect case is hit reliably" ); |
---|
53 | puts( "Init - Trying to generate event send from ISR while blocking" ); |
---|
54 | puts( "Init - Variation is: " TEST_STRING ); |
---|
55 | |
---|
56 | Main_task = rtems_task_self(); |
---|
57 | |
---|
58 | interrupt_critical_section_test_support_initialize( test_release_from_isr ); |
---|
59 | |
---|
60 | for (resets=0 ; resets< 2 ;) { |
---|
61 | if ( interrupt_critical_section_test_support_delay() ) |
---|
62 | resets++; |
---|
63 | |
---|
64 | (void) rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); |
---|
65 | } |
---|
66 | |
---|
67 | puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" ); |
---|
68 | rtems_test_exit(0); |
---|
69 | } |
---|
70 | |
---|
71 | /* configuration information */ |
---|
72 | |
---|
73 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
74 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
75 | |
---|
76 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
77 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
78 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
79 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
80 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 |
---|
81 | |
---|
82 | #define CONFIGURE_INIT |
---|
83 | #include <rtems/confdefs.h> |
---|
84 | |
---|
85 | /* global variables */ |
---|