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

4.115
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/14 at 13:59:49

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
RevLine 
[290da88f]1/*
[08311cc3]2 *  COPYRIGHT (c) 1989-1999.
[28fa54d9]3 *  On-Line Applications Research Corporation (OAR).
4 *
[98e4ebf5]5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
[c499856]7 *  http://www.rtems.org/license/LICENSE.
[28fa54d9]8 *
9 *  MVME147 port for TNI - Telecom Bretagne
10 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
11 *  May 1996
12 */
13
[26c17377]14#include <rtems/btimer.h>
[28fa54d9]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;
[907bf4b8]24bool benchmark_timer_find_average_overhead;
[28fa54d9]25
[a89e5002]26rtems_isr_entry timerisr(rtems_vector_number);
[28fa54d9]27
[25c62b0]28void benchmark_timer_initialize(void)
[28fa54d9]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 */
[6128a4a]38  pcc->timer1_int_control = TIMER_INT_LEVEL|0x08;
[28fa54d9]39  /* Enable Timer 1 and set its int. level */
[6128a4a]40
[28fa54d9]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
[8fbe2e6]48benchmark_timer_t benchmark_timer_read(void)
[28fa54d9]49{
[24282451]50  uint32_t         total;
51  uint16_t         counter_value;
[28fa54d9]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
[25c62b0]62void benchmark_timer_disable_subtracting_average_overhead(
[907bf4b8]63  bool find_flag
[28fa54d9]64)
65{
[25c62b0]66  benchmark_timer_find_average_overhead = find_flag;
[28fa54d9]67}
Note: See TracBrowser for help on using the repository browser.