source: rtems/testsuites/sptests/sp20/init.c @ acc9d064

5
Last change on this file since acc9d064 was f703e7f, checked in by Sebastian Huber <sebastian.huber@…>, on 10/26/17 at 11:59:05

tests: Move rtems_test_printer definition

Statically initialize it to use printk().

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.8 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 TEST_INIT
27
28#define CONFIGURE_INIT
29#include "system.h"
30
31const char rtems_test_name[] = "SP 20";
32
33#define BUFFER_COUNT 20
34
35#define BUFFER_SIZE 100
36
37static rtems_printer_task_context printer_task;
38
39static long buffers[ BUFFER_COUNT ][ BUFFER_SIZE / sizeof(long) ];
40
41void end_of_test( void )
42{
43  rtems_test_printf( TEST_END_STRING );
44  rtems_printer_task_drain( &printer_task );
45  rtems_test_exit( 0 );
46}
47
48rtems_task Init(
49  rtems_task_argument argument
50)
51{
52  int               error;
53  uint32_t          index;
54  rtems_status_code status;
55
56  rtems_printer_task_set_priority( &printer_task, 254 );
57  rtems_printer_task_set_file_descriptor( &printer_task, 1 );
58  rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] );
59  rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT );
60  rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE );
61  error = rtems_print_printer_task( &rtems_test_printer, &printer_task );
62  rtems_test_assert( error == 0 );
63
64  rtems_test_printf( TEST_BEGIN_STRING );
65
66  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
67  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
68  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
69  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
70  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
71  Task_name[ 6 ] =  rtems_build_name( 'T', 'A', '6', ' ' );
72
73  for ( index = 1 ; index <= 6 ; index++ ) {
74    status = rtems_task_create(
75      Task_name[ index ],
76      Priorities[ index ],
77      RTEMS_MINIMUM_STACK_SIZE,
78      RTEMS_DEFAULT_MODES,
79      RTEMS_FLOATING_POINT,
80      &Task_id[ index ]
81    );
82    directive_failed( status, "rtems_task_create loop" );
83  }
84
85  for ( index = 1 ; index <= 6 ; index++ ) {
86    status = rtems_task_start( Task_id[ index ], Task_1_through_6, index );
87    directive_failed( status, "rtems_task_start loop" );
88  }
89
90  Count.count[ 1 ] = 0;
91  Count.count[ 2 ] = 0;
92  Count.count[ 3 ] = 0;
93  Count.count[ 4 ] = 0;
94  Count.count[ 5 ] = 0;
95  Count.count[ 6 ] = 0;
96
97  status = rtems_task_delete( RTEMS_SELF );
98  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
99}
Note: See TracBrowser for help on using the repository browser.