From 24bf11eca11947d961cc9bb5f7d92dabff169e93 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 12 Feb 2014 10:31:38 +0100 Subject: score: Add CPU counter support Add a CPU counter interface to allow access to a free-running counter. It is useful to measure short time intervals. This can be used for example to enable profiling of critical low-level functions. Add two busy wait functions rtems_counter_delay_ticks() and rtems_counter_delay_nanoseconds() implemented via the CPU counter. --- c/src/lib/libbsp/shared/cpucounterdiff.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 c/src/lib/libbsp/shared/cpucounterdiff.c (limited to 'c/src/lib/libbsp/shared/cpucounterdiff.c') diff --git a/c/src/lib/libbsp/shared/cpucounterdiff.c b/c/src/lib/libbsp/shared/cpucounterdiff.c new file mode 100644 index 0000000000..cf4a4bdcef --- /dev/null +++ b/c/src/lib/libbsp/shared/cpucounterdiff.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * 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 + +CPU_Counter_ticks _CPU_Counter_difference( + CPU_Counter_ticks second, + CPU_Counter_ticks first +) +{ + return second - first; +} -- cgit v1.2.3