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

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.6 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 5";
20
21rtems_id   Task_id[OPERATION_COUNT+1];
22uint32_t   Task_index;
23
24rtems_task High_task(
25  rtems_task_argument argument
26);
27
28rtems_task Middle_tasks(
29  rtems_task_argument argument
30);
31
32rtems_task Low_task(
33  rtems_task_argument argument
34);
35
36extern void test_init(void);
37
38int operation_count = OPERATION_COUNT;
39
40rtems_task Init(
41  rtems_task_argument argument
42)
43{
44  Print_Warning();
45
46  TEST_BEGIN();
47
48  test_init();
49
50  rtems_task_exit();
51}
52
53void test_init(void)
54{
55  rtems_status_code   status;
56  rtems_task_entry    task_entry;
57  rtems_task_priority priority;
58  uint32_t      index;
59
60  priority = RTEMS_MAXIMUM_PRIORITY - 1;
61
62  if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2 )
63    operation_count =  RTEMS_MAXIMUM_PRIORITY - 2;
64
65  for( index = 0; index <= operation_count ; index++ ) {
66
67    status = rtems_task_create(
68      rtems_build_name( 'T', 'I', 'M', 'E' ),
69      priority,
70      RTEMS_MINIMUM_STACK_SIZE,
71      RTEMS_DEFAULT_MODES,
72      RTEMS_DEFAULT_ATTRIBUTES,
73      &Task_id[ index ]
74    );
75    directive_failed( status, "rtems_task_create loop" );
76
77    priority--;
78
79    if ( index==0 )                    task_entry = Low_task;
80    else if ( index==operation_count ) task_entry = High_task;
81    else                               task_entry = Middle_tasks;
82
83    status = rtems_task_start( Task_id[ index ], task_entry, 0 );
84    directive_failed( status, "rtems_task_start loop" );
85  }
86}
87
88rtems_task High_task(
89  rtems_task_argument argument
90)
91{
92  benchmark_timer_initialize();
93
94  (void) rtems_task_suspend( RTEMS_SELF );
95
96  end_time = benchmark_timer_read();
97
98  put_time(
99    "rtems_task_resume: task readied preempts caller",
100    end_time,
101    operation_count,
102    0,
103    0
104  );
105
106  TEST_END();
107  rtems_test_exit( 0 );
108}
109
110rtems_task Middle_tasks(
111  rtems_task_argument argument
112)
113{
114  (void) rtems_task_suspend( RTEMS_SELF );
115
116  Task_index++;
117  (void) rtems_task_resume( Task_id[ Task_index ] );
118}
119
120rtems_task Low_task(
121  rtems_task_argument argument
122)
123{
124
125  end_time = benchmark_timer_read();
126
127  put_time(
128    "rtems_task_suspend: calling task",
129    end_time,
130    operation_count,
131    0,
132    0
133  );
134
135  Task_index = 1;
136  benchmark_timer_initialize();
137  (void) rtems_task_resume( Task_id[ Task_index ] );
138}
Note: See TracBrowser for help on using the repository browser.