summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-05-03 13:03:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-07 14:22:01 +0100
commit0a1f5df98e52b028bf8b4de3bf63e39702fa5f34 (patch)
tree7b3d8bfe7a9e760ee2bbb8916d3284f34edfec89 /cpukit/score/cpu/sparc/include/rtems/score/cpu.h
parentscore: Avoid sbintime_t in API headers (diff)
downloadrtems-0a1f5df98e52b028bf8b4de3bf63e39702fa5f34.tar.bz2
Simplify _CPU_Counter_difference()
In order to simplify the use of CPU counter values it is beneficial to have monotonic increasing values within the range of the CPU counter ticks data type, e.g. 32-bit unsigned integer. This eases the use of CPU counter timestamps in external tools which do not know the details of the CPU counter hardware. The CPU counter is the fastest way to get a time on an RTEMS system. Such a CPU counter may be also used as the timecounter. Use it on SPARC for this purpose to simplify the clock drivers. Update #3456.
Diffstat (limited to '')
-rw-r--r--cpukit/score/cpu/sparc/include/rtems/score/cpu.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
index 252aa4026e..abc813cfa5 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
@@ -1103,29 +1103,28 @@ uint32_t _CPU_Counter_frequency( void );
typedef CPU_Counter_ticks ( *SPARC_Counter_read )( void );
-typedef CPU_Counter_ticks ( *SPARC_Counter_difference )(
- CPU_Counter_ticks second,
- CPU_Counter_ticks first
-);
-
/*
* The SPARC processors supported by RTEMS have no built-in CPU counter
* support. We have to use some hardware counter module for this purpose, for
* example the GPTIMER instance used by the clock driver. The BSP must provide
- * an implementation of the CPU counter read and difference functions. This
- * allows the use of dynamic hardware enumeration.
+ * an implementation of the CPU counter read function. This allows the use of
+ * dynamic hardware enumeration.
*/
typedef struct {
- SPARC_Counter_read counter_read;
- SPARC_Counter_difference counter_difference;
- volatile const CPU_Counter_ticks *counter_address;
+ SPARC_Counter_read read_isr_disabled;
+ SPARC_Counter_read read;
+ volatile const CPU_Counter_ticks *counter_register;
+ volatile const uint32_t *pending_register;
+ uint32_t pending_mask;
+ CPU_Counter_ticks accumulated;
+ CPU_Counter_ticks interval;
} SPARC_Counter;
extern const SPARC_Counter _SPARC_Counter;
static inline CPU_Counter_ticks _CPU_Counter_read( void )
{
- return ( *_SPARC_Counter.counter_read )();
+ return ( *_SPARC_Counter.read )();
}
static inline CPU_Counter_ticks _CPU_Counter_difference(
@@ -1133,7 +1132,7 @@ static inline CPU_Counter_ticks _CPU_Counter_difference(
CPU_Counter_ticks first
)
{
- return ( *_SPARC_Counter.counter_difference )( second, first );
+ return second - first;
}
/** Type that can store a 32-bit integer or a pointer. */