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. --- doc/cpu_supplement/general.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'doc') diff --git a/doc/cpu_supplement/general.t b/doc/cpu_supplement/general.t index cf28eefd63..deca4de3b3 100644 --- a/doc/cpu_supplement/general.t +++ b/doc/cpu_supplement/general.t @@ -341,6 +341,27 @@ _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; _TLS_Alignment = ALIGNOF (.tdata); @end example +@section CPU counter + +The CPU support must implement the CPU counter interface. A CPU counter is +some free-running counter. It ticks usually with a frequency close to the CPU +or system bus clock. On some architectures the actual implementation is board +support package dependent. The CPU counter is used for profiling of low-level +functions. It is also used to implement two busy wait functions +@code{rtems_counter_delay_ticks()} and @code{rtems_counter_delay_nanoseconds()} +which may be used in device drivers. It may be also used as an entropy source +for random number generators. + +The CPU counter interface uses a CPU port specific unsigned integer type +@code{CPU_Counter_ticks} to represent CPU counter values. The CPU port must +provide the following two functions + +@itemize +@item @code{_CPU_Counter_read()} to read the current CPU counter value, and +@item @code{_CPU_Counter_difference()} to get the difference between two CPU +counter values. +@end itemize + @c @c @c -- cgit v1.2.3