source: rtems/testsuites/libtests/cpuuse/init.c @ 77bf1b1

4.104.114.84.95
Last change on this file since 77bf1b1 was 77bf1b1, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 21, 1998 at 3:37:43 PM

Corrected typo in copyright notice.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/* 
2 *  This is a clone of sp04 which has been modified to use the cpu monitoring
3 *  library.
4 *
5 *  Input parameters:
6 *    argument - task argument
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1998.
11 *  On-Line Applications Research Corporation (OAR).
12 *  Copyright assigned to U.S. Government, 1994.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.OARcorp.com/rtems/license.html.
17 *
18 *  $Id$
19 */
20
21#define TEST_INIT
22#include "system.h"
23
24rtems_extensions_table Extensions = {
25  NULL,                      /* task create user extension */
26  NULL,                      /* task start user extension */
27  NULL,                      /* task restart user extension */
28  NULL,                      /* task delete user extension */
29  Task_switch,               /* task switch user extension */
30  NULL,                      /* task begin user extension */
31  NULL,                      /* task exitted user extension */
32  NULL                       /* fatal error user extension */
33};
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  rtems_status_code status;
40  rtems_time_of_day time;
41
42  puts( "\n\n*** CPU USAGE LIBRARY TEST ***" );
43  build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
44
45  status = rtems_clock_set( &time );
46  directive_failed( status, "rtems_clock_set" );
47
48  Extension_name[ 1 ] =  rtems_build_name( 'E', 'X', 'T', ' ' );
49
50  status = rtems_extension_create(
51    Extension_name[ 1 ],
52    &Extensions,
53    &Extension_id[ 1 ]
54  );
55  directive_failed( status, "rtems_extension_create" );
56
57  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
58  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
59  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
60
61  Run_count[ 1 ] = 0;
62  Run_count[ 2 ] = 0;
63  Run_count[ 3 ] = 0;
64
65  status = rtems_task_create(
66     Task_name[ 1 ],
67     1,
68     RTEMS_MINIMUM_STACK_SIZE * 2,
69     RTEMS_TIMESLICE,
70     RTEMS_FLOATING_POINT,
71     &Task_id[ 1 ]
72  );
73  directive_failed( status, "rtems_task_create of TA1" );
74
75  status = rtems_task_create(
76     Task_name[ 2 ],
77     1,
78     RTEMS_MINIMUM_STACK_SIZE * 2,
79     RTEMS_TIMESLICE,
80     RTEMS_FLOATING_POINT,
81     &Task_id[ 2 ]
82  );
83  directive_failed( status, "rtems_task_create of TA2" );
84
85  status = rtems_task_create(
86     Task_name[ 3 ],
87     1,
88     RTEMS_MINIMUM_STACK_SIZE * 2,
89     RTEMS_TIMESLICE,
90     RTEMS_FLOATING_POINT,
91     &Task_id[ 3 ]
92  );
93  directive_failed( status, "rtems_task_create of TA3" );
94
95  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
96  directive_failed( status, "rtems_task_start of TA1" );
97
98  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
99  directive_failed( status, "rtems_task_start of TA2" );
100
101  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
102  directive_failed( status, "rtems_task_start of TA3" );
103
104  status = rtems_task_delete( RTEMS_SELF );
105  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
106}
Note: See TracBrowser for help on using the repository browser.