source: rtems/testsuites/tmtests/tm17/task1.c

5
Last change on this file was fdeaa64, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 3, 2020 at 12:01:56 PM

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: 2.8 KB
Line 
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.org/license/LICENSE.
8 */
9
10#if !defined(OPERATION_COUNT)
11#define OPERATION_COUNT 100
12#endif
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/btimer.h>
19
20#define CONFIGURE_INIT
21#include "system.h"
22
23const char rtems_test_name[] = "TIME TEST 17";
24
25uint32_t   Task_count;
26rtems_task_priority Task_priority;
27
28rtems_task First_task(
29  rtems_task_argument argument
30);
31
32rtems_task Middle_tasks(
33  rtems_task_argument argument
34);
35
36rtems_task Last_task(
37  rtems_task_argument argument
38);
39
40int operation_count = OPERATION_COUNT;
41
42rtems_task Init(
43  rtems_task_argument argument
44)
45{
46  rtems_task_entry  task_entry;
47  int               index;
48  rtems_status_code status;
49
50  Print_Warning();
51
52  TEST_BEGIN();
53
54  Task_priority = RTEMS_MAXIMUM_PRIORITY - 1u;
55  if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2u )
56    operation_count =  (int) (RTEMS_MAXIMUM_PRIORITY - 2u);
57
58  for( index = 0; index < operation_count ; index++ ) {
59    status = rtems_task_create(
60      rtems_build_name( 'T', 'I', 'M', 'E' ),
61      Task_priority,
62      RTEMS_MINIMUM_STACK_SIZE,
63      RTEMS_DEFAULT_MODES,
64      RTEMS_DEFAULT_ATTRIBUTES,
65      &Task_id[ index ]
66    );
67    directive_failed( status, "rtems_task_create loop" );
68
69    if ( index == operation_count-1 ) task_entry = Last_task;
70    else if ( index == 0 )            task_entry = First_task;
71    else                              task_entry = Middle_tasks;
72
73    status = rtems_task_start( Task_id[ index ], task_entry, 0 );
74    directive_failed( status, "rtems_task_start loop" );
75  }
76
77  Task_count = 1;
78  rtems_task_exit();
79}
80
81rtems_task First_task(
82  rtems_task_argument argument
83)
84{
85  rtems_task_priority previous_priority;
86
87  benchmark_timer_initialize();
88
89  Task_priority--;
90  Task_count++;
91
92  (void) rtems_task_set_priority(
93           Task_id[ Task_count ],
94           Task_priority,
95           &previous_priority
96         );
97}
98
99rtems_task Middle_tasks(
100  rtems_task_argument argument
101)
102{
103  rtems_task_priority previous_priority;
104
105  Task_priority--;
106  Task_count++;
107
108  (void) rtems_task_set_priority(
109           Task_id[ Task_count ],
110           Task_priority,
111           &previous_priority
112         );
113}
114
115rtems_task Last_task(
116  rtems_task_argument argument
117)
118{
119  int index;
120
121  end_time = benchmark_timer_read();
122
123  benchmark_timer_initialize();
124    for ( index=1 ; index < operation_count ; index++ )
125      (void) benchmark_timer_empty_function();
126  overhead = benchmark_timer_read();
127
128  put_time(
129    "rtems_task_set_priority: preempts caller",
130    end_time,
131    operation_count - 1u,
132    overhead,
133    0
134  );
135
136  TEST_END();
137  rtems_test_exit( 0 );
138}
Note: See TracBrowser for help on using the repository browser.