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 | #include <time.h> |
---|
17 | |
---|
18 | const char rtems_test_name[] = "PSXINTRCRITICAL 1"; |
---|
19 | |
---|
20 | /* forward declarations to avoid warnings */ |
---|
21 | rtems_task Init(rtems_task_argument ignored); |
---|
22 | rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg); |
---|
23 | |
---|
24 | #define TEST_NAME "01" |
---|
25 | #define TEST_STRING "POSIX Timer" |
---|
26 | |
---|
27 | rtems_id Main_task; |
---|
28 | timer_t Timer; |
---|
29 | struct itimerspec TimerParams; |
---|
30 | |
---|
31 | #define POSIX_TIMER_RELATIVE 0 |
---|
32 | |
---|
33 | rtems_timer_service_routine test_release_from_isr( |
---|
34 | rtems_id timer, |
---|
35 | void *arg |
---|
36 | ) |
---|
37 | { |
---|
38 | (void) timer_settime(Timer, POSIX_TIMER_RELATIVE, &TimerParams, NULL); |
---|
39 | } |
---|
40 | |
---|
41 | rtems_task Init( |
---|
42 | rtems_task_argument ignored |
---|
43 | ) |
---|
44 | { |
---|
45 | int sc; |
---|
46 | int resets; |
---|
47 | |
---|
48 | TEST_BEGIN(); |
---|
49 | |
---|
50 | puts( "Init - Trying to generate timer fire from ISR while firing" ); |
---|
51 | puts( "Init - Variation is: " TEST_STRING ); |
---|
52 | |
---|
53 | puts( "Init - There is no way for the test to know if it hits the case" ); |
---|
54 | |
---|
55 | /* create POSIX Timer */ |
---|
56 | sc = timer_create (CLOCK_REALTIME, NULL, &Timer); |
---|
57 | if ( sc == -1 ) { |
---|
58 | perror ("Error in timer creation\n"); |
---|
59 | rtems_test_exit(0); |
---|
60 | } |
---|
61 | |
---|
62 | Main_task = rtems_task_self(); |
---|
63 | |
---|
64 | /* we don't care if it ever fires */ |
---|
65 | TimerParams.it_interval.tv_sec = 10; |
---|
66 | TimerParams.it_interval.tv_nsec = 0; |
---|
67 | TimerParams.it_value.tv_sec = 10; |
---|
68 | TimerParams.it_value.tv_nsec = 0; |
---|
69 | |
---|
70 | interrupt_critical_section_test_support_initialize( test_release_from_isr ); |
---|
71 | |
---|
72 | for (resets=0 ; resets<10 ;) { |
---|
73 | if ( interrupt_critical_section_test_support_delay() ) |
---|
74 | resets++; |
---|
75 | |
---|
76 | sc = timer_settime(Timer, POSIX_TIMER_RELATIVE, &TimerParams, NULL); |
---|
77 | if ( sc == -1 ) { |
---|
78 | perror ("Error in timer setting\n"); |
---|
79 | rtems_test_exit(0); |
---|
80 | } |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | TEST_END(); |
---|
85 | rtems_test_exit(0); |
---|
86 | } |
---|
87 | |
---|
88 | /* configuration information */ |
---|
89 | |
---|
90 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
91 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
92 | |
---|
93 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
94 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
95 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
96 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 |
---|
97 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
98 | |
---|
99 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
100 | |
---|
101 | #define CONFIGURE_INIT |
---|
102 | #include <rtems/confdefs.h> |
---|
103 | |
---|
104 | /* global variables */ |
---|