1 | /* |
---|
2 | * Copyright (c) 2015 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/test-info.h> |
---|
20 | |
---|
21 | #include <rtems/bsd.h> |
---|
22 | |
---|
23 | #include <test_support.h> |
---|
24 | |
---|
25 | #include "tmacros.h" |
---|
26 | |
---|
27 | const char rtems_test_name[] = "SPTIMECOUNTER 3"; |
---|
28 | |
---|
29 | #define CPU_COUNT 32 |
---|
30 | |
---|
31 | static rtems_test_parallel_context ctx;; |
---|
32 | |
---|
33 | static rtems_interval test_binuptime_init( |
---|
34 | rtems_test_parallel_context *ctx, |
---|
35 | void *arg, |
---|
36 | size_t active_workers |
---|
37 | ) |
---|
38 | { |
---|
39 | return 10 * rtems_clock_get_ticks_per_second(); |
---|
40 | } |
---|
41 | |
---|
42 | static void test_binuptime_body( |
---|
43 | rtems_test_parallel_context *ctx, |
---|
44 | void *arg, |
---|
45 | size_t active_workers, |
---|
46 | size_t worker_index |
---|
47 | ) |
---|
48 | { |
---|
49 | struct bintime start; |
---|
50 | struct bintime end; |
---|
51 | |
---|
52 | rtems_bsd_binuptime(&start); |
---|
53 | |
---|
54 | do { |
---|
55 | rtems_bsd_binuptime(&end); |
---|
56 | rtems_test_assert( |
---|
57 | end.sec > start.sec |
---|
58 | || (end.sec == start.sec && end.frac >= start.frac) |
---|
59 | ); |
---|
60 | start = end; |
---|
61 | } while (!rtems_test_parallel_stop_job(ctx)); |
---|
62 | } |
---|
63 | |
---|
64 | static void test_binuptime_fini( |
---|
65 | rtems_test_parallel_context *ctx, |
---|
66 | void *arg, |
---|
67 | size_t active_workers |
---|
68 | ) |
---|
69 | { |
---|
70 | /* Nothing to do */ |
---|
71 | } |
---|
72 | |
---|
73 | static const rtems_test_parallel_job jobs[] = { |
---|
74 | { |
---|
75 | .init = test_binuptime_init, |
---|
76 | .body = test_binuptime_body, |
---|
77 | .fini = test_binuptime_fini, |
---|
78 | .cascade = false |
---|
79 | } |
---|
80 | }; |
---|
81 | |
---|
82 | static void Init(rtems_task_argument arg) |
---|
83 | { |
---|
84 | TEST_BEGIN(); |
---|
85 | |
---|
86 | rtems_test_parallel(&ctx, NULL, &jobs[0], RTEMS_ARRAY_SIZE(jobs)); |
---|
87 | |
---|
88 | TEST_END(); |
---|
89 | rtems_test_exit(0); |
---|
90 | } |
---|
91 | |
---|
92 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 |
---|
93 | |
---|
94 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
95 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
96 | |
---|
97 | #define CONFIGURE_MAXIMUM_TASKS CPU_COUNT |
---|
98 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
99 | |
---|
100 | #define CONFIGURE_MAXIMUM_PROCESSORS CPU_COUNT |
---|
101 | |
---|
102 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
103 | |
---|
104 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
105 | |
---|
106 | #define CONFIGURE_INIT |
---|
107 | |
---|
108 | #include <rtems/confdefs.h> |
---|