source: rtems/testsuites/tmtests/tm06/task1.c @ ced11f99

4.104.114.84.95
Last change on this file since ced11f99 was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

  • Property mode set to 100644
File size: 3.3 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#define TEST_INIT
15#include "system.h"
16
17rtems_id Task_id[ OPERATION_COUNT + 1 ];
18
19rtems_unsigned32 Task_restarted;
20
21rtems_task null_task(
22  rtems_task_argument argument
23);
24
25rtems_task Task_1(
26  rtems_task_argument argument
27);
28
29void test_init( void );
30
31rtems_task Init(
32  rtems_task_argument argument
33)
34{
35  rtems_status_code status;
36
37  Print_Warning();
38
39  puts( "\n\n*** TIME TEST 6 ***" );
40
41  test_init();
42
43  status = rtems_task_delete( RTEMS_SELF );
44  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
45}
46
47void test_init( void )
48{
49  rtems_status_code status;
50  rtems_id id;
51
52  Task_restarted = OPERATION_COUNT;
53
54  status = rtems_task_create(
55    rtems_build_name( 'T', 'I', 'M', 'E' ),
56    128,
57    1024,
58    RTEMS_DEFAULT_MODES,
59    RTEMS_DEFAULT_ATTRIBUTES,
60    &id
61  );
62  directive_failed( status, "rtems_task_create" );
63
64  status = rtems_task_start( id, Task_1, 0 );
65  directive_failed( status, "rtems_task_start" );
66}
67
68rtems_task Task_1(
69  rtems_task_argument argument
70)
71{
72  rtems_status_code status;
73  rtems_unsigned32  index;
74
75  if ( Task_restarted == OPERATION_COUNT )
76     Timer_initialize();
77
78  Task_restarted--;
79
80  if ( Task_restarted != 0 )
81    (void) rtems_task_restart( RTEMS_SELF, 0 );
82
83  end_time = Read_timer();
84
85  Timer_initialize();
86    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
87      (void) Empty_function();
88  overhead = Read_timer();
89
90  put_time(
91    "rtems_task_restart self",
92    end_time,
93    OPERATION_COUNT,
94    overhead,
95    CALLING_OVERHEAD_TASK_RESTART
96  );
97
98  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
99    status = rtems_task_create(
100      rtems_build_name( 'T', 'I', 'M', 'E' ),
101      254,
102      1024,
103      RTEMS_DEFAULT_MODES,
104      RTEMS_DEFAULT_ATTRIBUTES,
105      &Task_id[ index ]
106    );
107    directive_failed( status, "rtems_task_create loop" );
108
109    status = rtems_task_start( Task_id[ index ], null_task, 0 );
110    directive_failed( status, "rtems_task_start loop" );
111  }
112
113  Timer_initialize();
114    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
115      (void) rtems_task_suspend( Task_id[ index ] );
116  end_time = Read_timer();
117
118  put_time(
119    "rtems_task_suspend (no preempt)",
120    end_time,
121    OPERATION_COUNT,
122    0,
123    CALLING_OVERHEAD_TASK_SUSPEND
124  );
125
126  Timer_initialize();
127    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
128      (void) rtems_task_resume( Task_id[ index ] );
129  end_time = Read_timer();
130
131  put_time(
132    "rtems_task_resume (no preempt)",
133    end_time,
134    OPERATION_COUNT,
135    0,
136    CALLING_OVERHEAD_TASK_RESUME
137  );
138
139  Timer_initialize();
140    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
141      (void) rtems_task_delete( Task_id[ index ] );
142  end_time = Read_timer();
143
144  put_time(
145    "rtems_task_delete (others)",
146    end_time,
147    OPERATION_COUNT,
148    0,
149    CALLING_OVERHEAD_TASK_RESUME
150  );
151
152  puts( "*** END OF TEST 6 ***" );
153  exit( 0 );
154}
155
156rtems_task null_task(
157  rtems_task_argument argument
158)
159{
160  while ( FOREVER )
161    ;
162}
Note: See TracBrowser for help on using the repository browser.