source: rtems/testsuites/support/src/spin.c @ b1305bb

4.115
Last change on this file since b1305bb was b1305bb, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 11:11:44

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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 <rtems.h>
17
18/*
19 *  Burn CPU for specified number of ticks
20 */
21void rtems_test_spin_for_ticks(int ticks)
22{
23  rtems_interval        start;
24  rtems_interval        now;
25
26  start = rtems_clock_get_ticks_since_boot();
27  do {
28    now = rtems_clock_get_ticks_since_boot();
29    /*
30     *  Spin for <= ticks so we spin >= number of ticks.
31     *  The first tick we spin through is a partial one.
32     *  So you sping "ticks" number of ticks plus a partial
33     *  one.
34     */
35  } while ( (now-start) <= ticks );
36}
37
38/*
39 *  Spin until the next clock tick
40 */
41void rtems_test_spin_until_next_tick( void )
42{
43  rtems_interval        start;
44  rtems_interval        now;
45
46  start = rtems_clock_get_ticks_since_boot();
47  do {
48    now = rtems_clock_get_ticks_since_boot();
49  } while ( now != start );
50}
Note: See TracBrowser for help on using the repository browser.