source: rtems/testsuites/tmtests/tm19/task1.c @ fdeaa64

5
Last change on this file since fdeaa64 was fdeaa64, checked in by Sebastian Huber <sebastian.huber@…>, on 03/03/20 at 12:01:56

config: Remove <rtems/btimer.h> include

The use of CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER does not define
anything, so remove the <rtems/btimer.h> include.

Update #3875.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
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 <rtems/btimer.h>
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19const char rtems_test_name[] = "TIME TEST 19";
20
21rtems_asr Process_asr_for_pass_1(
22  rtems_signal_set signals
23);
24
25rtems_asr Process_asr_for_pass_2(
26  rtems_signal_set signals
27);
28
29rtems_task Task_1(
30  rtems_task_argument argument
31);
32
33rtems_task Task_2(
34  rtems_task_argument argument
35);
36
37rtems_task Task_3(
38  rtems_task_argument argument
39);
40
41rtems_task Init(
42  rtems_task_argument argument
43)
44{
45  rtems_status_code status;
46
47  Print_Warning();
48
49  TEST_BEGIN();
50
51  status = rtems_task_create(
52    rtems_build_name( 'T', 'I', 'M', 'E' ),
53    (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
54    RTEMS_MINIMUM_STACK_SIZE,
55    RTEMS_DEFAULT_MODES,
56    RTEMS_DEFAULT_ATTRIBUTES,
57    &Task_id[ 1 ]
58  );
59  directive_failed( status, "rtems_task_create of TASK1" );
60
61  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
62  directive_failed( status, "rtems_task_start of TASK1" );
63
64  status = rtems_task_create(
65    rtems_build_name( 'T', 'I', 'M', 'E' ),
66    (RTEMS_MAXIMUM_PRIORITY / 2),
67    RTEMS_MINIMUM_STACK_SIZE,
68    RTEMS_DEFAULT_MODES,
69    RTEMS_DEFAULT_ATTRIBUTES,
70    &Task_id[ 2 ]
71  );
72  directive_failed( status, "rtems_task_create of TASK2" );
73
74  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
75  directive_failed( status, "rtems_task_start of TASK2" );
76
77  status = rtems_task_create(
78    rtems_build_name( 'T', 'I', 'M', 'E' ),
79    (RTEMS_MAXIMUM_PRIORITY / 2u) - 1u,
80    RTEMS_MINIMUM_STACK_SIZE,
81    RTEMS_DEFAULT_MODES,
82    RTEMS_DEFAULT_ATTRIBUTES,
83    &Task_id[ 3 ]
84  );
85  directive_failed( status, "rtems_task_create of TASK3" );
86
87  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
88  directive_failed( status, "rtems_task_start of TASK3" );
89
90  rtems_task_exit();
91}
92
93rtems_asr Process_asr_for_pass_1(
94  rtems_signal_set signals
95)
96{
97  end_time = benchmark_timer_read();
98
99  put_time(
100    "rtems_signal_send: signal to self",
101    end_time,
102    1,
103    0,
104    0
105  );
106
107  benchmark_timer_initialize();
108}
109
110rtems_asr Process_asr_for_pass_2(
111  rtems_signal_set signals
112)
113{
114  rtems_status_code status;
115
116  status = rtems_task_resume( Task_id[ 3 ] );
117  directive_failed( status, "rtems_task_resume" );
118
119  benchmark_timer_initialize();
120}
121
122rtems_task Task_1(
123  rtems_task_argument argument
124)
125{
126  rtems_status_code status;
127
128  benchmark_timer_initialize();
129    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
130  end_time = benchmark_timer_read();
131
132  put_time(
133    "rtems_signal_catch: only case",
134    end_time,
135    1,
136    0,
137    0
138  );
139
140  benchmark_timer_initialize();
141    rtems_signal_send( Task_id[ 2 ], 1 );
142  end_time = benchmark_timer_read();
143
144  put_time(
145    "rtems_signal_send: returns to caller",
146    end_time,
147    1,
148    0,
149    0
150  );
151
152  benchmark_timer_initialize();
153    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
154
155  /* end time is done is RTEMS_ASR */
156
157  end_time = benchmark_timer_read();
158
159  put_time(
160    "rtems_signal: exit ASR overhead returns to calling task",
161    end_time,
162    1,
163    0,
164    0
165  );
166
167  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
168  directive_failed( status, "rtems_signal_catch" );
169
170  benchmark_timer_initialize();
171    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
172}
173
174/* avoid warnings for no prototype */
175rtems_asr Process_asr_for_task_2(
176  rtems_signal_set signals
177);
178
179rtems_asr Process_asr_for_task_2(
180  rtems_signal_set signals
181)
182{
183  ;
184}
185
186rtems_task Task_2(
187  rtems_task_argument argument
188)
189{
190  rtems_status_code status;
191
192  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
193  directive_failed( status, "rtems_signal_catch" );
194
195  (void) rtems_task_suspend( RTEMS_SELF );
196}
197
198rtems_task Task_3(
199  rtems_task_argument argument
200)
201{
202  (void) rtems_task_suspend( RTEMS_SELF );
203
204  end_time = benchmark_timer_read();
205
206  put_time(
207    "rtems_signal: exit ASR overhead returns to preempting task",
208    end_time,
209    1,
210    0,
211    0
212  );
213
214  TEST_END();
215  rtems_test_exit( 0 );
216}
Note: See TracBrowser for help on using the repository browser.