source: rtems/c/src/lib/libbsp/m32c/m32cbsp/timer/timer.c @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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