RTEMS: cpukit/include/rtems/counter.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
counter.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2014, 2018 embedded brains GmbH. All rights reserved.
11 *
12 * embedded brains GmbH
13 * Dornierstr. 4
14 * 82178 Puchheim
15 * Germany
16 * <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SAPI_COUNTER_H
24#define _RTEMS_SAPI_COUNTER_H
25
26#include <rtems/score/cpu.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
62 typedef CPU_Counter_ticks rtems_counter_ticks;
63
69static inline uint32_t rtems_counter_frequency( void )
70{
71 return _CPU_Counter_frequency();
72}
73
79static inline rtems_counter_ticks rtems_counter_read( void )
80{
81 return _CPU_Counter_read();
82}
83
96static inline rtems_counter_ticks rtems_counter_difference(
97 rtems_counter_ticks second,
98 rtems_counter_ticks first
99)
100{
101 return _CPU_Counter_difference( second, first );
102}
103
112uint64_t rtems_counter_ticks_to_nanoseconds(
113 rtems_counter_ticks ticks
114);
115
124 rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(
125 uint32_t nanoseconds
126);
127
136int64_t rtems_counter_ticks_to_sbintime( rtems_counter_ticks ticks );
137
146 rtems_counter_ticks rtems_counter_sbintime_to_ticks( int64_t sbt );
147
158void rtems_counter_initialize_converter( uint32_t frequency );
159
170void rtems_counter_delay_ticks( rtems_counter_ticks ticks );
171
182void rtems_counter_delay_nanoseconds( uint32_t nanoseconds );
183
186#ifdef __cplusplus
187}
188#endif /* __cplusplus */
189
190#endif /* _RTEMS_SAPI_COUNTER_H */
rtems_counter_sbintime_to_ticks
rtems_counter_ticks rtems_counter_sbintime_to_ticks(int64_t sbt)
Converts signed binary time (sbintime_t) into counter ticks.
Definition: cpucounterconverter.c:43
rtems_counter_ticks_to_nanoseconds
uint64_t rtems_counter_ticks_to_nanoseconds(rtems_counter_ticks ticks)
Converts counter ticks into nanoseconds.
Definition: cpucounterconverter.c:28
rtems_counter_ticks_to_sbintime
int64_t rtems_counter_ticks_to_sbintime(rtems_counter_ticks ticks)
Converts counter ticks into signed binary time (sbintime_t).
Definition: cpucounterconverter.c:38
rtems_counter_nanoseconds_to_ticks
rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(uint32_t nanoseconds)
Converts nanoseconds into counter ticks.
Definition: cpucounterconverter.c:33
rtems_counter_delay_nanoseconds
void rtems_counter_delay_nanoseconds(uint32_t nanoseconds)
Busy wait for some nanoseconds.
Definition: delaynano.c:21
rtems_counter_initialize_converter
void rtems_counter_initialize_converter(uint32_t frequency)
Initializes the counter ticks to/from nanoseconds converter functions.
Definition: cpucounterconverter.c:48
rtems_counter_delay_ticks
void rtems_counter_delay_ticks(rtems_counter_ticks ticks)
Busy wait for some counter ticks.
Definition: delayticks.c:21
rtems_counter_ticks
CPU_Counter_ticks rtems_counter_ticks
Unsigned integer type for counter values.
Definition: counter.h:62
_CPU_Counter_frequency
uint32_t _CPU_Counter_frequency(void)
Returns the current CPU counter frequency in Hz.
Definition: system-clocks.c:112
_CPU_Counter_read
CPU_Counter_ticks _CPU_Counter_read(void)
Returns the current CPU counter value.
Definition: system-clocks.c:117