source: rtems/c/src/lib/libbsp/m68k/gen68360/timer/timer.c @ 427bb7d

4.104.115
Last change on this file since 427bb7d was 427bb7d, checked in by Joel Sherrill <joel.sherrill@…>, on 04/28/10 at 19:16:22

2010-04-28 Joel Sherrill <joel.sherrilL@…>

  • startup/init68360.c, timer/timer.c: Remove warnings.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * Use TIMER 1 and TIMER 2 for Timing Test Suite
3 * The hardware on the MC68360 makes these routines very simple.
4 *
5 * Based on the `gen68302' board support package, and covered by the
6 * original distribution terms.
7 *
8 * W. Eric Norum
9 * Saskatchewan Accelerator Laboratory
10 * University of Saskatchewan
11 * Saskatoon, Saskatchewan, CANADA
12 * eric@skatter.usask.ca
13 *
14 *  $Id$
15 */
16
17/*
18 *
19 *  Input parameters:  NONE
20 *
21 *  Output parameters:  NONE
22 *
23 *  NOTE: It is important that the timer start/stop overhead be
24 *        determined when porting or modifying this code.
25 *
26 *  COPYRIGHT (c) 1989-1999.
27 *  On-Line Applications Research Corporation (OAR).
28 *
29 *  The license and distribution terms for this file may be
30 *  found in the file LICENSE in this distribution or at
31 *  http://www.rtems.com/license/LICENSE.
32 */
33
34#include <rtems.h>
35#include <bsp.h>
36#include <rtems/m68k/m68360.h>
37
38void
39benchmark_timer_initialize (void)
40{
41        /*
42         * Reset timers 1 and 2
43         */
44        m360.tgcr &= ~0x00FF;
45        m360.tcn1 = 0;
46        m360.tcn2 = 0;
47        m360.ter1 = 0xFFFF;
48        m360.ter2 = 0xFFFF;
49
50        /*
51         * Cascade timers 1 and 2
52         */
53        m360.tgcr |= 0x0080;
54
55        /*
56         * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
57         * HARDWARE:
58         *      Change the `25' to match your processor clock
59         */
60        m360.tmr2 = ((25-1) << 8) | 0x2;
61        m360.tmr1 = 0;
62
63        /*
64         * Start the timers
65         */
66        m360.tgcr |=  0x0011;
67}
68
69/*
70 * Return timer value in microsecond units
71 */
72int
73benchmark_timer_read (void)
74{
75        unsigned short val;
76
77        val = m360.tcn1;
78        return val;
79}
80
81void
82benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
83{
84}
Note: See TracBrowser for help on using the repository browser.