source: rtems/testsuites/sptests/sp12/init.c @ 46c23871

5
Last change on this file since 46c23871 was 46c23871, checked in by Sebastian Huber <sebastian.huber@…>, on 06/16/20 at 05:28:58

rtems: Remove RTEMS_MP_NOT_CONFIGURED error

Some objects can be created with a local or global scope in a
multiprocessing network. In non-multiprocessing configurations setting
the scope to local or global had no effect since such a system can be
viewed as a multiprocessing network with just one node. One and all
nodes is the same in such a network. However, if multiprocessing was
configured, creation of a global object in a single node network
resulted in an RTEMS_MP_NOT_CONFIGURED error. Remove this error
condition for symmetry to the non-multiprocessing setup. This is in line
with the task affinity behaviour in SMP systems.

Update #4005.

  • Property mode set to 100644
File size: 5.2 KB
Line 
1/*  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-2009.
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.rtems.org/license/LICENSE.
20 */
21
22#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25
26#define CONFIGURE_INIT
27#include "system.h"
28
29const char rtems_test_name[] = "SP 12";
30
31rtems_task Init(
32  rtems_task_argument argument
33)
34{
35  rtems_status_code status;
36
37  TEST_BEGIN();
38
39  Task_name[ 1 ]          = rtems_build_name( 'T', 'A', '1', ' ' );
40  Task_name[ 2 ]          = rtems_build_name( 'T', 'A', '2', ' ' );
41  Task_name[ 3 ]          = rtems_build_name( 'T', 'A', '3', ' ' );
42  Task_name[ 4 ]          = rtems_build_name( 'T', 'A', '4', ' ' );
43  Task_name[ 5 ]          = rtems_build_name( 'T', 'A', '5', ' ' );
44
45  Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' );
46  Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' );
47  Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' );
48  Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' );
49  Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' );
50
51  Semaphore_name[ 1 ]     = rtems_build_name( 'S', 'M', '1', ' ' );
52  Semaphore_name[ 2 ]     = rtems_build_name( 'S', 'M', '2', ' ' );
53  Semaphore_name[ 3 ]     = rtems_build_name( 'S', 'M', '3', ' ' );
54
55  status = rtems_semaphore_create(
56    Semaphore_name[ 1 ],
57    1,
58    RTEMS_DEFAULT_ATTRIBUTES,
59    RTEMS_NO_PRIORITY,
60    &Semaphore_id[ 1 ]
61  );
62  directive_failed( status, "rtems_semaphore_create of SM1" );
63
64  status = rtems_semaphore_create(
65    Semaphore_name[ 2 ],
66    0,
67    RTEMS_PRIORITY,
68    RTEMS_NO_PRIORITY,
69    &Semaphore_id[ 2 ]
70  );
71  directive_failed( status, "rtems_semaphore_create of SM2" );
72
73  status = rtems_semaphore_create(
74    Semaphore_name[ 3 ],
75    1,
76    RTEMS_GLOBAL,
77    RTEMS_NO_PRIORITY,
78    &Semaphore_id[ 3 ]
79  );
80  directive_failed( status, "rtems_semaphore_create of SM3" );
81
82  puts( "INIT - Forward priority queue test" );
83  Priority_test_driver( 0 );
84
85  puts( "INIT - Backward priority queue test" );
86  Priority_test_driver( (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u );
87
88  puts( "INIT - Binary Semaphore and Priority Inheritance Test" );
89
90  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
91  directive_failed( status, "rtems_semaphore_delete of SM2 #1" );
92
93  puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
94  status = rtems_semaphore_create(
95    Semaphore_name[ 2 ],
96    0,
97    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
98    RTEMS_NO_PRIORITY,
99    &Semaphore_id[ 2 ]
100  );
101  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
102
103  puts( "INIT - rtems_semaphore_release - allocated binary semaphore" );
104  status = rtems_semaphore_release( Semaphore_id[ 2 ] );
105  directive_failed( status, "rtems_semaphore_release of SM2" );
106
107  puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
108  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
109  directive_failed( status, "rtems_semaphore_delete of SM2 #2" );
110
111  status = rtems_semaphore_create(
112    Semaphore_name[ 2 ],
113    1,
114    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
115    RTEMS_NO_PRIORITY,
116    &Semaphore_id[ 2 ]
117  );
118  directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
119
120  Priority_test_driver( PRIORITY_INHERIT_BASE_PRIORITY );
121
122  status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
123  directive_failed( status, "rtems_semaphore_delete of SM2 #3" );
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  rtems_task_exit();
177}
Note: See TracBrowser for help on using the repository browser.