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

4.104.115
Last change on this file since a986c075 was a986c075, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/08 at 18:36:00

2008-12-14 Joel Sherrill <joel.sherrill@…>

  • sp07/init.c, sp12/init.c, sp12/pridrv.c, sp12/pritask.c, sp12/system.h, sp16/system.h, sp25/system.h, sp26/task1.c, sp28/init.c, sp29/init.c, sp35/priinv.c, sp42/init.c: Run all tests successfully with maxixum number of priorities as 16 instead of 256. This was done by temporarily modifying the score priority.h maximum. This allowed testing of all API code to ensure that it worked properly with a reduced number of priorities. Most modifications were to switch from hard-coded maximum to using the API provided methods to determine maximum number of priority levels.
  • Property mode set to 100644
File size: 6.2 KB
RevLine 
[ac7d5ef0]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 *
[a986c075]14 *  COPYRIGHT (c) 1989-2008.
[ac7d5ef0]15 *  On-Line Applications Research Corporation (OAR).
16 *
[98e4ebf5]17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
[d2b93bfd]19 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]20 *
21 *  $Id$
22 */
23
[2186ba80]24#define CONFIGURE_INIT
[ac7d5ef0]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;
[79542d7]43  rtems_id          id;
[ac7d5ef0]44
45  puts( "\n\n*** TEST 7 ***" );
46
[e457190]47  buffered_io_initialize();
48
[79542d7]49  Extension_name[ 1 ] =  rtems_build_name( 'E', 'X', 'T', '1' );
50  Extension_name[ 2 ] =  rtems_build_name( 'E', 'X', 'T', '2' );
[ac7d5ef0]51
[79542d7]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" );
[ac7d5ef0]63  status = rtems_extension_create(
64    Extension_name[ 1 ],
65    &Extensions,
66    &Extension_id[ 1 ]
67  );
68  directive_failed( status, "rtems_extension_create" );
69
[79542d7]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
[ac7d5ef0]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,
[2c45683]118    RTEMS_MINIMUM_STACK_SIZE * 2,
[ac7d5ef0]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,
[2c45683]128    RTEMS_MINIMUM_STACK_SIZE * 2,
[ac7d5ef0]129    RTEMS_DEFAULT_MODES,
130    RTEMS_DEFAULT_ATTRIBUTES,
131    &Task_id[ 2 ]
132  );
133  directive_failed( status, "rtems_task_create of TA2" );
134
[a986c075]135#define TA3_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 4)
[ac7d5ef0]136  status = rtems_task_create(
137    Task_name[ 3 ],
[a986c075]138    TA3_PRIORITY,
[2c45683]139    RTEMS_MINIMUM_STACK_SIZE * 2,
[ac7d5ef0]140    RTEMS_DEFAULT_MODES,
141    RTEMS_DEFAULT_ATTRIBUTES,
142    &Task_id[ 3 ]
143  );
144  directive_failed( status, "rtems_task_create of TA3" );
145
[a986c075]146#define TA4_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1)
[ac7d5ef0]147  status = rtems_task_create(
148    Task_name[ 4 ],
[a986c075]149    TA4_PRIORITY,
[2c45683]150    RTEMS_MINIMUM_STACK_SIZE * 2,
[ac7d5ef0]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
[e457190]172  buffered_io_flush();
173
[9c691ef]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
[ac7d5ef0]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.