source: rtems/c/src/lib/libbsp/m68k/uC5282/timer/timer.c @ 239b819

4.104.114.84.95
Last change on this file since 239b819 was 572484f, checked in by Eric Norum <WENorum@…>, on Jan 28, 2005 at 7:35:23 PM

New BSP for Arcturus uCDIMM ColdFire? 5282.

  • Property mode set to 100644
File size: 874 bytes
Line 
1/*
2 *  Timer Init
3 *
4 *  Use the last DMA timer (DTIM3) as the diagnostic timer.
5 */
6
7#include <rtems.h>
8#include <bsp.h>
9
10void
11Timer_initialize(void)
12{
13    int preScaleDivisor = get_CPU_clock_speed() / 1000000;
14    int div = MCF5282_TIMER_DTMR_CLK_DIV1;
15
16    if (preScaleDivisor > 256) {
17        preScaleDivisor /= 16;
18        div = MCF5282_TIMER_DTMR_CLK_DIV16;
19    }
20    MCF5282_TIMER3_DTMR = 0;
21    MCF5282_TIMER3_DTMR = MCF5282_TIMER_DTMR_PS(preScaleDivisor - 1) | div |
22                          MCF5282_TIMER_DTMR_RST;
23}
24
25/*
26 * Return timer value in microsecond units
27 */
28int
29Read_timer(void)
30{
31    return MCF5282_TIMER3_DTCN;
32}
33
34/*
35 *  Empty function call used in loops to measure basic cost of looping
36 *  in Timing Test Suite.
37 */
38rtems_status_code
39Empty_function(void)
40{
41    return RTEMS_SUCCESSFUL;
42}
43
44void
45Set_find_average_overhead(rtems_boolean find_flag)
46{
47}
Note: See TracBrowser for help on using the repository browser.