source: rtems/testsuites/sptests/spclockget/init.c @ f57f5ce2

4.115
Last change on this file since f57f5ce2 was f57f5ce2, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/30/11 at 02:50:48

2011-09-30 Ralf Corsépius <ralf.corsepius@…>

  • sp50/init.c, spclockget/init.c: Include "pritime.h". Use PRIdtime_t to print time_t.
  • Property mode set to 100644
File size: 2.6 KB
Line 
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#include "pritime.h"
18
19rtems_task Init(
20  rtems_task_argument ignored
21)
22{
23  rtems_status_code   sc;
24  rtems_time_of_day   time;
25  rtems_interval      interval;
26  struct timeval      timev;
27
28  puts( "\n\n*** TEST LEGACY RTEMS_CLOCK_GET ***" );
29
30  puts( "Init - clock_set_time" );
31  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
32  sc = rtems_clock_set( &time );
33  directive_failed( sc, "rtems_clock_set" );
34
35  /* NULL parameter */
36  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, NULL );
37  fatal_directive_status( sc, RTEMS_INVALID_ADDRESS, "null pointer" );
38  puts( "TA1 - rtems_clock_get - RTEMS_INVALID_ADDRESS" );
39
40  /* arbitrary bad value for switch */
41  sc = rtems_clock_get( 0xff, &timev );
42  fatal_directive_status( sc, RTEMS_INVALID_NUMBER, "bad case" );
43  puts( "TA1 - rtems_clock_get - RTEMS_INVALID_NUMBER" );
44
45  sc = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
46  directive_failed( sc, "rtems_clock_get -- TOD" );
47  print_time( "Init - rtems_clock_get - ", &time, "\n" );
48
49  sc = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &interval );
50  directive_failed( sc, "rtems_clock_get -- Seconds Since Epoch" );
51  printf(
52    "Init - rtems_clock_get - Seconds Since Epoch = %" PRIdrtems_interval "\n",
53     interval
54  );
55
56  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &interval );
57  directive_failed( sc, "rtems_clock_get -- Ticks Since Boot" );
58  printf(
59    "Init - rtems_clock_get - Ticks Since Boot = %" PRIdrtems_interval "\n",
60     interval
61  );
62
63  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &interval );
64  directive_failed( sc, "rtems_clock_get -- Ticks Per Second" );
65  printf(
66    "Init - rtems_clock_get - Ticks Per Second = %" PRIdrtems_interval "\n",
67     interval
68  );
69
70  sc = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &timev );
71  directive_failed( sc, "rtems_clock_get -- Time Value" );
72  printf(
73    "Init - rtems_clock_get - Time Value = %" PRIdtime_t "\n",
74     timev.tv_sec
75  );
76
77  puts( "*** END OF TEST LEGACY RTEMS_CLOCK_GET ***" );
78  rtems_test_exit(0);
79}
80
81/* configuration information */
82
83#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
84#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
85
86#define CONFIGURE_MAXIMUM_TASKS         1
87#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
88
89#define CONFIGURE_INIT
90#include <rtems/confdefs.h>
91
92/* global variables */
Note: See TracBrowser for help on using the repository browser.