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

4.104.114.84.95
Last change on this file since b04a2b3 was c09e836, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:51:52

2003-09-04 Joel Sherrill <joel@…>

  • console/console.c, console/consolereserveresources.c, include/bsp.h, start/start.S, startup/bspclean.c, startup/bspstart.c, timer/timer.c: URL for license changed.
  • Property mode set to 100644
File size: 1.7 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-1999.
30 *  On-Line Applications Research Corporation (OAR).
31 *
32 *  The license and distribution terms for this file may be
33 *  found in the file LICENSE in this distribution or at
34 *  http://www.rtems.com/license/LICENSE.
35 */
36
37#include <rtems.h>
38#include <bsp.h>
39#include "m68360.h"
40
41void
42Timer_initialize (void)
43{
44        /*
45         * Reset timers 1 and 2
46         */
47        m360.tgcr &= ~0x00FF;
48        m360.tcn1 = 0;
49        m360.tcn2 = 0;
50        m360.ter1 = 0xFFFF;
51        m360.ter2 = 0xFFFF;
52
53        /*
54         * Cascade timers 1 and 2
55         */
56        m360.tgcr |= 0x0080;
57
58        /*
59         * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
60         * HARDWARE:
61         *      Change the `25' to match your processor clock
62         */
63        m360.tmr2 = ((25-1) << 8) | 0x2;
64        m360.tmr1 = 0;
65
66        /*
67         * Start the timers
68         */
69        m360.tgcr |=  0x0011;
70}
71
72/*
73 * Return timer value in microsecond units
74 */
75int
76Read_timer (void)
77{
78        return *(rtems_unsigned32 *)&m360.tcn1;
79}
80
81/*
82 * Empty function call used in loops to measure basic cost of looping
83 * in Timing Test Suite.
84 */
85rtems_status_code
86Empty_function (void)
87{
88        return RTEMS_SUCCESSFUL;
89}
90
91void
92Set_find_average_overhead(rtems_boolean find_flag)
93{
94}
Note: See TracBrowser for help on using the repository browser.