source: rtems/bsps/m68k/uC5282/btimer/btimer.c @ e0dd8a5a

5
Last change on this file since e0dd8a5a was e0dd8a5a, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 10:08:42

bsps: Move benchmark timer to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.0 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.org/license/LICENSE.
14 */
15
16#include <rtems.h>
17#include <bsp.h>
18#include <rtems/btimer.h>
19
20void
21benchmark_timer_initialize(void)
22{
23    int preScaleDivisor = bsp_get_CPU_clock_speed() / 1000000;
24    int div = MCF5282_TIMER_DTMR_CLK_DIV1;
25
26    if (preScaleDivisor > 256) {
27        preScaleDivisor /= 16;
28        div = MCF5282_TIMER_DTMR_CLK_DIV16;
29    }
30    MCF5282_TIMER3_DTMR = 0;
31    MCF5282_TIMER3_DTMR = MCF5282_TIMER_DTMR_PS(preScaleDivisor - 1) | div |
32                          MCF5282_TIMER_DTMR_RST;
33}
34
35/*
36 * Return timer value in microsecond units
37 */
38uint32_t
39benchmark_timer_read(void)
40{
41    return MCF5282_TIMER3_DTCN;
42}
43
44void
45benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
46{
47}
Note: See TracBrowser for help on using the repository browser.