RTEMS  5.1
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 
51 void _Timecounter_Bintime( struct bintime *bt );
52 
58 void _Timecounter_Nanotime( struct timespec *ts );
59 
65 void _Timecounter_Microtime( struct timeval *tv );
66 
72 void _Timecounter_Binuptime( struct bintime *bt );
73 
79 int64_t _Timecounter_Sbinuptime( void );
80 
86 void _Timecounter_Nanouptime( struct timespec *ts );
87 
93 void _Timecounter_Microuptime( struct timeval *tv );
94 
103 void _Timecounter_Getbintime( struct bintime *bt );
104 
115 void _Timecounter_Getnanotime( struct timespec *ts );
116 
127 void _Timecounter_Getmicrotime( struct timeval *tv );
128 
137 void _Timecounter_Getbinuptime( struct bintime *bt );
138 
147 void _Timecounter_Getnanouptime( struct timespec *ts );
148 
157 void _Timecounter_Getmicrouptime( struct timeval *tv );
158 
164 void _Timecounter_Getboottime( struct timeval *tv );
165 
171 void _Timecounter_Getboottimebin( struct bintime *bt );
172 
182 void _Timecounter_Install( struct timecounter *tc );
183 
187 void _Timecounter_Tick( void );
188 
192 ISR_LOCK_DECLARE( extern, _Timecounter_Lock )
193 
194 
201 #define _Timecounter_Acquire( lock_context ) \
202  _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context )
203 
211 #define _Timecounter_Release(lock_context) \
212  _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context)
213 
227  uint32_t delta,
228  uint32_t offset,
229  ISR_lock_Context *lock_context
230 );
231 
235 extern volatile time_t _Timecounter_Time_second;
236 
243 extern volatile int32_t _Timecounter_Time_uptime;
244 
248 extern struct timecounter *_Timecounter;
249 
252 #ifdef __cplusplus
253 }
254 #endif /* __cplusplus */
255 
256 #endif /* _RTEMS_SCORE_TIMECOUNTER_H */
void _Timecounter_Getnanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
void _Timecounter_Getboottime(struct timeval *tv)
Returns the boot time in the timeval format.
#define ISR_LOCK_DECLARE(_qualifier, _designator)
Declares an ISR lock variable.
Definition: isrlock.h:104
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
struct timecounter * _Timecounter
The current timecounter.
void _Timecounter_Install(struct timecounter *tc)
Installs the timecounter.
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
void _Timecounter_Binuptime(struct bintime *bt)
Returns the uptime in the bintime format.
volatile time_t _Timecounter_Time_second
The wall clock time in seconds.
void _Timecounter_Getboottimebin(struct bintime *bt)
Returns the boot time in the bintime format.
Definition: timetc.h:46
volatile int32_t _Timecounter_Time_uptime
The uptime in seconds.
void _Timecounter_Tick(void)
Performs a timecounter tick.
void _Timecounter_Getmicrotime(struct timeval *tv)
Returns the wall clock time in the timeval format.
void _Timecounter_Getmicrouptime(struct timeval *tv)
Returns the uptime in the timeval format.
void _Timecounter_Microuptime(struct timeval *tv)
Returns the uptime in the timeval format.
void _Timecounter_Getnanouptime(struct timespec *ts)
Returns the uptime in the timespec 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.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
void _Timecounter_Bintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
ISR Locks.
void _Timecounter_Getbinuptime(struct bintime *bt)
Returns the uptime in the bintime format.