source: rtems/testsuites/tmtests/tm18/task1.c @ 2ead50a

4.11
Last change on this file since 2ead50a was 2ead50a, checked in by bjorn larsson <bjornlarsson@…>, on Mar 21, 2014 at 3:48:01 PM

tmtests: convert to test.h

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16
17const char rtems_test_name[] = "TIME TEST 18";
18
19uint32_t   taskcount;
20rtems_task_priority taskpri;
21
22extern void test_init(void);
23
24rtems_task First_task(
25  rtems_task_argument argument
26);
27
28rtems_task Middle_tasks(
29  rtems_task_argument argument
30);
31
32rtems_task Last_task(
33  rtems_task_argument argument
34);
35
36
37rtems_task Init(
38  rtems_task_argument argument
39)
40{
41  rtems_status_code status;
42
43  Print_Warning();
44
45  TEST_BEGIN();
46
47  test_init();
48
49  status = rtems_task_delete( RTEMS_SELF );
50  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
51}
52
53void test_init(void)
54{
55  rtems_id          id;
56  rtems_task_entry  task_entry;
57  uint32_t          index;
58  rtems_status_code status;
59
60  for ( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
61    status = rtems_task_create(
62      rtems_build_name( 'T', 'I', 'M', 'E' ),
63      (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
64      RTEMS_MINIMUM_STACK_SIZE,
65      RTEMS_DEFAULT_MODES,
66      RTEMS_DEFAULT_ATTRIBUTES,
67      &id
68    );
69    directive_failed( status, "rtems_task_create loop" );
70
71    if ( index == OPERATION_COUNT ) task_entry = Last_task;
72    else if ( index == 0 )          task_entry = First_task;
73    else                            task_entry = Middle_tasks;
74
75
76    status = rtems_task_start( id, task_entry, 0 );
77    directive_failed( status, "rtems_task_start loop" );
78  }
79
80}
81
82rtems_task First_task(
83  rtems_task_argument argument
84)
85{
86  benchmark_timer_initialize();
87
88  (void) rtems_task_delete( RTEMS_SELF );
89}
90
91rtems_task Middle_tasks(
92  rtems_task_argument argument
93)
94{
95  (void) rtems_task_delete( RTEMS_SELF );
96}
97
98rtems_task Last_task(
99  rtems_task_argument argument
100)
101{
102  end_time = benchmark_timer_read();
103
104  put_time(
105    "rtems_task_delete: calling task",
106    end_time,
107    OPERATION_COUNT,
108    0,
109    CALLING_OVERHEAD_TASK_DELETE
110  );
111
112  TEST_END();
113  rtems_test_exit( 0 );
114}
Note: See TracBrowser for help on using the repository browser.