![]() |
|
|||
File indexing completed on 2025-05-11 08:23:59
0001 /* 0002 * RTEMS TQM8xx BSP 0003 * 0004 * This file contains the console driver. 0005 */ 0006 0007 /* 0008 * Copyright (c) 2008 Thomas Doerfler, embedded brains GmbH & Co. KG 0009 * All rights reserved. 0010 * 0011 * The license and distribution terms for this file may be 0012 * found in the file LICENSE in this distribution or at 0013 * http://www.rtems.org/license/LICENSE. 0014 */ 0015 0016 /* 0017 * benchmark_timer_initialize() 0018 * 0019 * Use TIMER 1 and TIMER 2 for Timing Test Suite 0020 * 0021 * this is derived from "timer.c" available in the m68k/gen68360 BSP 0022 * adapted by Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> 0023 */ 0024 0025 /* 0026 * 0027 * Input parameters: NONE 0028 * 0029 * Output parameters: NONE 0030 * 0031 * NOTE: It is important that the timer start/stop overhead be 0032 * determined when porting or modifying this code. 0033 * 0034 * COPYRIGHT (c) 1989-1999. 0035 * On-Line Applications Research Corporation (OAR). 0036 * 0037 * The license and distribution terms for this file may be 0038 * found in the file LICENSE in this distribution or at 0039 * http://www.rtems.org/license/LICENSE. 0040 */ 0041 0042 #include <rtems.h> 0043 #include <bsp.h> 0044 #include <rtems/btimer.h> 0045 #include <mpc8xx.h> 0046 0047 bool benchmark_timer_find_average_overhead; 0048 0049 void 0050 benchmark_timer_initialize (void) 0051 { 0052 /* 0053 * Reset timers 1 and 2 0054 */ 0055 m8xx.tgcr &= ~0x00FF; 0056 m8xx.tcn1 = 0; 0057 m8xx.tcn2 = 0; 0058 m8xx.ter1 = 0xFFFF; 0059 m8xx.ter2 = 0xFFFF; 0060 0061 /* 0062 * Cascade timers 1 and 2 0063 */ 0064 m8xx.tgcr |= M8xx_TGCR_CAS2; 0065 0066 /* 0067 * Configure timers 1 and 2 to a single 32-bit, BUS_clock timer. 0068 */ 0069 m8xx.tmr2 = (0 << 8) | 0x2; 0070 m8xx.tmr1 = 0; 0071 0072 /* 0073 * Start the timers 0074 */ 0075 m8xx.tgcr |= 0x0011; 0076 } 0077 0078 /* 0079 * Return timer value in microsecond units 0080 */ 0081 benchmark_timer_t benchmark_timer_read(void) 0082 { 0083 uint32_t retval; 0084 retval = *(uint32_t*)&m8xx.tcn1; 0085 retval = retval * 1000000LL / BSP_bus_frequency; 0086 return retval; 0087 } 0088 0089 void benchmark_timer_disable_subtracting_average_overhead( 0090 bool find_flag 0091 ) 0092 { 0093 benchmark_timer_find_average_overhead = find_flag; 0094 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |