Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:49

0001 /*
0002  *  Timer Init
0003  *
0004  *  Use the last DMA timer (DTIM3) as the diagnostic timer.
0005  */
0006 
0007 /*
0008  * Copyright (c) 2005 Eric Norum <eric@norum.ca>
0009  *
0010  * COPYRIGHT (c) 2005.
0011  * On-Line Applications Research Corporation (OAR).
0012  *
0013  * The license and distribution terms for this file may be
0014  * found in the file LICENSE in this distribution or at
0015  * http://www.rtems.org/license/LICENSE.
0016  */
0017 
0018 #include <rtems.h>
0019 #include <bsp.h>
0020 #include <rtems/btimer.h>
0021 
0022 void
0023 benchmark_timer_initialize(void)
0024 {
0025     int preScaleDivisor = bsp_get_CPU_clock_speed() / 1000000;
0026     int div = MCF5282_TIMER_DTMR_CLK_DIV1;
0027 
0028     if (preScaleDivisor > 256) {
0029         preScaleDivisor /= 16;
0030         div = MCF5282_TIMER_DTMR_CLK_DIV16;
0031     }
0032     MCF5282_TIMER3_DTMR = 0;
0033     MCF5282_TIMER3_DTMR = MCF5282_TIMER_DTMR_PS(preScaleDivisor - 1) | div |
0034                           MCF5282_TIMER_DTMR_RST;
0035 }
0036 
0037 /*
0038  * Return timer value in microsecond units
0039  */
0040 uint32_t
0041 benchmark_timer_read(void)
0042 {
0043     return MCF5282_TIMER3_DTCN;
0044 }
0045 
0046 void
0047 benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
0048 {
0049 }