source: rtems/c/src/lib/libbsp/m68k/uC5282/timer/timer.c @ 424ee2ba

4.104.114.95
Last change on this file since 424ee2ba was 424ee2ba, checked in by Joel Sherrill <joel.sherrill@…>, on 08/31/08 at 16:47:17

2008-08-31 Joel Sherrill <joel.sherrill@…>

  • timer/timer.c: Rename timer driver methods to follow RTEMS programming conventions.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Timer Init
3 *
4 *  Use the last DMA timer (DTIM3) as the diagnostic timer.
5 *
6 *  Author: W. Eric Norum <norume@aps.anl.gov>
7 *
8 *  COPYRIGHT (c) 2005.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#include <rtems.h>
17#include <bsp.h>
18
19void
20benchmark_timerinitialize(void)
21{
22    int preScaleDivisor = bsp_get_CPU_clock_speed() / 1000000;
23    int div = MCF5282_TIMER_DTMR_CLK_DIV1;
24
25    if (preScaleDivisor > 256) {
26        preScaleDivisor /= 16;
27        div = MCF5282_TIMER_DTMR_CLK_DIV16;
28    }
29    MCF5282_TIMER3_DTMR = 0;
30    MCF5282_TIMER3_DTMR = MCF5282_TIMER_DTMR_PS(preScaleDivisor - 1) | div |
31                          MCF5282_TIMER_DTMR_RST;
32}
33
34/*
35 * Return timer value in microsecond units
36 */
37int
38benchmark_timerread(void)
39{
40    return MCF5282_TIMER3_DTCN;
41}
42
43/*
44 *  Empty function call used in loops to measure basic cost of looping
45 *  in Timing Test Suite.
46 */
47rtems_status_code
48benchmark_timerempty_function(void)
49{
50    return RTEMS_SUCCESSFUL;
51}
52
53void
54benchmark_timerdisable_subtracting_average_overhead(rtems_boolean find_flag)
55{
56}
Note: See TracBrowser for help on using the repository browser.