source: rtems/c/src/lib/libbsp/m68k/gen68360/timer/timer.c @ 457b6ae

4.104.114.84.95
Last change on this file since 457b6ae was 457b6ae, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 6, 1996 at 10:01:11 PM

Generic 68360 BSP (gen360) submitted by: W. Eric Norum <eric@…>.
Contact information:

  1. Eric Norum Saskatchewan Accelerator Laboratory 107 North Road University of Saskatchewan Saskatoon, Saskatchewan, CANADA S7N 5C6
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * Timer_init()
3 *
4 * Use TIMER 1 and TIMER 2 for Timing Test Suite
5 *
6 * The hardware on the MC68360 makes these routines very simple.
7 *
8 * Based on the `gen68302' board support package, and covered by the
9 * original distribution terms.
10 *
11 * W. Eric Norum
12 * Saskatchewan Accelerator Laboratory
13 * University of Saskatchewan
14 * Saskatoon, Saskatchewan, CANADA
15 * eric@skatter.usask.ca
16 *
17 *  $Id$
18 */
19
20/*
21 *
22 *  Input parameters:  NONE
23 *
24 *  Output parameters:  NONE
25 *
26 *  NOTE: It is important that the timer start/stop overhead be
27 *        determined when porting or modifying this code.
28 *
29 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
30 *  On-Line Applications Research Corporation (OAR).
31 *  All rights assigned to U.S. Government, 1994.
32 *
33 *  This material may be reproduced by or for the U.S. Government pursuant
34 *  to the copyright license under the clause at DFARS 252.227-7013.  This
35 *  notice must appear in all copies of this file and its derivatives.
36 */
37
38#include <rtems.h>
39#include <bsp.h>
40#include "mc68360.h"
41
42void
43Timer_initialize (void)
44{
45        /*
46         * Reset timers 1 and 2
47         */
48        m360.tgcr &= ~0x00FF;
49        m360.tcn1 = 0;
50        m360.tcn2 = 0;
51        m360.ter1 = 0xFFFF;
52        m360.ter2 = 0xFFFF;
53
54        /*
55         * Cascade timers 1 and 2
56         */
57        m360.tgcr |= 0x0080;
58
59        /*
60         * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
61         * HARDWARE:
62         *      Change the `25' to match your processor clock
63         */
64        m360.tmr2 = ((25-1) << 8) | 0x2;
65        m360.tmr1 = 0;
66
67        /*
68         * Start the timers
69         */
70        m360.tgcr |=  0x0011;
71}
72
73/*
74 * Return timer value in microsecond units
75 */
76int
77Read_timer (void)
78{
79        return *(rtems_unsigned32 *)&m360.tcn1;
80}
81
82/*
83 * Empty function call used in loops to measure basic cost of looping
84 * in Timing Test Suite.
85 */
86rtems_status_code
87Empty_function (void)
88{
89        return RTEMS_SUCCESSFUL;
90}
91
92void
93Set_find_average_overhead(rtems_boolean find_flag)
94{
95}
Note: See TracBrowser for help on using the repository browser.