source: rtems/c/src/lib/libbsp/m68k/gen68360/timer/timer.c @ 26c17377

4.115
Last change on this file since 26c17377 was 26c17377, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/09/11 at 12:15:54

2011-02-09 Ralf Corsépius <ralf.corsepius@…>

  • timer/timer.c: Include <rtems/btimer.h>. Fix benchmark_timer_read() definition.
  • 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 <rtems/btimer.h>
36#include <bsp.h>
37#include <rtems/m68k/m68360.h>
38
39void
40benchmark_timer_initialize (void)
41{
42        /*
43         * Reset timers 1 and 2
44         */
45        m360.tgcr &= ~0x00FF;
46        m360.tcn1 = 0;
47        m360.tcn2 = 0;
48        m360.ter1 = 0xFFFF;
49        m360.ter2 = 0xFFFF;
50
51        /*
52         * Cascade timers 1 and 2
53         */
54        m360.tgcr |= 0x0080;
55
56        /*
57         * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
58         * HARDWARE:
59         *      Change the `25' to match your processor clock
60         */
61        m360.tmr2 = ((25-1) << 8) | 0x2;
62        m360.tmr1 = 0;
63
64        /*
65         * Start the timers
66         */
67        m360.tgcr |=  0x0011;
68}
69
70/*
71 * Return timer value in microsecond units
72 */
73uint32_t
74benchmark_timer_read (void)
75{
76        unsigned short val;
77
78        val = m360.tcn1;
79        return val;
80}
81
82void
83benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
84{
85}
Note: See TracBrowser for help on using the repository browser.