source: rtems/testsuites/sptests/sp19/init.c @ 828049cb

5
Last change on this file since 828049cb was 828049cb, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 8, 2018 at 7:48:28 AM

sptests/sp19: Fix test output methods

Do not use fprintf() in non-fp tasks.

  • Property mode set to 100644
File size: 4.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-1999.
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 19";
30
31void thread_switch_extension( Thread_Control *executing, Thread_Control *heir )
32{
33  if ( heir->is_fp ) {
34    rtems_print_printer_fprintf_putc( &rtems_test_printer );
35  } else {
36    rtems_print_printer_printk( &rtems_test_printer );
37  }
38}
39
40rtems_task Init(
41  rtems_task_argument argument
42)
43{
44  rtems_status_code status;
45
46  TEST_BEGIN();
47
48  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
49  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
50  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
51  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
52  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
53  Task_name[ 6 ] =  rtems_build_name( 'F', 'P', '1', ' ' );
54
55  status = rtems_task_create(
56    Task_name[ 1 ],
57    2,
58    RTEMS_MINIMUM_STACK_SIZE * 4,
59    RTEMS_DEFAULT_MODES,
60    RTEMS_FLOATING_POINT,
61    &Task_id[ 1 ]
62  );
63  directive_failed( status, "rtems_task_create of TA1" );
64
65  status = rtems_task_create(
66    Task_name[ 2 ],
67    2,
68    RTEMS_MINIMUM_STACK_SIZE * 4,
69    RTEMS_DEFAULT_MODES,
70    RTEMS_DEFAULT_ATTRIBUTES,
71    &Task_id[ 2 ]
72  );
73  directive_failed( status, "rtems_task_create of TA2" );
74
75  status = rtems_task_create(
76    Task_name[ 3 ],
77    2,
78    RTEMS_MINIMUM_STACK_SIZE * 4,
79    RTEMS_DEFAULT_MODES,
80    RTEMS_DEFAULT_ATTRIBUTES,
81    &Task_id[ 3 ]
82  );
83  directive_failed( status, "rtems_task_create of TA3" );
84
85  status = rtems_task_create(
86    Task_name[ 4 ],
87    2,
88    RTEMS_MINIMUM_STACK_SIZE * 4,
89    RTEMS_DEFAULT_MODES,
90    RTEMS_FLOATING_POINT,
91    &Task_id[ 4 ]
92  );
93  directive_failed( status, "rtems_task_create of TA4" );
94
95  status = rtems_task_create(
96    Task_name[ 5 ],
97    2,
98    RTEMS_MINIMUM_STACK_SIZE * 4,
99    RTEMS_DEFAULT_MODES,
100    RTEMS_FLOATING_POINT,
101    &Task_id[ 5 ]
102  );
103  directive_failed( status, "rtems_task_create of TA5" );
104
105  status = rtems_task_create(
106    Task_name[ 6 ],
107    1,
108    RTEMS_MINIMUM_STACK_SIZE * 4,
109    RTEMS_DEFAULT_MODES,
110    RTEMS_FLOATING_POINT,
111    &Task_id[ 6 ]
112  );
113  directive_failed( status, "rtems_task_create of FP1" );
114
115  status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 );
116  directive_failed( status, "rtems_task_start of FP1" );
117
118  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
119  directive_failed( status, "rtems_task_start of TA1" );
120
121  status = rtems_task_start( Task_id[ 2 ], Task_1, 0 );
122  directive_failed( status, "rtems_task_start of TA2" );
123
124  status = rtems_task_start( Task_id[ 3 ], Task_1, 0 );
125  directive_failed( status, "rtems_task_start of TA3" );
126
127  status = rtems_task_start( Task_id[ 4 ], FP_task, 0 );
128  directive_failed( status, "rtems_task_start of TA4" );
129
130  status = rtems_task_start( Task_id[ 5 ], FP_task, 0 );
131  directive_failed( status, "rtems_task_create of TA5" );
132
133  /*
134   *  Load "task dependent factors" in the context areas
135   */
136
137
138  FP_factors[0] =    0.0;
139  FP_factors[1] = 1000.1;
140  FP_factors[2] = 2000.2;
141  FP_factors[3] = 3000.3;
142  FP_factors[4] = 4000.4;
143  FP_factors[5] = 5000.5;
144  FP_factors[6] = 6000.6;
145  FP_factors[7] = 7000.7;
146  FP_factors[8] = 8000.8;
147  FP_factors[9] = 9000.9;
148
149  INTEGER_factors[0] = 0x0000;
150  INTEGER_factors[1] = 0x1000;
151  INTEGER_factors[2] = 0x2000;
152  INTEGER_factors[3] = 0x3000;
153  INTEGER_factors[4] = 0x4000;
154  INTEGER_factors[5] = 0x5000;
155  INTEGER_factors[6] = 0x6000;
156  INTEGER_factors[7] = 0x7000;
157  INTEGER_factors[8] = 0x8000;
158  INTEGER_factors[9] = 0x9000;
159
160  status = rtems_task_delete( RTEMS_SELF );
161  directive_failed( status, "rtems_task_delete of TA1" );
162}
Note: See TracBrowser for help on using the repository browser.