source: rtems/testsuites/sptests/spnsext01/init.c @ a0b1b5ed

4.115
Last change on this file since a0b1b5ed was a0b1b5ed, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 15, 2014 at 1:19:43 PM

Delete CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM

This define was superfluous, undocumented and used inconsistently.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 * Copyright (c) 2011 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <tmacros.h>
20
21const char rtems_test_name[] = "SPNSEXT 1";
22
23static rtems_task Init(rtems_task_argument argument)
24{
25  rtems_status_code sc = RTEMS_SUCCESSFUL;
26  rtems_interrupt_lock lock;
27  rtems_interrupt_lock_context lock_context;
28  rtems_interval t0 = 0;
29  rtems_interval t1 = 0;
30  int i = 0;
31  int n = 0;
32  struct timespec uptime;
33  struct timespec new_uptime;
34
35  TEST_BEGIN();
36
37  /* Align with clock tick */
38  t0 = rtems_clock_get_ticks_since_boot();
39  while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) {
40    /* Do nothing */
41  }
42
43  t0 = t1;
44  sc = rtems_clock_get_uptime(&uptime);
45  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
46  while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) {
47    ++n;
48    sc = rtems_clock_get_uptime(&new_uptime);
49    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
50    rtems_test_assert(!_Timespec_Less_than(&new_uptime, &uptime));
51    uptime = new_uptime;
52  }
53
54  n = (3 * n) / 2;
55
56  rtems_interrupt_lock_initialize(&lock, "test");
57  rtems_interrupt_lock_acquire(&lock, &lock_context);
58  sc = rtems_clock_get_uptime(&uptime);
59  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
60  for (i = 0; i < n; ++i) {
61    /* Preserve execution time of previous loop */
62    rtems_clock_get_ticks_since_boot();
63
64    sc = rtems_clock_get_uptime(&new_uptime);
65    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
66    rtems_test_assert(!_Timespec_Less_than(&new_uptime, &uptime));
67    uptime = new_uptime;
68  }
69  rtems_interrupt_lock_release(&lock, &lock_context);
70  rtems_interrupt_lock_destroy(&lock);
71
72  TEST_END();
73
74  rtems_test_exit(0);
75}
76
77#define CONFIGURE_INIT
78
79#define CONFIGURE_MICROSECONDS_PER_TICK 100000
80
81#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
82#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
83
84#define CONFIGURE_MAXIMUM_TASKS 1
85#define CONFIGURE_MAXIMUM_DRIVERS 2
86
87#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
88
89#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
90
91#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.