RTEMS: cpukit/include/rtems/score/timecounter.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
timecounter.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2015, 2021 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
33extern "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
79int64_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
226 void _Timecounter_Tick_simple(
227 uint32_t delta,
228 uint32_t offset,
229 ISR_lock_Context *lock_context
230);
231
235extern volatile time_t _Timecounter_Time_second;
236
243extern volatile int32_t _Timecounter_Time_uptime;
244
248extern struct timecounter *_Timecounter;
249
257 typedef void ( *Timecounter_NTP_update_second )(
258 int64_t *adjustment,
259 time_t *newsec
260);
261
268 void _Timecounter_Set_NTP_update_second(
269 Timecounter_NTP_update_second handler
270);
271
274#ifdef __cplusplus
275}
276#endif /* __cplusplus */
277
278#endif /* _RTEMS_SCORE_TIMECOUNTER_H */
ISR_LOCK_DECLARE
#define ISR_LOCK_DECLARE(_qualifier, _designator)
Declares an ISR lock variable.
Definition: isrlock.h:104
_Timecounter_Microtime
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
_Timecounter_Time_uptime
volatile int32_t _Timecounter_Time_uptime
The uptime in seconds.
_Timecounter_Tick
void _Timecounter_Tick(void)
Performs a timecounter tick.
_Timecounter_Nanotime
void _Timecounter_Nanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
_Timecounter_Getmicrouptime
void _Timecounter_Getmicrouptime(struct timeval *tv)
Returns the uptime in the timeval format.
_Timecounter_Sbinuptime
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
_Timecounter_Microuptime
void _Timecounter_Microuptime(struct timeval *tv)
Returns the uptime in the timeval format.
_Timecounter_Time_second
volatile time_t _Timecounter_Time_second
The wall clock time in seconds.
_Timecounter_Getboottimebin
void _Timecounter_Getboottimebin(struct bintime *bt)
Returns the boot time in the bintime format.
_Timecounter_Getboottime
void _Timecounter_Getboottime(struct timeval *tv)
Returns the boot time in the timeval format.
_Timecounter_Tick_simple
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
_Timecounter_Nanouptime
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
Timecounter_NTP_update_second
void(* Timecounter_NTP_update_second)(int64_t *adjustment, time_t *newsec)
Handler doing the NTP update second processing shall have this type.
Definition: timecounter.h:257
_Timecounter_Getmicrotime
void _Timecounter_Getmicrotime(struct timeval *tv)
Returns the wall clock time in the timeval format.
_Timecounter_Binuptime
void _Timecounter_Binuptime(struct bintime *bt)
Returns the uptime in the bintime format.
_Timecounter_Bintime
void _Timecounter_Bintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
_Timecounter_Getbinuptime
void _Timecounter_Getbinuptime(struct bintime *bt)
Returns the uptime in the bintime format.
_Timecounter_Install
void _Timecounter_Install(struct timecounter *tc)
Installs the timecounter.
_Timecounter_Getnanouptime
void _Timecounter_Getnanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
_Timecounter_Getbintime
void _Timecounter_Getbintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
_Timecounter_Set_NTP_update_second
void _Timecounter_Set_NTP_update_second(Timecounter_NTP_update_second handler)
Sets the NTP update second handler.
_Timecounter_Getnanotime
void _Timecounter_Getnanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
_Timecounter
struct timecounter * _Timecounter
The current timecounter.
isrlock.h
ISR Locks.
ISR_lock_Context
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
timecounter
Definition: timetc.h:46