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, 1990, 1991, 1992, 1993, 1994. |
---|
30 | * On-Line Applications Research Corporation (OAR). |
---|
31 | * All rights assigned to U.S. Government, 1994. |
---|
32 | * |
---|
33 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
34 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
35 | * notice must appear in all copies of this file and its derivatives. |
---|
36 | */ |
---|
37 | |
---|
38 | #include <rtems.h> |
---|
39 | #include <bsp.h> |
---|
40 | #include "m68360.h" |
---|
41 | |
---|
42 | void |
---|
43 | Timer_initialize (void) |
---|
44 | { |
---|
45 | /* |
---|
46 | * Reset timers 1 and 2 |
---|
47 | */ |
---|
48 | m360.tgcr &= ~0x00FF; |
---|
49 | m360.tcn1 = 0; |
---|
50 | m360.tcn2 = 0; |
---|
51 | m360.ter1 = 0xFFFF; |
---|
52 | m360.ter2 = 0xFFFF; |
---|
53 | |
---|
54 | /* |
---|
55 | * Cascade timers 1 and 2 |
---|
56 | */ |
---|
57 | m360.tgcr |= 0x0080; |
---|
58 | |
---|
59 | /* |
---|
60 | * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer. |
---|
61 | * HARDWARE: |
---|
62 | * Change the `25' to match your processor clock |
---|
63 | */ |
---|
64 | m360.tmr2 = ((25-1) << 8) | 0x2; |
---|
65 | m360.tmr1 = 0; |
---|
66 | |
---|
67 | /* |
---|
68 | * Start the timers |
---|
69 | */ |
---|
70 | m360.tgcr |= 0x0011; |
---|
71 | } |
---|
72 | |
---|
73 | /* |
---|
74 | * Return timer value in microsecond units |
---|
75 | */ |
---|
76 | int |
---|
77 | Read_timer (void) |
---|
78 | { |
---|
79 | return *(rtems_unsigned32 *)&m360.tcn1; |
---|
80 | } |
---|
81 | |
---|
82 | /* |
---|
83 | * Empty function call used in loops to measure basic cost of looping |
---|
84 | * in Timing Test Suite. |
---|
85 | */ |
---|
86 | rtems_status_code |
---|
87 | Empty_function (void) |
---|
88 | { |
---|
89 | return RTEMS_SUCCESSFUL; |
---|
90 | } |
---|
91 | |
---|
92 | void |
---|
93 | Set_find_average_overhead(rtems_boolean find_flag) |
---|
94 | { |
---|
95 | } |
---|