RTEMS CPU Kit with SuperCore  4.11.3
counter.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2014 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
29 extern "C" {
30 #endif /* __cplusplus */
31 
62 typedef CPU_Counter_ticks rtems_counter_ticks;
63 
69 static inline rtems_counter_ticks rtems_counter_read( void )
70 {
71  return _CPU_Counter_read();
72 }
73 
86 static inline rtems_counter_ticks rtems_counter_difference(
87  rtems_counter_ticks second,
88  rtems_counter_ticks first
89 )
90 {
91  return _CPU_Counter_difference( second, first );
92 }
93 
103  rtems_counter_ticks ticks
104 );
105 
114 rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(
115  uint32_t nanoseconds
116 );
117 
128 void rtems_counter_initialize_converter( uint32_t frequency );
129 
140 void rtems_counter_delay_ticks( rtems_counter_ticks ticks );
141 
152 void rtems_counter_delay_nanoseconds( uint32_t nanoseconds );
153 
156 #ifdef __cplusplus
157 }
158 #endif /* __cplusplus */
159 
160 #endif /* _RTEMS_SAPI_COUNTER_H */
uint64_t rtems_counter_ticks_to_nanoseconds(rtems_counter_ticks ticks)
Converts counter ticks into nanoseconds.
Definition: cpucounterconverter.c:24
void rtems_counter_initialize_converter(uint32_t frequency)
Initializes the counter ticks to/from nanoseconds converter functions.
Definition: cpucounterconverter.c:34
void rtems_counter_delay_nanoseconds(uint32_t nanoseconds)
Busy wait for some nanoseconds.
Definition: delaynano.c:22
rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(uint32_t nanoseconds)
Converts nanoseconds into counter ticks.
Definition: cpucounterconverter.c:29
CPU_Counter_ticks _CPU_Counter_difference(CPU_Counter_ticks second, CPU_Counter_ticks first)
Returns the difference between the second and first CPU counter value.
Definition: cpu.h:1160
void rtems_counter_delay_ticks(rtems_counter_ticks ticks)
Busy wait for some counter ticks.
Definition: delayticks.c:22
CPU_Counter_ticks rtems_counter_ticks
Unsigned integer type for counter values.
Definition: counter.h:62