OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [m68k/] [gen68360/] [timer/] [timer.c] - Blame information for rev 773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: timer.c,v 1.2 2001-09-27 12:00:08 chris Exp $
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.OARcorp.com/rtems/license.html.
35
 */
36
 
37
#include <rtems.h>
38
#include <bsp.h>
39
#include "m68360.h"
40
 
41
void
42
Timer_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
 */
75
int
76
Read_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
 */
85
rtems_status_code
86
Empty_function (void)
87
{
88
        return RTEMS_SUCCESSFUL;
89
}
90
 
91
void
92
Set_find_average_overhead(rtems_boolean find_flag)
93
{
94
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.