source: rtems/testsuites/sptests/spclockget/init.c @ 9e15e9b

4.115
Last change on this file since 9e15e9b was 9e15e9b, checked in by Joel Sherrill <joel.sherrill@…>, on 07/24/11 at 22:10:20

2011-07-24 Joel Sherrill <joel.sherrill@…>

  • sp04/tswitch.c, sp07/task1.c, sp07/task2.c, sp09/screen07.c, sp11/task1.c, sp11/task2.c, sp12/pridrv.c, sp12/pritask.c, sp13/task1.c, sp14/asr.c, sp14/task1.c, sp19/first.c, sp19/fptask.c, sp19/inttest.h, sp19/task1.c, sp20/task1.c, sp25/task1.c, sp26/task1.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp32/init.c, sp33/init.c, sp34/changepri.c, sp36/strict_order_mut.c, sp37/init.c, sp43/init.c, sp44/init.c, sp48/init.c, sp54/init.c, sp59/init.c, sp65/init.c, sp68/init.c, spchain/init.c, spclockget/init.c, spfatal03/testcase.h, spfatal07/testcase.h, spfatal_support/init.c: Do not line length exceed 80 columns.
  • 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
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(
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 */
Note: See TracBrowser for help on using the repository browser.