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 | #if !defined(OPERATION_COUNT) |
---|
11 | #define OPERATION_COUNT 100 |
---|
12 | #endif |
---|
13 | |
---|
14 | #ifdef HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <rtems/btimer.h> |
---|
19 | |
---|
20 | #define CONFIGURE_INIT |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | const char rtems_test_name[] = "TIME TEST 25"; |
---|
24 | |
---|
25 | rtems_id Semaphore_id; |
---|
26 | |
---|
27 | rtems_task High_tasks( |
---|
28 | rtems_task_argument argument |
---|
29 | ); |
---|
30 | |
---|
31 | rtems_task Low_task( |
---|
32 | rtems_task_argument argument |
---|
33 | ); |
---|
34 | |
---|
35 | rtems_task Init( |
---|
36 | rtems_task_argument argument |
---|
37 | ) |
---|
38 | { |
---|
39 | rtems_id task_id; |
---|
40 | uint32_t index; |
---|
41 | rtems_status_code status; |
---|
42 | |
---|
43 | Print_Warning(); |
---|
44 | |
---|
45 | TEST_BEGIN(); |
---|
46 | |
---|
47 | status = rtems_semaphore_create( |
---|
48 | rtems_build_name( 'S', 'M', '1', ' ') , |
---|
49 | 0, |
---|
50 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
51 | RTEMS_NO_PRIORITY, |
---|
52 | &Semaphore_id |
---|
53 | ); |
---|
54 | directive_failed( status, "rtems_semaphore_create of SM1" ); |
---|
55 | |
---|
56 | status = rtems_task_create( |
---|
57 | rtems_build_name( 'L', 'O', 'W', ' ' ), |
---|
58 | RTEMS_MAXIMUM_PRIORITY - 1u, |
---|
59 | RTEMS_MINIMUM_STACK_SIZE, |
---|
60 | RTEMS_DEFAULT_MODES, |
---|
61 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
62 | &task_id |
---|
63 | ); |
---|
64 | directive_failed( status, "rtems_task_create LOW" ); |
---|
65 | |
---|
66 | status = rtems_task_start( task_id, Low_task, 0 ); |
---|
67 | directive_failed( status, "rtems_task_start LOW" ); |
---|
68 | |
---|
69 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { |
---|
70 | status = rtems_task_create( |
---|
71 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
---|
72 | (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u, |
---|
73 | RTEMS_MINIMUM_STACK_SIZE, |
---|
74 | RTEMS_DEFAULT_MODES, |
---|
75 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
76 | &task_id |
---|
77 | ); |
---|
78 | directive_failed( status, "rtems_task_create LOOP" ); |
---|
79 | |
---|
80 | status = rtems_task_start( task_id, High_tasks, 0 ); |
---|
81 | directive_failed( status, "rtems_task_start LOOP" ); |
---|
82 | } |
---|
83 | |
---|
84 | rtems_task_exit(); |
---|
85 | } |
---|
86 | |
---|
87 | rtems_task High_tasks( |
---|
88 | rtems_task_argument argument |
---|
89 | ) |
---|
90 | { |
---|
91 | (void) rtems_semaphore_obtain( |
---|
92 | Semaphore_id, |
---|
93 | RTEMS_DEFAULT_OPTIONS, |
---|
94 | 0xffffffff |
---|
95 | ); |
---|
96 | } |
---|
97 | |
---|
98 | rtems_task Low_task( |
---|
99 | rtems_task_argument argument |
---|
100 | ) |
---|
101 | { |
---|
102 | benchmark_timer_initialize(); |
---|
103 | (void) rtems_clock_tick(); |
---|
104 | end_time = benchmark_timer_read(); |
---|
105 | |
---|
106 | put_time( |
---|
107 | "rtems_clock_tick: only case", |
---|
108 | end_time, |
---|
109 | 1, |
---|
110 | 0, |
---|
111 | 0 |
---|
112 | ); |
---|
113 | |
---|
114 | TEST_END(); |
---|
115 | rtems_test_exit( 0 ); |
---|
116 | } |
---|