1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2011. |
---|
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.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <tmacros.h> |
---|
17 | |
---|
18 | rtems_task Init( |
---|
19 | rtems_task_argument ignored |
---|
20 | ) |
---|
21 | { |
---|
22 | rtems_status_code sc; |
---|
23 | rtems_time_of_day time; |
---|
24 | rtems_interval interval; |
---|
25 | struct timeval timev; |
---|
26 | |
---|
27 | puts( "\n\n*** TEST LEGACY RTEMS_CLOCK_GET ***" ); |
---|
28 | |
---|
29 | puts( "Init - clock_set_time" ); |
---|
30 | build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); |
---|
31 | sc = rtems_clock_set( &time ); |
---|
32 | directive_failed( sc, "rtems_clock_set" ); |
---|
33 | |
---|
34 | /* NULL parameter */ |
---|
35 | sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, NULL ); |
---|
36 | fatal_directive_status( sc, RTEMS_INVALID_ADDRESS, "null pointer" ); |
---|
37 | puts( "TA1 - rtems_clock_get - RTEMS_INVALID_ADDRESS" ); |
---|
38 | |
---|
39 | /* arbitrary bad value for switch */ |
---|
40 | sc = rtems_clock_get( 0xff, &timev ); |
---|
41 | fatal_directive_status( sc, RTEMS_INVALID_NUMBER, "bad case" ); |
---|
42 | puts( "TA1 - rtems_clock_get - RTEMS_INVALID_NUMBER" ); |
---|
43 | |
---|
44 | sc = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); |
---|
45 | directive_failed( sc, "rtems_clock_get -- TOD" ); |
---|
46 | print_time( "Init - rtems_clock_get - ", &time, "\n" ); |
---|
47 | |
---|
48 | sc = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &interval ); |
---|
49 | directive_failed( sc, "rtems_clock_get -- Seconds Since Epoch" ); |
---|
50 | printf( |
---|
51 | "Init - rtems_clock_get - Seconds Since Epoch = %" PRIdrtems_interval "\n", |
---|
52 | interval |
---|
53 | ); |
---|
54 | |
---|
55 | sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &interval ); |
---|
56 | directive_failed( sc, "rtems_clock_get -- Ticks Since Boot" ); |
---|
57 | printf( |
---|
58 | "Init - rtems_clock_get - Ticks Since Boot = %" PRIdrtems_interval "\n", |
---|
59 | interval |
---|
60 | ); |
---|
61 | |
---|
62 | sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &interval ); |
---|
63 | directive_failed( sc, "rtems_clock_get -- Ticks Per Second" ); |
---|
64 | printf( |
---|
65 | "Init - rtems_clock_get - Ticks Per Second = %" PRIdrtems_interval "\n", |
---|
66 | interval |
---|
67 | ); |
---|
68 | |
---|
69 | sc = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &timev ); |
---|
70 | directive_failed( sc, "rtems_clock_get -- Time Value" ); |
---|
71 | printf( |
---|
72 | "Init - rtems_clock_get - Time Value = %" PRItime_t "\n", |
---|
73 | timev.tv_sec |
---|
74 | ); |
---|
75 | |
---|
76 | puts( "*** END OF TEST LEGACY RTEMS_CLOCK_GET ***" ); |
---|
77 | rtems_test_exit(0); |
---|
78 | } |
---|
79 | |
---|
80 | /* configuration information */ |
---|
81 | |
---|
82 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
83 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
84 | |
---|
85 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
86 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
87 | |
---|
88 | #define CONFIGURE_INIT |
---|
89 | #include <rtems/confdefs.h> |
---|
90 | |
---|
91 | /* global variables */ |
---|