source: rtems/c/src/lib/libbsp/m68k/mvme147/timer/timer.c @ 8fbe2e6

4.11
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2014 at 1:59:49 PM

Use correct prototype of benchmark_timer_read()

This change starts with removing the effectively empty file
timerdrv.h. The prototypes for benchmark_timer_XXX() were in
btimer.h which was not universally used. Thus every use of
timerdrv.h had to be changed to btimer.h. Then the prototypes
for benchmark_timer_read() had to be adjusted to return
benchmark_timer_t rather than int or uint32_t.

I took this opportunity to also correct the file headers to
separate the copyright from the file description comments which
is needed to ensure the copyright isn't propagated into Doxygen
output.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
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.org/license/LICENSE.
8 *
9 *  MVME147 port for TNI - Telecom Bretagne
10 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
11 *  May 1996
12 */
13
14#include <rtems/btimer.h>
15#include <bsp.h>
16
17#define TIMER_INT_LEVEL 6
18
19#define COUNTDOWN_VALUE 0
20/* Allows 0.4096 second delay betwin ints */
21/* Each tick is 6.25 us */
22
23int Ttimer_val;
24bool benchmark_timer_find_average_overhead;
25
26rtems_isr_entry timerisr(rtems_vector_number);
27
28void benchmark_timer_initialize(void)
29{
30  (void) set_vector(timerisr, TIMER_1_VECTOR, 0); /* install ISR */
31
32  Ttimer_val = 0;                 /* clear timer ISR count */
33  pcc->timer1_int_control = 0x00; /* Disable T1 Interr. */
34  pcc->timer1_preload = COUNTDOWN_VALUE;
35  /* write countdown preload value */
36  pcc->timer1_control = 0x00; /* load preload value */
37  pcc->timer1_control = 0x07; /* clear T1 overflow counter, enable counter */
38  pcc->timer1_int_control = TIMER_INT_LEVEL|0x08;
39  /* Enable Timer 1 and set its int. level */
40
41}
42
43#define AVG_OVERHEAD      0  /* No need to start/stop the timer to read
44                                its value on the MVME147 PCC: reads are not
45                                synchronized whith the counter updates*/
46#define LEAST_VALID       10 /* Don't trust a value lower than this */
47
48benchmark_timer_t benchmark_timer_read(void)
49{
50  uint32_t         total;
51  uint16_t         counter_value;
52
53  counter_value = pcc->timer1_count; /* read the counter value */
54
55  total = ((Ttimer_val * 0x10000) + counter_value); /* in 6.25 us units */
56  /* DC note : just look at the assembly generated
57     to see gcc's impressive optimization ! */
58  return total;
59
60}
61
62void benchmark_timer_disable_subtracting_average_overhead(
63  bool find_flag
64)
65{
66  benchmark_timer_find_average_overhead = find_flag;
67}
Note: See TracBrowser for help on using the repository browser.