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

5
Last change on this file since c1c71cd was c1c71cd, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 1, 2018 at 12:49:11 PM

sp20: Fix print buffer size

There were two issues:

  1. The buffer size must be divisible by 8 on 64-bit targets
  1. It must be large enough to service the begin of start message.

Update #3082.

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