summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spclockget/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-10 17:04:50 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-10 17:04:50 +0000
commit7c11edfd82f9048ef58984e62280f35cc8ae3794 (patch)
treee375e4fb044e8da20a6f7b50b30c65abd4544feb /testsuites/sptests/spclockget/init.c
parent2009-08-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-7c11edfd82f9048ef58984e62280f35cc8ae3794.tar.bz2
2009-08-10 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add new test to exercise legacy rtems_clock_get(). * spclockget/.cvsignore, spclockget/Makefile.am, spclockget/init.c, spclockget/spclockget.doc, spclockget/spclockget.scn: New files.
Diffstat (limited to 'testsuites/sptests/spclockget/init.c')
-rw-r--r--testsuites/sptests/spclockget/init.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/testsuites/sptests/spclockget/init.c b/testsuites/sptests/spclockget/init.c
new file mode 100644
index 0000000000..f25ab1b618
--- /dev/null
+++ b/testsuites/sptests/spclockget/init.c
@@ -0,0 +1,65 @@
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_status_code sc;
+ rtems_time_of_day time;
+ rtems_interval interval;
+ struct timeval timev;
+
+ puts( "\n\n*** TEST LEGACY RTEMS_CLOCK_GET ***" );
+
+ puts( "Init - clock_set_time" );
+ build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
+ sc = rtems_clock_set( &time );
+ directive_failed( sc, "rtems_clock_set" );
+
+ sc = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
+ directive_failed( sc, "rtems_clock_get -- TOD" );
+ print_time( "Init - rtems_clock_get - ", &time, "\n" );
+
+ sc = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &interval );
+ directive_failed( sc, "rtems_clock_get -- Seconds Since Epoch" );
+ printf( "Init - rtems_clock_get - Seconds Since Epoch = %d\n", interval );
+
+ sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &interval );
+ directive_failed( sc, "rtems_clock_get -- Ticks Since Boot" );
+ printf( "Init - rtems_clock_get - Ticks Since Boot = %d\n", interval );
+
+ sc = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &interval );
+ directive_failed( sc, "rtems_clock_get -- Ticks Per Second" );
+ printf( "Init - rtems_clock_get - Ticks Per Second = %d\n", interval );
+
+ sc = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &timev );
+ directive_failed( sc, "rtems_clock_get -- Time Value" );
+ printf( "Init - rtems_clock_get - Time Value = %d\n", timev.tv_sec );
+
+ puts( "*** END OF TEST LEGACY RTEMS_CLOCK_GET ***" );
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */