diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-09-21 07:44:28 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-09-21 07:44:28 +0000 |
commit | 687e34b6194bd4722d5955a8cdb89389d52f89f9 (patch) | |
tree | ef465839aab0b641efa100268a851474e21d4f3b /c/src/lib/libbsp/arm/lpc24xx/misc/timer.c | |
parent | 2009-09-20 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-687e34b6194bd4722d5955a8cdb89389d52f89f9.tar.bz2 |
Add missing files.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/misc/timer.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/misc/timer.c b/c/src/lib/libbsp/arm/lpc24xx/misc/timer.c new file mode 100644 index 0000000000..e9d44312ab --- /dev/null +++ b/c/src/lib/libbsp/arm/lpc24xx/misc/timer.c @@ -0,0 +1,55 @@ +/** + * @file + * + * @ingroup lpc24xx + * + * @brief Benchmark timer support. + */ + +/* + * Copyright (c) 2008, 2009 + * embedded brains GmbH + * Obere Lagerstr. 30 + * D-82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <rtems.h> +#include <rtems/timerdrv.h> + +#include <bsp/system-clocks.h> + +static bool benchmark_timer_find_average_overhead = false; + +static uint32_t benchmark_timer_base; + +void benchmark_timer_initialize(void) +{ + benchmark_timer_base = lpc24xx_timer(); +} + +uint32_t benchmark_timer_read(void) +{ + uint32_t delta = lpc24xx_timer() - benchmark_timer_base; + + if (benchmark_timer_find_average_overhead) { + return delta; + } else { + /* Value determined by tmck for NCS board */ + if (delta > 74) { + return delta - 74; + } else { + return 0; + } + } +} + +void benchmark_timer_disable_subtracting_average_overhead( bool find_average_overhead ) +{ + benchmark_timer_find_average_overhead = find_average_overhead; +} |