source: rtems/testsuites/tmtests/tm17/task1.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
4 *  On-Line Applications Research Corporation (OAR).
5 *  All rights assigned to U.S. Government, 1994.
6 *
7 *  This material may be reproduced by or for the U.S. Government pursuant
8 *  to the copyright license under the clause at DFARS 252.227-7013.  This
9 *  notice must appear in all copies of this file and its derivatives.
10 *
11 *  $Id$
12 */
13
14#include "system.h"
15#undef EXTERN
16#define EXTERN
17#include "conftbl.h"
18#include "gvar.h"
19
20rtems_unsigned32 Task_count;
21rtems_task_priority Task_priority;
22
23rtems_task First_task(
24  rtems_task_argument argument
25);
26
27rtems_task Middle_tasks(
28  rtems_task_argument argument
29);
30
31rtems_task Last_task(
32  rtems_task_argument argument
33);
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  rtems_task_entry  task_entry;
40  rtems_unsigned32  index;
41  rtems_status_code status;
42
43  puts( "\n\n*** TIME TEST 17 ***" );
44
45  Task_priority = 254;
46
47  for( index = 0; index <= OPERATION_COUNT ; index++ ) {
48    status = rtems_task_create(
49      rtems_build_name( 'T', 'I', 'M', 'E' ),
50      Task_priority,
51      1024,
52      RTEMS_DEFAULT_MODES,
53      RTEMS_DEFAULT_ATTRIBUTES,
54      &Task_id[ index ]
55    );
56    directive_failed( status, "rtems_task_create loop" );
57
58    if ( index == OPERATION_COUNT ) task_entry = Last_task;
59    else if ( index == 0 )          task_entry = First_task;
60    else                            task_entry = Middle_tasks;
61
62    status = rtems_task_start( Task_id[ index ], task_entry, 0 );
63    directive_failed( status, "rtems_task_start loop" );
64  }
65
66  Task_count = 1;
67  status = rtems_task_delete( RTEMS_SELF );
68  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
69}
70
71rtems_task First_task(
72  rtems_task_argument argument
73)
74{
75  rtems_task_priority previous_priority;
76
77  Timer_initialize();
78
79  Task_priority--;
80  Task_count++;
81
82  (void) rtems_task_set_priority(
83           Task_id[ Task_count ],
84           Task_priority,
85           &previous_priority
86         );
87}
88
89rtems_task Middle_tasks(
90  rtems_task_argument argument
91)
92{
93  rtems_task_priority previous_priority;
94
95  Task_priority--;
96  Task_count++;
97
98  (void) rtems_task_set_priority(
99           Task_id[ Task_count ],
100           Task_priority,
101           &previous_priority
102         );
103}
104
105rtems_task Last_task(
106  rtems_task_argument argument
107)
108{
109  rtems_unsigned32 index;
110
111  end_time = Read_timer();
112
113  Timer_initialize();
114    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
115      (void) Empty_function();
116  overhead = Read_timer();
117
118  put_time(
119    "rtems_task_set_priority (preemptive)",
120    end_time,
121    OPERATION_COUNT,
122    overhead,
123    CALLING_OVERHEAD_TASK_SET_PRIORITY
124  );
125
126  exit( 0 );
127}
Note: See TracBrowser for help on using the repository browser.