1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2013. |
---|
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 | |
---|
17 | const char rtems_test_name[] = "TIME TEST 25"; |
---|
18 | |
---|
19 | rtems_id Semaphore_id; |
---|
20 | |
---|
21 | rtems_task High_tasks( |
---|
22 | rtems_task_argument argument |
---|
23 | ); |
---|
24 | |
---|
25 | rtems_task Low_task( |
---|
26 | rtems_task_argument argument |
---|
27 | ); |
---|
28 | |
---|
29 | rtems_task Init( |
---|
30 | rtems_task_argument argument |
---|
31 | ) |
---|
32 | { |
---|
33 | rtems_id task_id; |
---|
34 | uint32_t index; |
---|
35 | rtems_status_code status; |
---|
36 | |
---|
37 | Print_Warning(); |
---|
38 | |
---|
39 | TEST_BEGIN(); |
---|
40 | |
---|
41 | status = rtems_semaphore_create( |
---|
42 | rtems_build_name( 'S', 'M', '1', ' ') , |
---|
43 | 0, |
---|
44 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
45 | RTEMS_NO_PRIORITY, |
---|
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', ' ' ), |
---|
52 | RTEMS_MAXIMUM_PRIORITY - 1u, |
---|
53 | RTEMS_MINIMUM_STACK_SIZE, |
---|
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' ), |
---|
66 | (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u, |
---|
67 | RTEMS_MINIMUM_STACK_SIZE, |
---|
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 | |
---|
82 | rtems_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 | |
---|
93 | rtems_task Low_task( |
---|
94 | rtems_task_argument argument |
---|
95 | ) |
---|
96 | { |
---|
97 | benchmark_timer_initialize(); |
---|
98 | (void) rtems_clock_tick(); |
---|
99 | end_time = benchmark_timer_read(); |
---|
100 | |
---|
101 | put_time( |
---|
102 | "rtems_clock_tick: only case", |
---|
103 | end_time, |
---|
104 | 1, |
---|
105 | 0, |
---|
106 | CALLING_OVERHEAD_CLOCK_TICK |
---|
107 | ); |
---|
108 | |
---|
109 | TEST_END(); |
---|
110 | rtems_test_exit( 0 ); |
---|
111 | } |
---|