diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-19 06:22:32 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 09:49:37 +0200 |
commit | 7806d9c020e5da3ad1b5ce7af4c7c68def8de6c9 (patch) | |
tree | 1e484f06a4871d712094967429dde00965943592 /bsps/shared/dev/cpucounter | |
parent | bsps: Move getentropy-cpucounter.c to bsps (diff) | |
download | rtems-7806d9c020e5da3ad1b5ce7af4c7c68def8de6c9.tar.bz2 |
bsps: Move shared CPU counter support to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/shared/dev/cpucounter')
-rw-r--r-- | bsps/shared/dev/cpucounter/cpucounterdiff.c | 23 | ||||
-rw-r--r-- | bsps/shared/dev/cpucounter/cpucounterread.c | 27 |
2 files changed, 50 insertions, 0 deletions
diff --git a/bsps/shared/dev/cpucounter/cpucounterdiff.c b/bsps/shared/dev/cpucounter/cpucounterdiff.c new file mode 100644 index 0000000000..d77945d5b8 --- /dev/null +++ b/bsps/shared/dev/cpucounter/cpucounterdiff.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 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.org/license/LICENSE. + */ + +#include <rtems/score/cpu.h> + +CPU_Counter_ticks _CPU_Counter_difference( + CPU_Counter_ticks second, + CPU_Counter_ticks first +) +{ + return second - first; +} diff --git a/bsps/shared/dev/cpucounter/cpucounterread.c b/bsps/shared/dev/cpucounter/cpucounterread.c new file mode 100644 index 0000000000..b5dc02a40f --- /dev/null +++ b/bsps/shared/dev/cpucounter/cpucounterread.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 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.org/license/LICENSE. + */ + +#include <rtems/score/cpu.h> + +CPU_Counter_ticks _CPU_Counter_read( void ) +{ + static CPU_Counter_ticks counter; + + CPU_Counter_ticks snapshot; + + snapshot = counter; + counter = snapshot + 1; + + return snapshot; +} |