source: rtems/testsuites/sptests/spclockget/init.c @ 0ef2534

4.115
Last change on this file since 0ef2534 was f4773a47, checked in by Joel Sherrill <joel.sherrill@…>, on 06/11/11 at 16:42:05

2011-06-11 Joel Sherrill <joel.sherrill@…>

  • sp09/screen02.c, sp09/screen13.c, sp09/sp09.scn, sp29/init.c, sp30/sp30.scn, sp32/init.c, spclockget/init.c: Avoid use of deprecated rtems_clock_get() except in spclockget().
  • Property mode set to 100644
File size: 2.5 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
18rtems_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( "Init - rtems_clock_get - Seconds Since Epoch = %" PRIdrtems_interval "\n", interval );
51
52  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &interval );
53  directive_failed( sc, "rtems_clock_get -- Ticks Since Boot" );
54  printf( "Init - rtems_clock_get - Ticks Since Boot = %" PRIdrtems_interval "\n", interval );
55
56  sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &interval );
57  directive_failed( sc, "rtems_clock_get -- Ticks Per Second" );
58  printf( "Init - rtems_clock_get - Ticks Per Second = %" PRIdrtems_interval "\n", interval );
59
60  sc = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &timev );
61  directive_failed( sc, "rtems_clock_get -- Time Value" );
62  printf( "Init - rtems_clock_get - Time Value = %" PRItime_t "\n", timev.tv_sec );
63
64  puts( "*** END OF TEST LEGACY RTEMS_CLOCK_GET ***" );
65  rtems_test_exit(0);
66}
67
68/* configuration information */
69
70#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
71#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
72
73#define CONFIGURE_MAXIMUM_TASKS         1
74#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
75
76#define CONFIGURE_INIT
77#include <rtems/confdefs.h>
78
79/* global variables */
Note: See TracBrowser for help on using the repository browser.