RTEMS  5.0.0
timecounter.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2015 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_SCORE_TIMECOUNTER_H
24 #define _RTEMS_SCORE_TIMECOUNTER_H
25 
26 #include <sys/time.h>
27 #include <sys/timetc.h>
28 #include <machine/_timecounter.h>
29 
30 #include <rtems/score/isrlock.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
49 void _Timecounter_Bintime( struct bintime *bt );
50 
56 void _Timecounter_Nanotime( struct timespec *ts );
57 
63 void _Timecounter_Microtime( struct timeval *tv );
64 
70 void _Timecounter_Binuptime( struct bintime *bt );
71 
77 int64_t _Timecounter_Sbinuptime( void );
78 
84 void _Timecounter_Nanouptime( struct timespec *ts );
85 
91 void _Timecounter_Microuptime( struct timeval *tv );
92 
101 void _Timecounter_Getbintime( struct bintime *bt );
102 
113 void _Timecounter_Getnanotime( struct timespec *ts );
114 
125 void _Timecounter_Getmicrotime( struct timeval *tv );
126 
135 void _Timecounter_Getbinuptime( struct bintime *bt );
136 
145 void _Timecounter_Getnanouptime( struct timespec *ts );
146 
155 void _Timecounter_Getmicrouptime( struct timeval *tv );
156 
162 void _Timecounter_Getboottime( struct timeval *tv );
163 
169 void _Timecounter_Getboottimebin( struct bintime *bt );
170 
180 void _Timecounter_Install( struct timecounter *tc );
181 
185 void _Timecounter_Tick( void );
186 
190 ISR_LOCK_DECLARE( extern, _Timecounter_Lock )
191 
192 
199 #define _Timecounter_Acquire( lock_context ) \
200  _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context )
201 
215  uint32_t delta,
216  uint32_t offset,
217  ISR_lock_Context *lock_context
218 );
219 
223 extern volatile time_t _Timecounter_Time_second;
224 
231 extern volatile int32_t _Timecounter_Time_uptime;
232 
236 extern struct timecounter *_Timecounter;
237 
240 #ifdef __cplusplus
241 }
242 #endif /* __cplusplus */
243 
244 #endif /* _RTEMS_SCORE_TIMECOUNTER_H */
void _Timecounter_Bintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
void _Timecounter_Tick(void)
Performs a timecounter tick.
void _Timecounter_Install(struct timecounter *tc)
Installs the timecounter.
void _Timecounter_Getboottime(struct timeval *tv)
Returns the boot time in the timeval format.
void _Timecounter_Binuptime(struct bintime *bt)
Returns the uptime in the bintime format.
#define ISR_LOCK_DECLARE(_qualifier, _designator)
Declares an ISR lock variable.
Definition: isrlock.h:104
struct timecounter * _Timecounter
The current timecounter.
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
volatile int32_t _Timecounter_Time_uptime
The uptime in seconds.
void _Timecounter_Getnanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
Definition: timetc.h:46
volatile time_t _Timecounter_Time_second
The wall clock time in seconds.
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
void _Timecounter_Getmicrotime(struct timeval *tv)
Returns the wall clock time in the timeval format.
void _Timecounter_Nanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
void _Timecounter_Getbintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
void _Timecounter_Microuptime(struct timeval *tv)
Returns the uptime in the timeval format.
void _Timecounter_Getmicrouptime(struct timeval *tv)
Returns the uptime in the timeval format.
void _Timecounter_Getboottimebin(struct bintime *bt)
Returns the boot time in the bintime format.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
ISR Locks.
void _Timecounter_Getnanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
void _Timecounter_Getbinuptime(struct bintime *bt)
Returns the uptime in the bintime format.