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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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
15/*
16 *
17 *  Input parameters:  NONE
18 *
19 *  Output parameters:  NONE
20 *
21 *  NOTE: It is important that the timer start/stop overhead be
22 *        determined when porting or modifying this code.
23 *
24 *  COPYRIGHT (c) 1989-1999.
25 *  On-Line Applications Research Corporation (OAR).
26 *
27 *  The license and distribution terms for this file may be
28 *  found in the file LICENSE in this distribution or at
29 *  http://www.rtems.org/license/LICENSE.
30 */
31
32#include <rtems.h>
33#include <rtems/btimer.h>
34#include <bsp.h>
35#include <rtems/m68k/m68360.h>
36
37void
38benchmark_timer_initialize (void)
39{
40        /*
41         * Reset timers 1 and 2
42         */
43        m360.tgcr &= ~0x00FF;
44        m360.tcn1 = 0;
45        m360.tcn2 = 0;
46        m360.ter1 = 0xFFFF;
47        m360.ter2 = 0xFFFF;
48
49        /*
50         * Cascade timers 1 and 2
51         */
52        m360.tgcr |= 0x0080;
53
54        /*
55         * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
56         * HARDWARE:
57         *      Change the `25' to match your processor clock
58         */
59        m360.tmr2 = ((25-1) << 8) | 0x2;
60        m360.tmr1 = 0;
61
62        /*
63         * Start the timers
64         */
65        m360.tgcr |=  0x0011;
66}
67
68/*
69 * Return timer value in microsecond units
70 */
71uint32_t
72benchmark_timer_read (void)
73{
74        unsigned short val;
75
76        val = m360.tcn1;
77        return val;
78}
79
80void
81benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
82{
83}
Note: See TracBrowser for help on using the repository browser.