4.115
Last change
on this file since d04a7e93 was
6cc1c29,
checked in by Glenn Humphrey <glenn.humphrey@…>, on 12/08/09 at 21:39:21
|
2009-12-08 Glenn Humphrey <glenn.humphrey@…>
- support/include/test_support.h, support/include/tmacros.h,
support/src/test_support.c: Added support functions to spin for a
number of ticks and to spin until the next tick.
- support/src/spin.c: New file.
|
-
Property mode set to
100644
|
File size:
1.0 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 | #include <rtems.h> |
---|
13 | |
---|
14 | /* |
---|
15 | * Burn CPU for specified number of ticks |
---|
16 | */ |
---|
17 | void rtems_test_spin_for_ticks(int ticks) |
---|
18 | { |
---|
19 | rtems_interval start; |
---|
20 | rtems_interval now; |
---|
21 | |
---|
22 | start = rtems_clock_get_ticks_since_boot(); |
---|
23 | do { |
---|
24 | now = rtems_clock_get_ticks_since_boot(); |
---|
25 | /* |
---|
26 | * Spin for <= ticks so we spin >= number of ticks. |
---|
27 | * The first tick we spin through is a partial one. |
---|
28 | * So you sping "ticks" number of ticks plus a partial |
---|
29 | * one. |
---|
30 | */ |
---|
31 | } while ( (now-start) <= ticks ); |
---|
32 | } |
---|
33 | |
---|
34 | /* |
---|
35 | * Spin until the next clock tick |
---|
36 | */ |
---|
37 | void rtems_test_spin_until_next_tick( void ) |
---|
38 | { |
---|
39 | rtems_interval start; |
---|
40 | rtems_interval now; |
---|
41 | |
---|
42 | start = rtems_clock_get_ticks_since_boot(); |
---|
43 | do { |
---|
44 | now = rtems_clock_get_ticks_since_boot(); |
---|
45 | } while ( now != start ); |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.