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

4.115
Last change on this file since 2ead50a was 2ead50a, checked in by bjorn larsson <bjornlarsson@…>, on 03/21/14 at 15:48:01

tmtests: convert to test.h

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[ac7d5ef0]1/*
[9410d011]2 *  COPYRIGHT (c) 1989-2013.
[ac7d5ef0]3 *  On-Line Applications Research Corporation (OAR).
4 *
[98e4ebf5]5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
[c499856]7 *  http://www.rtems.org/license/LICENSE.
[ac7d5ef0]8 */
9
[a4bc4d6e]10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
[d1128e2]14#define CONFIGURE_INIT
[ac7d5ef0]15#include "system.h"
16
[2ead50a]17const char rtems_test_name[] = "TIME TEST 25";
18
[ac7d5ef0]19rtems_id Semaphore_id;
20
21rtems_task High_tasks(
22  rtems_task_argument argument
23);
24
25rtems_task Low_task(
26  rtems_task_argument argument
27);
28
29rtems_task Init(
30  rtems_task_argument argument
31)
32{
33  rtems_id          task_id;
[0720ff4]34  uint32_t    index;
[ac7d5ef0]35  rtems_status_code status;
36
[3a4ae6c]37  Print_Warning();
38
[2ead50a]39  TEST_BEGIN();
[ac7d5ef0]40
41  status = rtems_semaphore_create(
42    rtems_build_name( 'S', 'M', '1', ' ') ,
43    0,
44    RTEMS_DEFAULT_ATTRIBUTES,
[7f6a24ab]45    RTEMS_NO_PRIORITY,
[ac7d5ef0]46    &Semaphore_id
47  );
48  directive_failed( status, "rtems_semaphore_create of SM1" );
49
50  status = rtems_task_create(
51    rtems_build_name( 'L', 'O', 'W', ' ' ),
[1055ce20]52    RTEMS_MAXIMUM_PRIORITY - 1u,
[3652ad35]53    RTEMS_MINIMUM_STACK_SIZE,
[ac7d5ef0]54    RTEMS_DEFAULT_MODES,
55    RTEMS_DEFAULT_ATTRIBUTES,
56    &task_id
57  );
58  directive_failed( status, "rtems_task_create LOW" );
59
60  status = rtems_task_start( task_id, Low_task, 0 );
61  directive_failed( status, "rtems_task_start LOW" );
62
63  for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
64    status = rtems_task_create(
65      rtems_build_name( 'T', 'I', 'M', 'E' ),
[1055ce20]66      (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
[3652ad35]67      RTEMS_MINIMUM_STACK_SIZE,
[ac7d5ef0]68      RTEMS_DEFAULT_MODES,
69      RTEMS_DEFAULT_ATTRIBUTES,
70      &task_id
71    );
72    directive_failed( status, "rtems_task_create LOOP" );
73
74    status = rtems_task_start( task_id, High_tasks, 0 );
75    directive_failed( status, "rtems_task_start LOOP" );
76  }
77
78  status = rtems_task_delete( RTEMS_SELF );
79  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
80}
81
82rtems_task High_tasks(
83  rtems_task_argument argument
84)
85{
86  (void) rtems_semaphore_obtain(
87    Semaphore_id,
88    RTEMS_DEFAULT_OPTIONS,
89    0xffffffff
90  );
91}
92
93rtems_task Low_task(
94  rtems_task_argument argument
95)
96{
[dbf4f17]97  benchmark_timer_initialize();
[ac7d5ef0]98    (void) rtems_clock_tick();
[dbf4f17]99  end_time = benchmark_timer_read();
[ac7d5ef0]100
101  put_time(
[9410d011]102    "rtems_clock_tick: only case",
[ac7d5ef0]103    end_time,
104    1,
105    0,
106    CALLING_OVERHEAD_CLOCK_TICK
107  );
108
[2ead50a]109  TEST_END();
[b454bc9]110  rtems_test_exit( 0 );
[ac7d5ef0]111}
Note: See TracBrowser for help on using the repository browser.