source: rtems/c/src/lib/libbsp/m68k/uC5282/timer/timer.c @ 5b6111b

4.104.114.84.95
Last change on this file since 5b6111b was 5b6111b, checked in by Eric Norum <WENorum@…>, on 02/03/05 at 16:01:04

Add support for interrupt controller allocation. This will provides a
mechanism for applications to find a free level/priority.

  • Property mode set to 100644
File size: 878 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 = bsp_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.