blob: 5ce906c723501a9fbceb1957efd8f7451a49f511 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
* This file implements a stub benchmark timer that is sufficient to
* satisfy linking the RTEMS Benchmarks.
*
* COPYRIGHT (c) 1989-2001.
* On-Line Applications Research Corporation (OAR).
*/
#include <bsp.h>
#include <rtems/btimer.h>
#include <varvects.h>
bool benchmark_timer_find_average_overhead;
uint32_t benchmark_timer_overhead = 10;
#define TABSR *((uint8_t *)0x340)
#define TA0MR *((uint8_t *)0x356)
#define TA0 *((uint16_t *)0x346)
#define TA0IC *((uint8_t *)0x6c)
static int benchmark_timer_interrupts;
#define ivec_timer_a0 12
void __attribute__((interrupt))
timer_ra_interrupt(void)
{
benchmark_timer_interrupts++;
TA0IC = 0x05;
}
void benchmark_timer_initialize(void)
{
benchmark_timer_interrupts = 0;
_set_var_vect (timer_ra_interrupt, ivec_timer_a0);
TA0MR = 0x00;
TA0 = 0xffff;
TA0IC = 0x05;
TABSR = 0x55;
}
uint32_t benchmark_timer_read(void)
{
uint32_t count;
count = 0xFFFF - TA0;
count += benchmark_timer_interrupts * 0xFFFFL;
if (!benchmark_timer_find_average_overhead) {
if ( count > benchmark_timer_overhead )
count -= benchmark_timer_overhead;
else
count = 0;
}
return count;
}
void benchmark_timer_disable_subtracting_average_overhead(
bool find_flag
)
{
benchmark_timer_find_average_overhead = find_flag;
}
|