4.104.114.95
Last change
on this file since 39c1a1af was
39c1a1af,
checked in by Joel Sherrill <joel.sherrill@…>, on 08/31/08 at 17:33:55
|
2008-08-31 Joel Sherrill <joel.sherrill@…>
- timer/timer.c: Eliminate empty function from every benchmark timer
driver. Fix spelling.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* |
---|
2 | * RTEMS for Nintendo DS performance timer driver. |
---|
3 | * |
---|
4 | * Copyright (c) 2008 by Benjamin Ratier <agho.pwn@gmail.com> |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * |
---|
9 | * http://www.rtems.com/license/LICENSE |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include <rtems.h> |
---|
15 | #include <bsp.h> |
---|
16 | #include <nds.h> |
---|
17 | |
---|
18 | bool benchmark_timer_find_average_overhead; |
---|
19 | |
---|
20 | void |
---|
21 | benchmark_timer_initialize (void) |
---|
22 | { |
---|
23 | TIMER_CR (1) = 0x0000; |
---|
24 | TIMER_CR (2) = 0x0000; |
---|
25 | TIMER_DATA (1) = TIMER_FREQ (1000000); |
---|
26 | TIMER_DATA (2) = 0x0000; |
---|
27 | TIMER_CR (1) = TIMER_ENABLE | TIMER_DIV_1; |
---|
28 | TIMER_CR (2) = TIMER_ENABLE | TIMER_CASCADE; |
---|
29 | } |
---|
30 | |
---|
31 | /* |
---|
32 | * values taken out from gba bsp. |
---|
33 | */ |
---|
34 | |
---|
35 | #define AVG_OVERHEAD 3 |
---|
36 | #define LEAST_VALID 1 |
---|
37 | |
---|
38 | uint32_t |
---|
39 | benchmark_timer_read (void) |
---|
40 | { |
---|
41 | uint32_t ticks; |
---|
42 | |
---|
43 | /* stop counters */ |
---|
44 | TIMER_CR (1) = 0x0000; |
---|
45 | TIMER_CR (2) = 0x0000; |
---|
46 | |
---|
47 | /* read counter */ |
---|
48 | ticks = (TIMER_DATA (2) << 16) | TIMER_DATA (1); |
---|
49 | return ticks; |
---|
50 | } |
---|
51 | |
---|
52 | void |
---|
53 | benchmark_timer_disable_subtracting_average_overhead (bool find_flag) |
---|
54 | { |
---|
55 | benchmark_timer_find_average_overhead = find_flag; |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.