source: rtems/testsuites/sptests/sp20/init.c @ 337a186

5
Last change on this file since 337a186 was 337a186, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 21, 2018 at 11:40:18 AM

Add a simple task console driver

Close #3320.

  • Property mode set to 100644
File size: 2.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 20";
30
31void end_of_test( void )
32{
33  TEST_END();
34  fsync(STDOUT_FILENO);
35  rtems_test_exit( 0 );
36}
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42  int               error;
43  uint32_t          index;
44  rtems_status_code status;
45
46  rtems_print_printer_fprintf(&rtems_test_printer, stdout);
47  TEST_BEGIN();
48
49  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
50  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
51  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
52  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
53  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
54  Task_name[ 6 ] =  rtems_build_name( 'T', 'A', '6', ' ' );
55
56  for ( index = 1 ; index <= 6 ; index++ ) {
57    status = rtems_task_create(
58      Task_name[ index ],
59      Priorities[ index ],
60      RTEMS_MINIMUM_STACK_SIZE,
61      RTEMS_DEFAULT_MODES,
62      RTEMS_FLOATING_POINT,
63      &Task_id[ index ]
64    );
65    directive_failed( status, "rtems_task_create loop" );
66  }
67
68  for ( index = 1 ; index <= 6 ; index++ ) {
69    status = rtems_task_start( Task_id[ index ], Task_1_through_6, index );
70    directive_failed( status, "rtems_task_start loop" );
71  }
72
73  Count.count[ 1 ] = 0;
74  Count.count[ 2 ] = 0;
75  Count.count[ 3 ] = 0;
76  Count.count[ 4 ] = 0;
77  Count.count[ 5 ] = 0;
78  Count.count[ 6 ] = 0;
79
80  status = rtems_task_delete( RTEMS_SELF );
81  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
82}
Note: See TracBrowser for help on using the repository browser.