OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [libtests/] [cpuuse/] [init.c] - Blame information for rev 389

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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-1999.
11
 *  On-Line Applications Research Corporation (OAR).
12
 *
13
 *  The license and distribution terms for this file may be
14
 *  found in the file LICENSE in this distribution or at
15
 *  http://www.OARcorp.com/rtems/license.html.
16
 *
17
 *  $Id: init.c,v 1.2 2001-09-27 12:02:11 chris Exp $
18
 */
19
 
20
#define TEST_INIT
21
#include "system.h"
22
 
23
rtems_extensions_table Extensions = {
24
  NULL,                      /* task create user extension */
25
  NULL,                      /* task start user extension */
26
  NULL,                      /* task restart user extension */
27
  NULL,                      /* task delete user extension */
28
  Task_switch,               /* task switch user extension */
29
  NULL,                      /* task begin user extension */
30
  NULL,                      /* task exitted user extension */
31
  NULL                       /* fatal error user extension */
32
};
33
 
34
rtems_task Init(
35
  rtems_task_argument argument
36
)
37
{
38
  rtems_status_code status;
39
  rtems_time_of_day time;
40
 
41
  puts( "\n\n*** CPU USAGE LIBRARY TEST ***" );
42
  build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
43
 
44
  status = rtems_clock_set( &time );
45
  directive_failed( status, "rtems_clock_set" );
46
 
47
  Extension_name[ 1 ] =  rtems_build_name( 'E', 'X', 'T', ' ' );
48
 
49
  status = rtems_extension_create(
50
    Extension_name[ 1 ],
51
    &Extensions,
52
    &Extension_id[ 1 ]
53
  );
54
  directive_failed( status, "rtems_extension_create" );
55
 
56
  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
57
  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
58
  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
59
 
60
  Run_count[ 1 ] = 0;
61
  Run_count[ 2 ] = 0;
62
  Run_count[ 3 ] = 0;
63
 
64
  status = rtems_task_create(
65
     Task_name[ 1 ],
66
     1,
67
     RTEMS_MINIMUM_STACK_SIZE * 2,
68
     RTEMS_TIMESLICE,
69
     RTEMS_FLOATING_POINT,
70
     &Task_id[ 1 ]
71
  );
72
  directive_failed( status, "rtems_task_create of TA1" );
73
 
74
  status = rtems_task_create(
75
     Task_name[ 2 ],
76
     1,
77
     RTEMS_MINIMUM_STACK_SIZE * 2,
78
     RTEMS_TIMESLICE,
79
     RTEMS_FLOATING_POINT,
80
     &Task_id[ 2 ]
81
  );
82
  directive_failed( status, "rtems_task_create of TA2" );
83
 
84
  status = rtems_task_create(
85
     Task_name[ 3 ],
86
     1,
87
     RTEMS_MINIMUM_STACK_SIZE * 2,
88
     RTEMS_TIMESLICE,
89
     RTEMS_FLOATING_POINT,
90
     &Task_id[ 3 ]
91
  );
92
  directive_failed( status, "rtems_task_create of TA3" );
93
 
94
  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
95
  directive_failed( status, "rtems_task_start of TA1" );
96
 
97
  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
98
  directive_failed( status, "rtems_task_start of TA2" );
99
 
100
  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
101
  directive_failed( status, "rtems_task_start of TA3" );
102
 
103
  status = rtems_task_delete( RTEMS_SELF );
104
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
105
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.