source: rtems/c/src/lib/libbsp/m68k/mvme147/timer/timer.c @ 25c62b0

4.104.114.95
Last change on this file since 25c62b0 was 25c62b0, checked in by Joel Sherrill <joel.sherrill@…>, on 08/31/08 at 18:18:17

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: 2.1 KB
Line 
1/*  Timer_init()
2 *
3 *  This routine initializes the PCC timer on the MVME147 board.
4 *
5 *  Input parameters:  NONE
6 *
7 *  Output parameters:  NONE
8 *
9 *  NOTE: It is important that the timer start/stop overhead be
10 *        determined when porting or modifying this code.
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  MVME147 port for TNI - Telecom Bretagne
20 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
21 *  May 1996
22 *
23 *  $Id$
24 */
25
26#include <bsp.h>
27
28#define TIMER_INT_LEVEL 6
29
30#define COUNTDOWN_VALUE 0
31/* Allows 0.4096 second delay betwin ints */
32/* Each tick is 6.25 us */
33
34int Ttimer_val;
35rtems_boolean benchmark_timer_find_average_overhead;
36
37rtems_isr timerisr(void);
38
39void benchmark_timer_initialize(void)
40{
41  (void) set_vector(timerisr, TIMER_1_VECTOR, 0); /* install ISR */
42
43  Ttimer_val = 0;                 /* clear timer ISR count */
44  pcc->timer1_int_control = 0x00; /* Disable T1 Interr. */
45  pcc->timer1_preload = COUNTDOWN_VALUE;
46  /* write countdown preload value */
47  pcc->timer1_control = 0x00; /* load preload value */
48  pcc->timer1_control = 0x07; /* clear T1 overflow counter, enable counter */
49  pcc->timer1_int_control = TIMER_INT_LEVEL|0x08;
50  /* Enable Timer 1 and set its int. level */
51
52}
53
54#define AVG_OVERHEAD      0  /* No need to start/stop the timer to read
55                                its value on the MVME147 PCC: reads are not
56                                synchronized whith the counter updates*/
57#define LEAST_VALID       10 /* Don't trust a value lower than this */
58
59int benchmark_timer_read(void)
60{
61  uint32_t         total;
62  uint16_t         counter_value;
63
64  counter_value = pcc->timer1_count; /* read the counter value */
65
66  total = ((Ttimer_val * 0x10000) + counter_value); /* in 6.25 us units */
67  /* DC note : just look at the assembly generated
68     to see gcc's impressive optimization ! */
69  return total;
70
71}
72
73void benchmark_timer_disable_subtracting_average_overhead(
74  rtems_boolean find_flag
75)
76{
77  benchmark_timer_find_average_overhead = find_flag;
78}
Note: See TracBrowser for help on using the repository browser.