source: rtems/testsuites/tmtests/tm18/task1.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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
17uint32_t   taskcount;
18rtems_task_priority taskpri;
19
20extern void test_init(void);
21
22rtems_task First_task(
23  rtems_task_argument argument
24);
25
26rtems_task Middle_tasks(
27  rtems_task_argument argument
28);
29
30rtems_task Last_task(
31  rtems_task_argument argument
32);
33
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  rtems_status_code status;
40
41  Print_Warning();
42
43  puts( "\n\n*** TIME TEST 18 ***" );
44
45  test_init();
46
47  status = rtems_task_delete( RTEMS_SELF );
48  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
49}
50
51void test_init(void)
52{
53  rtems_id          id;
54  rtems_task_entry  task_entry;
55  uint32_t          index;
56  rtems_status_code status;
57
58  for ( index = 0 ; index <= OPERATION_COUNT ; index++ ) {
59    status = rtems_task_create(
60      rtems_build_name( 'T', 'I', 'M', 'E' ),
61      (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
62      RTEMS_MINIMUM_STACK_SIZE,
63      RTEMS_DEFAULT_MODES,
64      RTEMS_DEFAULT_ATTRIBUTES,
65      &id
66    );
67    directive_failed( status, "rtems_task_create loop" );
68
69    if ( index == OPERATION_COUNT ) task_entry = Last_task;
70    else if ( index == 0 )          task_entry = First_task;
71    else                            task_entry = Middle_tasks;
72
73
74    status = rtems_task_start( id, task_entry, 0 );
75    directive_failed( status, "rtems_task_start loop" );
76  }
77
78}
79
80rtems_task First_task(
81  rtems_task_argument argument
82)
83{
84  benchmark_timer_initialize();
85
86  (void) rtems_task_delete( RTEMS_SELF );
87}
88
89rtems_task Middle_tasks(
90  rtems_task_argument argument
91)
92{
93  (void) rtems_task_delete( RTEMS_SELF );
94}
95
96rtems_task Last_task(
97  rtems_task_argument argument
98)
99{
100  end_time = benchmark_timer_read();
101
102  put_time(
103    "rtems_task_delete: calling task",
104    end_time,
105    OPERATION_COUNT,
106    0,
107    CALLING_OVERHEAD_TASK_DELETE
108  );
109
110  puts( "*** END OF TEST 18 ***" );
111  rtems_test_exit( 0 );
112}
Note: See TracBrowser for help on using the repository browser.