1 | /*===============================================================*\ |
---|
2 | | Project: RTEMS TQM8xx BSP | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | This file has been adapted to MPC8xx by | |
---|
5 | | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | |
---|
6 | | Copyright (c) 2008 | |
---|
7 | | Embedded Brains GmbH | |
---|
8 | | Obere Lagerstr. 30 | |
---|
9 | | D-82178 Puchheim | |
---|
10 | | Germany | |
---|
11 | | rtems@embedded-brains.de | |
---|
12 | | | |
---|
13 | | See the other copyright notice below for the original parts. | |
---|
14 | +-----------------------------------------------------------------+ |
---|
15 | | The license and distribution terms for this file may be | |
---|
16 | | found in the file LICENSE in this distribution or at | |
---|
17 | | | |
---|
18 | | http://www.rtems.com/license/LICENSE. | |
---|
19 | | | |
---|
20 | +-----------------------------------------------------------------+ |
---|
21 | | this file contains the console driver | |
---|
22 | \*===============================================================*/ |
---|
23 | /* |
---|
24 | * Timer_init() |
---|
25 | * |
---|
26 | * Use TIMER 1 and TIMER 2 for Timing Test Suite |
---|
27 | * |
---|
28 | * this is derived from "timer.c" available in the m68k/gen68360 BSP |
---|
29 | * adapted by Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> |
---|
30 | * |
---|
31 | * $Id$ |
---|
32 | */ |
---|
33 | |
---|
34 | /* |
---|
35 | * |
---|
36 | * Input parameters: NONE |
---|
37 | * |
---|
38 | * Output parameters: NONE |
---|
39 | * |
---|
40 | * NOTE: It is important that the timer start/stop overhead be |
---|
41 | * determined when porting or modifying this code. |
---|
42 | * |
---|
43 | * COPYRIGHT (c) 1989-1999. |
---|
44 | * On-Line Applications Research Corporation (OAR). |
---|
45 | * |
---|
46 | * The license and distribution terms for this file may be |
---|
47 | * found in the file LICENSE in this distribution or at |
---|
48 | * http://www.rtems.com/license/LICENSE. |
---|
49 | */ |
---|
50 | |
---|
51 | #include <rtems.h> |
---|
52 | #include <bsp.h> |
---|
53 | #include <mpc8xx.h> |
---|
54 | |
---|
55 | void |
---|
56 | Timer_initialize (void) |
---|
57 | { |
---|
58 | /* |
---|
59 | * Reset timers 1 and 2 |
---|
60 | */ |
---|
61 | m8xx.tgcr &= ~0x00FF; |
---|
62 | m8xx.tcn1 = 0; |
---|
63 | m8xx.tcn2 = 0; |
---|
64 | m8xx.ter1 = 0xFFFF; |
---|
65 | m8xx.ter2 = 0xFFFF; |
---|
66 | |
---|
67 | /* |
---|
68 | * Cascade timers 1 and 2 |
---|
69 | */ |
---|
70 | m8xx.tgcr |= M8xx_TGCR_CAS2; |
---|
71 | |
---|
72 | /* |
---|
73 | * Configure timers 1 and 2 to a single 32-bit, BUS_clock timer. |
---|
74 | */ |
---|
75 | m8xx.tmr2 = (0 << 8) | 0x2; |
---|
76 | m8xx.tmr1 = 0; |
---|
77 | |
---|
78 | /* |
---|
79 | * Start the timers |
---|
80 | */ |
---|
81 | m8xx.tgcr |= 0x0011; |
---|
82 | } |
---|
83 | |
---|
84 | /* |
---|
85 | * Return timer value in microsecond units |
---|
86 | */ |
---|
87 | int |
---|
88 | Read_timer (void) |
---|
89 | { |
---|
90 | int retval; |
---|
91 | retval = *(uint32_t*)&m8xx.tcn1; |
---|
92 | retval = retval * 1000000LL / BSP_bus_frequency; |
---|
93 | return retval; |
---|
94 | } |
---|
95 | |
---|
96 | /* |
---|
97 | * Empty function call used in loops to measure basic cost of looping |
---|
98 | * in Timing Test Suite. |
---|
99 | */ |
---|
100 | rtems_status_code |
---|
101 | Empty_function (void) |
---|
102 | { |
---|
103 | return RTEMS_SUCCESSFUL; |
---|
104 | } |
---|
105 | |
---|
106 | void |
---|
107 | Set_find_average_overhead(bool find_flag) |
---|
108 | { |
---|
109 | } |
---|