source: rtems/testsuites/tmtests/tm06/task1.c @ 0720ff4

4.104.114.84.95
Last change on this file since 0720ff4 was 0720ff4, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 28, 2004 at 7:20:11 AM

2004-03-28 Ralf Corsepius <ralf_corsepius@…>

  • include/timesys.h, tm01/task1.c, tm02/task1.c, tm03/task1.c, tm04/task1.c, tm05/task1.c, tm06/task1.c, tm07/task1.c, tm08/task1.c, tm09/task1.c, tm10/task1.c, tm11/task1.c, tm12/task1.c, tm13/task1.c, tm14/task1.c, tm15/task1.c, tm16/task1.c, tm17/task1.c, tm18/task1.c, tm20/task1.c, tm21/task1.c, tm22/task1.c, tm23/task1.c, tm24/task1.c, tm25/task1.c, tm26/task1.c, tm27/task1.c, tm28/task1.c, tm29/task1.c, tmck/task1.c, tmoverhd/testtask.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 *
3 *  COPYRIGHT (c) 1989-1999.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#define TEST_INIT
14#include "system.h"
15
16rtems_id Task_id[ OPERATION_COUNT + 1 ];
17
18uint32_t   Task_restarted;
19
20rtems_task null_task(
21  rtems_task_argument argument
22);
23
24rtems_task Task_1(
25  rtems_task_argument argument
26);
27
28void test_init( void );
29
30rtems_task Init(
31  rtems_task_argument argument
32)
33{
34  rtems_status_code status;
35
36  Print_Warning();
37
38  puts( "\n\n*** TIME TEST 6 ***" );
39
40  test_init();
41
42  status = rtems_task_delete( RTEMS_SELF );
43  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
44}
45
46void test_init( void )
47{
48  rtems_status_code status;
49  rtems_id id;
50
51  Task_restarted = OPERATION_COUNT;
52
53  status = rtems_task_create(
54    rtems_build_name( 'T', 'I', 'M', 'E' ),
55    128,
56    RTEMS_MINIMUM_STACK_SIZE,
57    RTEMS_DEFAULT_MODES,
58    RTEMS_DEFAULT_ATTRIBUTES,
59    &id
60  );
61  directive_failed( status, "rtems_task_create" );
62
63  status = rtems_task_start( id, Task_1, 0 );
64  directive_failed( status, "rtems_task_start" );
65}
66
67rtems_task Task_1(
68  rtems_task_argument argument
69)
70{
71  rtems_status_code status;
72  uint32_t    index;
73
74  if ( Task_restarted == OPERATION_COUNT )
75     Timer_initialize();
76
77  Task_restarted--;
78
79  if ( Task_restarted != 0 )
80    (void) rtems_task_restart( RTEMS_SELF, 0 );
81
82  end_time = Read_timer();
83
84  Timer_initialize();
85    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
86      (void) Empty_function();
87  overhead = Read_timer();
88
89  put_time(
90    "rtems_task_restart: calling task",
91    end_time,
92    OPERATION_COUNT,
93    overhead,
94    CALLING_OVERHEAD_TASK_RESTART
95  );
96
97  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
98    status = rtems_task_create(
99      rtems_build_name( 'T', 'I', 'M', 'E' ),
100      254,
101      RTEMS_MINIMUM_STACK_SIZE,
102      RTEMS_DEFAULT_MODES,
103      RTEMS_DEFAULT_ATTRIBUTES,
104      &Task_id[ index ]
105    );
106    directive_failed( status, "rtems_task_create loop" );
107
108    status = rtems_task_start( Task_id[ index ], null_task, 0 );
109    directive_failed( status, "rtems_task_start loop" );
110  }
111
112  Timer_initialize();
113    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
114      (void) rtems_task_suspend( Task_id[ index ] );
115  end_time = Read_timer();
116
117  put_time(
118    "rtems_task_suspend: returns to caller",
119    end_time,
120    OPERATION_COUNT,
121    0,
122    CALLING_OVERHEAD_TASK_SUSPEND
123  );
124
125  Timer_initialize();
126    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
127      (void) rtems_task_resume( Task_id[ index ] );
128  end_time = Read_timer();
129
130  put_time(
131    "rtems_task_resume: task readied -- returns to caller",
132    end_time,
133    OPERATION_COUNT,
134    0,
135    CALLING_OVERHEAD_TASK_RESUME
136  );
137
138  Timer_initialize();
139    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
140      (void) rtems_task_delete( Task_id[ index ] );
141  end_time = Read_timer();
142
143  put_time(
144    "rtems_task_delete: ready task",
145    end_time,
146    OPERATION_COUNT,
147    0,
148    CALLING_OVERHEAD_TASK_RESUME
149  );
150
151  puts( "*** END OF TEST 6 ***" );
152  rtems_test_exit( 0 );
153}
154
155rtems_task null_task(
156  rtems_task_argument argument
157)
158{
159  while ( FOREVER )
160    ;
161}
Note: See TracBrowser for help on using the repository browser.