36#ifndef _RTEMS_TIMECOUNTER_H
37#define _RTEMS_TIMECOUNTER_H
63#define RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER 100
89static inline void rtems_timecounter_install(
99static inline void rtems_timecounter_tick(
void)
110 uint32_t real_interval;
111 uint32_t binary_interval;
209 uint32_t counter_frequency_in_hz,
210 uint32_t counter_ticks_per_clock_tick,
211 timecounter_get_t *get_timecount
222static inline uint32_t rtems_timecounter_simple_scale(
227 return (uint32_t) ( ( value * tc->scaler ) >> 32 );
238static inline void rtems_timecounter_simple_downcounter_tick(
251 current = rtems_timecounter_simple_scale(
253 tc->real_interval - ( *get )( tc )
267static inline void rtems_timecounter_simple_upcounter_tick(
280 current = rtems_timecounter_simple_scale( tc, ( *get )( tc ) );
294static inline uint32_t rtems_timecounter_simple_downcounter_get(
305 counter = ( *get )( tc );
306 interval = tc->real_interval;
308 if ( ( *is_pending )( tc ) ) {
309 counter = ( *get )( tc );
313 return rtems_timecounter_simple_scale( tc, interval - counter );
325static inline uint32_t rtems_timecounter_simple_upcounter_get(
336 counter = ( *get )( tc );
339 if ( ( *is_pending )( tc ) ) {
340 counter = ( *get )( tc );
341 interval = tc->real_interval;
344 return rtems_timecounter_simple_scale( tc, interval + counter );
This header file provides basic definitions used by the API and the implementation.
void rtems_timecounter_simple_install(rtems_timecounter_simple *tc, uint32_t counter_frequency_in_hz, uint32_t counter_ticks_per_clock_tick, timecounter_get_t *get_timecount)
Initializes and installs a simple timecounter.
Definition: tcsimpleinstall.c:43
void rtems_timecounter_simple_at_tick(rtems_timecounter_simple *tc)
At tick handling done under protection of the timecounter lock.
Definition: timecounter.h:117
bool rtems_timecounter_simple_is_pending(rtems_timecounter_simple *tc)
Returns true if the interrupt of a simple timecounter is pending, and false otherwise.
Definition: timecounter.h:132
uint32_t rtems_timecounter_simple_get(rtems_timecounter_simple *tc)
Returns the current value of a simple timecounter.
Definition: timecounter.h:124
void _Timecounter_Tick(void)
Performs a timecounter tick.
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
void _Timecounter_Install(struct timecounter *tc)
Installs the timecounter.
#define _Timecounter_Acquire(lock_context)
Lock to protect the timecounter mechanic.
Definition: timecounter.h:215
This header file provides interfaces of the Timecounter Handler which are used by the implementation ...
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:81
Simple timecounter to support legacy clock drivers.
Definition: timecounter.h:107