source: rtems/testsuites/sptests/sp07/init.c @ b84f1fdc

4.104.11
Last change on this file since b84f1fdc was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on May 10, 2009 at 2:39:46 PM

2009-05-10 Joel Sherrill <joel.sherrill@…>

  • sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c, sp12/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp15/init.c, sp16/system.h, sp19/fptask.c, sp25/system.h, sp26/task1.c, sp27/init.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp33/init.c, sp34/changepri.c, sp35/priinv.c, sp37/init.c, sp38/init.c, sp39/init.c, sp41/init.c, sp42/init.c, sp43/init.c, sp44/init.c, sp45/init.c, sp46/init.c, sp47/init.c, sp48/init.c, spfatal03/testcase.h, spfatal05/testcase.h, spfatal06/testcase.h, spfatal_support/system.h, spobjgetnext/init.c, spsize/getint.c, spsize/size.c: Fix warnings.
  • Property mode set to 100644
File size: 6.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.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#define CONFIGURE_INIT
25#include "system.h"
26
27rtems_extensions_table Extensions = {
28  Task_create_extension,     /* task create user extension */
29  Task_start_extension,      /* task start user extension */
30  Task_restart_extension,    /* task restart user extension */
31  Task_delete_extension,     /* task delete user extension */
32  NULL,                      /* task switch user extension */
33  NULL,                      /* begin user extension */
34  Task_exit_extension,       /* task exitted user extension */
35  NULL                       /* fatal error extension */
36};
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42  rtems_status_code status;
43  rtems_id          id;
44
45  puts( "\n\n*** TEST 7 ***" );
46
47  buffered_io_initialize();
48
49  Extension_name[ 1 ] =  rtems_build_name( 'E', 'X', 'T', '1' );
50  Extension_name[ 2 ] =  rtems_build_name( 'E', 'X', 'T', '2' );
51
52  puts  ( "rtems_extension_create - bad id pointer -- RTEMS_INVALID_ADDRESS" );
53  status = rtems_extension_create( 0xa5a5a5a5, &Extensions, NULL );
54  fatal_directive_status(
55    status, RTEMS_INVALID_ADDRESS, "rtems_extension_create" );
56
57  puts  ( "rtems_extension_create - bad name -- RTEMS_INVALID_NAME" );
58  status = rtems_extension_create( 0, &Extensions, &id );
59  fatal_directive_status(
60    status, RTEMS_INVALID_NAME, "rtems_extension_create #1" );
61
62  puts( "rtems_extension_create - first one -- OK" );
63  status = rtems_extension_create(
64    Extension_name[ 1 ],
65    &Extensions,
66    &Extension_id[ 1 ]
67  );
68  directive_failed( status, "rtems_extension_create" );
69
70  puts( "rtems_extension_create - second one-- OK" );
71  status = rtems_extension_create(
72    Extension_name[ 2 ],
73    &Extensions,
74    &Extension_id[ 2 ]
75  );
76  directive_failed( status, "rtems_extension_create #2" );
77
78  puts  ( "rtems_extension_create -- RTEMS_TOO_MANY" );
79  status = rtems_extension_create( 0xa5a5a5a5, &Extensions, &id );
80  fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_extension_create" );
81
82  puts( "rtems_extension_delete - second one -- OK" );
83  status = rtems_extension_delete( Extension_id[ 2 ] );
84  directive_failed( status, "rtems_extension_delete #2" );
85
86  puts( "rtems_extension_delete - second one again -- RTEMS_INVALID_ID" );
87  status = rtems_extension_delete( Extension_id[ 2 ] );
88  fatal_directive_status(
89    status,
90    RTEMS_INVALID_ID,
91    "rtems_extension_delete #2 bad"
92  );
93
94  puts  ( "rtems_extension_ident -- OK" );
95  status = rtems_extension_ident( Extension_name[1], &id );
96  directive_failed( status, "rtems_extension_ident" );
97
98  puts  ( "rtems_extension_ident - bad name -- RTEMS_INVALID_NAME" );
99  status = rtems_extension_ident( Extension_name[2], &id );
100  fatal_directive_status( status, RTEMS_INVALID_NAME, "rtems_extension_ident" );
101
102  puts  ( "rtems_extension_ident - bad name -- RTEMS_INVALID_ADDRESS" );
103  status = rtems_extension_ident( Extension_name[2], NULL );
104  fatal_directive_status(
105    status,
106    RTEMS_INVALID_ADDRESS,
107    "rtems_extension_ident"
108  );
109
110  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
111  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
112  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
113  Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
114
115  status = rtems_task_create(
116    Task_name[ 1 ],
117    4,
118    RTEMS_MINIMUM_STACK_SIZE * 2,
119    RTEMS_DEFAULT_MODES,
120    RTEMS_DEFAULT_ATTRIBUTES,
121    &Task_id[ 1 ]
122  );
123  directive_failed( status, "rtems_task_create of TA1" );
124
125  status = rtems_task_create(
126    Task_name[ 2 ],
127    4,
128    RTEMS_MINIMUM_STACK_SIZE * 2,
129    RTEMS_DEFAULT_MODES,
130    RTEMS_DEFAULT_ATTRIBUTES,
131    &Task_id[ 2 ]
132  );
133  directive_failed( status, "rtems_task_create of TA2" );
134
135#define TA3_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 4u)
136  status = rtems_task_create(
137    Task_name[ 3 ],
138    TA3_PRIORITY,
139    RTEMS_MINIMUM_STACK_SIZE * 2,
140    RTEMS_DEFAULT_MODES,
141    RTEMS_DEFAULT_ATTRIBUTES,
142    &Task_id[ 3 ]
143  );
144  directive_failed( status, "rtems_task_create of TA3" );
145
146#define TA4_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
147  status = rtems_task_create(
148    Task_name[ 4 ],
149    TA4_PRIORITY,
150    RTEMS_MINIMUM_STACK_SIZE * 2,
151    RTEMS_DEFAULT_MODES,
152    RTEMS_DEFAULT_ATTRIBUTES,
153    &Task_id[ 4 ]
154  );
155  directive_failed( status, "rtems_task_create of TA4" );
156
157  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
158  directive_failed( status, "rtems_task_start of TA1" );
159
160  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
161  directive_failed( status, "rtems_task_start of TA2" );
162
163  status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
164  directive_failed( status, "rtems_task_start of TA3" );
165
166  status = rtems_task_start( Task_id[ 4 ], Task_4, 0 );
167  directive_failed( status, "rtems_task_start of TA4" );
168
169  status = rtems_task_restart( Task_id[ 3 ], 0 );
170  directive_failed( status, "rtems_task_restart of TA3" );
171
172  buffered_io_flush();
173
174  status = rtems_task_set_note( RTEMS_SELF, RTEMS_NOTEPAD_4, 32 );
175  directive_failed( status, "task_set_node of Self" );
176  printf( "INIT - rtems_task_set_note - set my RTEMS_NOTEPAD_4 " );
177  puts  ( "to TA1's priority: 04" );
178
179  status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 );
180  directive_failed( status, "task_set_node of TA1" );
181  printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " );
182  puts  ( "to TA1's priority: 04" );
183
184  status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, 4 );
185  directive_failed( status, "task_set_node of TA2" );
186  printf( "INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 " );
187  puts  ( "to TA2's priority: 04");
188
189  status = rtems_task_delete( RTEMS_SELF );
190  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
191}
Note: See TracBrowser for help on using the repository browser.