source: rtems/c/src/tests/sptests/sp09/init.c @ 0895bdb

4.104.114.84.95
Last change on this file since 0895bdb was 60b791ad, checked in by Joel Sherrill <joel.sherrill@…>, on 02/17/98 at 23:46:28

updated copyright to 1998

  • Property mode set to 100644
File size: 3.6 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-1998.
15 *  On-Line Applications Research Corporation (OAR).
16 *  Copyright assigned to U.S. Government, 1994.
17 *
18 *  The license and distribution terms for this file may be
19 *  found in the file LICENSE in this distribution or at
20 *  http://www.OARcorp.com/rtems/license.html.
21 *
22 *  $Id$
23 */
24
25#define TEST_INIT
26#include "system.h"
27
28rtems_task Init(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33
34  puts( "\n\n*** TEST 9 ***" );
35
36  Task_name[ 1 ]       =  rtems_build_name( 'T', 'A', '1', ' ' );
37  Task_name[ 2 ]       =  rtems_build_name( 'T', 'A', '2', ' ' );
38  Task_name[ 3 ]       =  rtems_build_name( 'T', 'A', '3', ' ' );
39  Task_name[ 4 ]       =  rtems_build_name( 'T', 'A', '4', ' ' );
40  Task_name[ 5 ]       =  rtems_build_name( 'T', 'A', '5', ' ' );
41  Task_name[ 6 ]       =  rtems_build_name( 'T', 'A', '6', ' ' );
42  Task_name[ 7 ]       =  rtems_build_name( 'T', 'A', '7', ' ' );
43  Task_name[ 8 ]       =  rtems_build_name( 'T', 'A', '8', ' ' );
44  Task_name[ 9 ]       =  rtems_build_name( 'T', 'A', '9', ' ' );
45  Task_name[ 10 ]      =  rtems_build_name( 'T', 'A', 'A', ' ' );
46
47  Timer_name[ 1 ]      =  rtems_build_name( 'T', 'M', '1', ' ' );
48
49  Semaphore_name[ 1 ]  =  rtems_build_name( 'S', 'M', '1', ' ' );
50  Semaphore_name[ 2 ]  =  rtems_build_name( 'S', 'M', '2', ' ' );
51  Semaphore_name[ 3 ]  =  rtems_build_name( 'S', 'M', '3', ' ' );
52
53  Queue_name[ 1 ]      =  rtems_build_name( 'M', 'Q', '1', ' ' );
54  Queue_name[ 2 ]      =  rtems_build_name( 'M', 'Q', '2', ' ' );
55
56  Partition_name[ 1 ]  =  rtems_build_name( 'P', 'T', '1', ' ' );
57
58  Region_name[ 1 ]     =  rtems_build_name( 'R', 'N', '1', ' ' );
59
60  Port_name[ 1 ]       =  rtems_build_name( 'D', 'P', '1', ' ' );
61
62  Period_name[ 1 ]     =  rtems_build_name( 'T', 'M', '1', ' ' );
63
64#if 0
65  status = rtems_task_create(
66    Task_name[1],
67    4,
68    10,
69    RTEMS_DEFAULT_MODES,
70    RTEMS_DEFAULT_ATTRIBUTES,
71    &Task_id[ 1 ]
72  );
73  fatal_directive_status(
74    status,
75    RTEMS_INVALID_SIZE,
76    "rtems_task_create with illegal stack size"
77  );
78  puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE" );
79#endif
80  puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED" );
81
82  status = rtems_task_create(
83     Task_name[1],
84     0,
85     RTEMS_MINIMUM_STACK_SIZE,
86     RTEMS_DEFAULT_MODES,
87     RTEMS_DEFAULT_ATTRIBUTES,
88     &Task_id[ 1 ]
89  );
90  fatal_directive_status(
91    status,
92    RTEMS_INVALID_PRIORITY,
93    "rtems_task_create with illegal priority"
94  );
95  puts( "INIT - rtems_task_create - RTEMS_INVALID_PRIORITY" );
96
97  status = rtems_task_create(
98    Task_name[ 1 ],
99    4,
100    RTEMS_MINIMUM_STACK_SIZE * 3,
101    RTEMS_DEFAULT_MODES,
102    RTEMS_DEFAULT_ATTRIBUTES,
103    &Task_id[ 1 ]
104  );
105  directive_failed( status, "rtems_task_create of TA1" );
106
107  status = rtems_task_restart( Task_id[ 1 ], 0 );
108  fatal_directive_status(
109    status,
110    RTEMS_INCORRECT_STATE,
111    "rtems_task_restart of DORMANT task"
112  );
113  puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" );
114
115  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
116  directive_failed( status, "rtems_task_start of TA1" );
117
118  status = rtems_task_delete( RTEMS_SELF );
119  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
120}
Note: See TracBrowser for help on using the repository browser.