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

4.104.114.84.95
Last change on this file since a858910 was 98e4ebf5, checked in by Joel Sherrill <joel.sherrill@…>, on 10/08/97 at 15:45:54

Fixed typo in the pointer to the license terms.

  • Property mode set to 100644
File size: 2.2 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-1997.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  MVME147 port for TNI - Telecom Bretagne
21 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
22 *  May 1996
23 *
24 *  $Id$
25 */
26
27#include <bsp.h>
28
29#define TIMER_INT_LEVEL 6
30
31#define COUNTDOWN_VALUE 0
32/* Allows 0.4096 second delay betwin ints */
33/* Each tick is 6.25 us */
34
35int Ttimer_val;
36rtems_boolean Timer_driver_Find_average_overhead;
37
38rtems_isr timerisr();
39
40void Timer_initialize()
41{
42  (void) set_vector(timerisr, TIMER_1_VECTOR, 0); /* install ISR */
43
44  Ttimer_val = 0;                 /* clear timer ISR count */
45  pcc->timer1_int_control = 0x00; /* Disable T1 Interr. */
46  pcc->timer1_preload = COUNTDOWN_VALUE;
47  /* write countdown preload value */
48  pcc->timer1_control = 0x00; /* load preload value */
49  pcc->timer1_control = 0x07; /* clear T1 overflow counter, enable counter */
50  pcc->timer1_int_control = TIMER_INT_LEVEL|0x08;
51  /* Enable Timer 1 and set its int. level */
52 
53}
54
55#define AVG_OVERHEAD      0  /* No need to start/stop the timer to read
56                                its value on the MVME147 PCC: reads are not
57                                synchronized whith the counter updates*/
58#define LEAST_VALID       10 /* Don't trust a value lower than this */
59
60int Read_timer()
61{
62  rtems_unsigned32 total;
63  rtems_unsigned16 counter_value;
64
65  counter_value = pcc->timer1_count; /* read the counter value */
66
67  total = ((Ttimer_val * 0x10000) + counter_value); /* in 6.25 us units */
68  /* DC note : just look at the assembly generated
69     to see gcc's impressive optimization ! */
70  return total;
71
72}
73
74rtems_status_code Empty_function( void )
75{
76  return RTEMS_SUCCESSFUL;
77}
78
79void Set_find_average_overhead(
80  rtems_boolean find_flag
81)
82{
83  Timer_driver_Find_average_overhead = find_flag;
84}
Note: See TracBrowser for help on using the repository browser.