source: rtems/testsuites/libtests/rtmonuse/init.c

Last change on this file was acceb47, checked in by Joel Sherrill <joel@…>, on 04/01/22 at 19:24:13

testsuites/libtests/[p-z]*: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*  Init
4 *
5 *  This routine is the initialization task for this test program.
6 *  It is a user initialization task and has the responsibility for creating
7 *  and starting the tasks that make up the test.  If the time of day
8 *  clock is required for the test, it should also be set to a known
9 *  value by this function.
10 *
11 *  Input parameters:
12 *    argument - task argument
13 *
14 *  Output parameters:  NONE
15 *
16 *  COPYRIGHT (c) 1989-2007.
17 *  On-Line Applications Research Corporation (OAR).
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 *    notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 *    notice, this list of conditions and the following disclaimer in the
26 *    documentation and/or other materials provided with the distribution.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifdef HAVE_CONFIG_H
42#include "config.h"
43#endif
44
45#define CONFIGURE_INIT
46#include "system.h"
47
48const char rtems_test_name[] = "RTMONUSE";
49
50rtems_task Init(
51  rtems_task_argument argument
52)
53{
54  uint32_t          index;
55  rtems_status_code status;
56  rtems_id          rmid;
57  rtems_name        period;
58
59  TEST_BEGIN();
60
61  period =  rtems_build_name( 'I', 'G', 'N', 'R' );
62  status = rtems_rate_monotonic_create( period, &rmid );
63  directive_failed( status, "rtems_rate_monotonic_create" );
64  printf(
65    "INIT - rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id " (stays inactive)\n",
66    rmid
67  );
68
69
70  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
71  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
72  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
73  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
74  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
75
76  for ( index = 1 ; index <= 5 ; index++ ) {
77    status = rtems_task_create(
78      Task_name[ index ],
79      Priorities[ index ],
80      RTEMS_MINIMUM_STACK_SIZE * 4,
81      RTEMS_DEFAULT_MODES,
82      (index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
83      &Task_id[ index ]
84    );
85    directive_failed( status, "rtems_task_create loop" );
86  }
87
88  for ( index = 1 ; index <= 5 ; index++ ) {
89    status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
90    directive_failed( status, "rtems_task_start loop" );
91  }
92
93  Count.count[ 1 ] = 0;
94  Count.count[ 2 ] = 0;
95  Count.count[ 3 ] = 0;
96  Count.count[ 4 ] = 0;
97  Count.count[ 5 ] = 0;
98
99  status = rtems_task_suspend( RTEMS_SELF );
100  directive_failed( status, "rtems_task_suspend of RTEMS_SELF" );
101}
Note: See TracBrowser for help on using the repository browser.