source: rtems/c/src/tests/sptests/sp09/screen03.c @ 5a36154a

4.104.114.84.95
Last change on this file since 5a36154a was 5a36154a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/96 at 16:53:05

addition of optional user provided stack allocator means that we can not
reliably produce the "insufficient memory for stack space" error if this
extension is configured.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*  Screen3
2 *
3 *  This routine generates error screen 3 for test 9.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
10 *  On-Line Applications Research Corporation (OAR).
11 *  All rights assigned to U.S. Government, 1994.
12 *
13 *  This material may be reproduced by or for the U.S. Government pursuant
14 *  to the copyright license under the clause at DFARS 252.227-7013.  This
15 *  notice must appear in all copies of this file and its derivatives.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22extern rtems_configuration_table BSP_Configuration;
23extern rtems_cpu_table           _CPU_Table;
24
25void Screen3()
26{
27  rtems_name        task_name;
28  rtems_status_code status;
29
30  task_name = 1;
31  status = rtems_task_create(
32    0,
33    1,
34    RTEMS_MINIMUM_STACK_SIZE,
35    RTEMS_DEFAULT_MODES,
36    RTEMS_DEFAULT_ATTRIBUTES,
37    &Junk_id
38  );
39  fatal_directive_status(
40    status,
41    RTEMS_INVALID_NAME,
42    "rtems_task_create with illegal name"
43  );
44  puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" );
45
46  /*
47   * If the bsp provides its own stack allocator, then
48   * skip the test that tries to allocate a stack that is too big.
49   */
50
51  if (_CPU_Table.stack_allocate_hook)
52  {
53      puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED  -- SKIPPED" );
54  }
55  else
56  {
57      status = rtems_task_create(
58        task_name,
59        1,
60        BSP_Configuration.work_space_size,
61        RTEMS_DEFAULT_MODES,
62        RTEMS_DEFAULT_ATTRIBUTES,
63        &Junk_id
64      );
65      fatal_directive_status(
66        status,
67        RTEMS_UNSATISFIED,
68        "rtems_task_create with a stack size larger than the workspace"
69      );
70      puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" );
71  }
72
73  status = rtems_task_create(
74    Task_name[ 2 ],
75    4,
76    RTEMS_MINIMUM_STACK_SIZE,
77    RTEMS_DEFAULT_MODES,
78    RTEMS_DEFAULT_ATTRIBUTES,
79    &Task_id[ 2 ]
80  );
81  directive_failed( status, "rtems_task_create of TA2" );
82  puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" );
83
84  status = rtems_task_suspend( Task_id[ 2 ] );
85  directive_failed( status, "rtems_task_suspend of TA2" );
86  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" );
87
88  status = rtems_task_suspend( Task_id[ 2 ] );
89  fatal_directive_status(
90    status,
91    RTEMS_ALREADY_SUSPENDED,
92    "rtems_task_suspend of suspended TA2"
93  );
94  puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" );
95
96  status = rtems_task_resume( Task_id[ 2 ] );
97  directive_failed( status, "rtems_task_resume of TA2" );
98  puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" );
99
100  status = rtems_task_create(
101    Task_name[ 3 ],
102    4,
103    RTEMS_MINIMUM_STACK_SIZE,
104    RTEMS_DEFAULT_MODES,
105    RTEMS_DEFAULT_ATTRIBUTES,
106    &Task_id[ 3 ]
107  );
108  directive_failed( status, "rtems_task_create of TA3" );
109  puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" );
110
111  status = rtems_task_create(
112    Task_name[ 4 ],
113    4,
114    RTEMS_MINIMUM_STACK_SIZE,
115    RTEMS_DEFAULT_MODES,
116    RTEMS_DEFAULT_ATTRIBUTES,
117    &Task_id[ 4 ]
118  );
119  directive_failed( status, "rtems_task_create of TA4" );
120  puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" );
121
122  status = rtems_task_create(
123    Task_name[ 5 ],
124    4,
125    RTEMS_MINIMUM_STACK_SIZE,
126    RTEMS_DEFAULT_MODES,
127    RTEMS_DEFAULT_ATTRIBUTES,
128    &Task_id[ 5 ]
129  );
130  directive_failed( status, "rtems_task_create of TA5" );
131  puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" );
132
133  status = rtems_task_create(
134    Task_name[ 6 ],
135    4,
136    RTEMS_MINIMUM_STACK_SIZE,
137    RTEMS_DEFAULT_MODES,
138    RTEMS_DEFAULT_ATTRIBUTES,
139    &Task_id[ 6 ]
140  );
141  directive_failed( status, "rtems_task_create of TA6" );
142  puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" );
143
144  status = rtems_task_create(
145    Task_name[ 7 ],
146    4,
147    RTEMS_MINIMUM_STACK_SIZE,
148    RTEMS_DEFAULT_MODES,
149    RTEMS_DEFAULT_ATTRIBUTES,
150    &Task_id[ 7 ]
151  );
152  directive_failed( status, "rtems_task_create of TA7" );
153  puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" );
154
155  status = rtems_task_create(
156    Task_name[ 8 ],
157    4,
158    RTEMS_MINIMUM_STACK_SIZE,
159    RTEMS_DEFAULT_MODES,
160    RTEMS_DEFAULT_ATTRIBUTES,
161    &Task_id[ 8 ]
162  );
163  directive_failed( status, "rtems_task_create of TA8" );
164  puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" );
165
166  status = rtems_task_create(
167    Task_name[ 9 ],
168    4,
169    RTEMS_MINIMUM_STACK_SIZE,
170    RTEMS_DEFAULT_MODES,
171    RTEMS_DEFAULT_ATTRIBUTES,
172    &Task_id[ 9 ]
173  );
174  directive_failed( status, "rtems_task_create of TA9" );
175  puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" );
176
177  status = rtems_task_create(
178    Task_name[ 10 ],
179    4,
180    RTEMS_MINIMUM_STACK_SIZE,
181    RTEMS_DEFAULT_MODES,
182    RTEMS_DEFAULT_ATTRIBUTES,
183    &Task_id[ 10 ]
184  );
185  directive_failed( status, "rtems_task_create of TA10" );
186  puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" );
187
188  status = rtems_task_create(
189    task_name,
190    4,
191    RTEMS_MINIMUM_STACK_SIZE,
192    RTEMS_DEFAULT_MODES,
193    RTEMS_DEFAULT_ATTRIBUTES,
194    &Junk_id
195  );
196  fatal_directive_status(
197    status,
198    RTEMS_TOO_MANY,
199    "rtems_task_create for too many tasks"
200  );
201  puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" );
202
203  status = rtems_task_create(
204    task_name,
205    4,
206    RTEMS_MINIMUM_STACK_SIZE,
207    RTEMS_DEFAULT_MODES,
208    RTEMS_GLOBAL,
209    &Junk_id
210  );
211  fatal_directive_status(
212    status,
213    RTEMS_MP_NOT_CONFIGURED,
214    "rtems_task_create of global task in a single cpu system"
215  );
216  puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" );
217}
Note: See TracBrowser for help on using the repository browser.