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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp12/] [init.c] - Blame information for rev 373

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

Line No. Rev Author Line
1 30 unneback
/*  Init
2
 *
3
 *  This routine is the initialization task for this test program.
4
 *  It is a user initialization task and has the responsibility for creating
5
 *  and starting the tasks that make up the test.  If the time of day
6
 *  clock is required for the test, it should also be set to a known
7
 *  value by this function.
8
 *
9
 *  Input parameters:
10
 *    argument - task argument
11
 *
12
 *  Output parameters:  NONE
13
 *
14
 *  COPYRIGHT (c) 1989-1999.
15
 *  On-Line Applications Research Corporation (OAR).
16
 *
17
 *  The license and distribution terms for this file may be
18
 *  found in the file LICENSE in this distribution or at
19
 *  http://www.OARcorp.com/rtems/license.html.
20
 *
21
 *  $Id: init.c,v 1.2 2001-09-27 12:02:32 chris Exp $
22
 */
23
 
24
#define TEST_INIT
25
#include "system.h"
26
 
27
rtems_task Init(
28
  rtems_task_argument argument
29
)
30
{
31
  rtems_status_code status;
32
 
33
  puts( "\n\n*** TEST 12 ***" );
34
 
35
  Task_name[ 1 ]          = rtems_build_name( 'T', 'A', '1', ' ' );
36
  Task_name[ 2 ]          = rtems_build_name( 'T', 'A', '2', ' ' );
37
  Task_name[ 3 ]          = rtems_build_name( 'T', 'A', '3', ' ' );
38
  Task_name[ 4 ]          = rtems_build_name( 'T', 'A', '4', ' ' );
39
  Task_name[ 5 ]          = rtems_build_name( 'T', 'A', '5', ' ' );
40
 
41
  Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
42
  Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
43
  Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
44
  Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
45
  Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
46
 
47
  Semaphore_name[ 1 ]     = rtems_build_name( 'S', 'M', '1', ' ' );
48
  Semaphore_name[ 2 ]     = rtems_build_name( 'S', 'M', '2', ' ' );
49
  Semaphore_name[ 3 ]     = rtems_build_name( 'S', 'M', '3', ' ' );
50
 
51
  status = rtems_semaphore_create(
52
    Semaphore_name[ 1 ],
53
    1,
54
    RTEMS_DEFAULT_ATTRIBUTES,
55
    RTEMS_NO_PRIORITY,
56
    &Semaphore_id[ 1 ]
57
  );
58
  directive_failed( status, "rtems_semaphore_create of SM1" );
59
 
60
  status = rtems_semaphore_create(
61
    Semaphore_name[ 2 ],
62
    0,
63
    RTEMS_PRIORITY,
64
    RTEMS_NO_PRIORITY,
65
    &Semaphore_id[ 2 ]
66
  );
67
  directive_failed( status, "rtems_semaphore_create of SM2" );
68
 
69
  status = rtems_semaphore_create(
70
    Semaphore_name[ 3 ],
71
    1,
72
    RTEMS_DEFAULT_ATTRIBUTES,
73
    RTEMS_NO_PRIORITY,
74
    &Semaphore_id[ 3 ]
75
  );
76
  directive_failed( status, "rtems_semaphore_create of SM3" );
77
 
78
  puts( "INIT - Forward priority queue test" );
79
  Priority_test_driver( 0 );
80
 
81
  puts( "INIT - Backward priority queue test" );
82
  Priority_test_driver( 32 );
83
 
84
rtems_test_pause();
85
 
86
  puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
87
 
88
  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
89
  directive_failed( status, "rtems_semaphore_delete of SM2" );
90
 
91
  puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
92
  status = rtems_semaphore_create(
93
    Semaphore_name[ 2 ],
94
    0,
95
    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
96
    RTEMS_NO_PRIORITY,
97
    &Semaphore_id[ 2 ]
98
  );
99
  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
100
 
101
  puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
102
  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
103
  directive_failed( status, "rtems_semaphore_release of SM2" );
104
 
105
  puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
106
  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
107
  directive_failed( status, "rtems_semaphore_delete of SM2" );
108
 
109
  status = rtems_semaphore_create(
110
    Semaphore_name[ 2 ],
111
    1,
112
    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
113
    RTEMS_NO_PRIORITY,
114
    &Semaphore_id[ 2 ]
115
  );
116
  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
117
 
118
  Priority_test_driver( 64 );
119
 
120
rtems_test_pause();
121
 
122
  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
123
  directive_failed( status, "rtems_semaphore_delete of SM2" );
124
 
125
  status = rtems_semaphore_create(
126
    Semaphore_name[ 2 ],
127
    0,
128
    RTEMS_PRIORITY,
129
    RTEMS_NO_PRIORITY,
130
    &Semaphore_id[ 2 ]
131
  );
132
  directive_failed( status, "rtems_semaphore_create of priority SM2" );
133
 
134
  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
135
  directive_failed( status, "rtems_semaphore_release of SM2" );
136
 
137
  status = rtems_task_create(
138
    Task_name[ 1 ],
139
    4,
140
    RTEMS_MINIMUM_STACK_SIZE * 2,
141
    RTEMS_DEFAULT_MODES,
142
    RTEMS_DEFAULT_ATTRIBUTES,
143
    &Task_id[ 1 ]
144
  );
145
  directive_failed( status, "rtems_task_create of TA1" );
146
 
147
  status = rtems_task_create(
148
    Task_name[ 2 ],
149
    4,
150
    RTEMS_MINIMUM_STACK_SIZE,
151
    RTEMS_DEFAULT_MODES,
152
    RTEMS_DEFAULT_ATTRIBUTES,
153
    &Task_id[ 2 ]
154
  );
155
  directive_failed( status, "rtems_task_create of TA2" );
156
 
157
  status = rtems_task_create(
158
    Task_name[ 3 ],
159
    4,
160
    RTEMS_MINIMUM_STACK_SIZE,
161
    RTEMS_DEFAULT_MODES,
162
    RTEMS_DEFAULT_ATTRIBUTES,
163
    &Task_id[ 3 ]
164
  );
165
  directive_failed( status, "rtems_task_create of TA3" );
166
 
167
  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
168
  directive_failed( status, "rtems_task_start of TA1" );
169
 
170
  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
171
  directive_failed( status, "rtems_task_start of TA2" );
172
 
173
  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
174
  directive_failed( status, "rtems_task_start of TA3" );
175
 
176
  status = rtems_task_delete( RTEMS_SELF );
177
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
178
}

powered by: WebSVN 2.1.0

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