RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
51void _Timecounter_Bintime( struct bintime *bt );
52
58void _Timecounter_Nanotime( struct timespec *ts );
59
65void _Timecounter_Microtime( struct timeval *tv );
66
72void _Timecounter_Binuptime( struct bintime *bt );
73
80
86void _Timecounter_Nanouptime( struct timespec *ts );
87
93void _Timecounter_Microuptime( struct timeval *tv );
94
103void _Timecounter_Getbintime( struct bintime *bt );
104
115void _Timecounter_Getnanotime( struct timespec *ts );
116
127void _Timecounter_Getmicrotime( struct timeval *tv );
128
137void _Timecounter_Getbinuptime( struct bintime *bt );
138
147void _Timecounter_Getnanouptime( struct timespec *ts );
148
157void _Timecounter_Getmicrouptime( struct timeval *tv );
158
164void _Timecounter_Getboottime( struct timeval *tv );
165
171void _Timecounter_Getboottimebin( struct bintime *bt );
172
183
187void _Timecounter_Tick( void );
188
192ISR_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
235extern volatile time_t _Timecounter_Time_second;
236
243extern volatile int32_t _Timecounter_Time_uptime;
244
248extern struct timecounter *_Timecounter;
249
258 int64_t *adjustment,
259 time_t *newsec
260);
261
270);
271
274#ifdef __cplusplus
275}
276#endif /* __cplusplus */
277
278#endif /* _RTEMS_SCORE_TIMECOUNTER_H */
#define ISR_LOCK_DECLARE(_qualifier, _designator)
Declares an ISR lock variable.
Definition: isrlock.h:104
void _Timecounter_Microtime(struct timeval *tv)
Returns the wall clock time in the timeval format.
volatile int32_t _Timecounter_Time_uptime
The uptime in seconds.
void _Timecounter_Tick(void)
Performs a timecounter tick.
void _Timecounter_Nanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
void _Timecounter_Getmicrouptime(struct timeval *tv)
Returns the uptime in the timeval format.
int64_t _Timecounter_Sbinuptime(void)
Returns the uptime in the sbintime_t format.
void _Timecounter_Microuptime(struct timeval *tv)
Returns the uptime in the timeval 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.
void _Timecounter_Getboottime(struct timeval *tv)
Returns the boot time in the timeval format.
void _Timecounter_Tick_simple(uint32_t delta, uint32_t offset, ISR_lock_Context *lock_context)
Performs a simple timecounter tick.
void _Timecounter_Nanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
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
void _Timecounter_Getmicrotime(struct timeval *tv)
Returns the wall clock time in the timeval format.
void _Timecounter_Binuptime(struct bintime *bt)
Returns the uptime in the bintime format.
void _Timecounter_Bintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
void _Timecounter_Getbinuptime(struct bintime *bt)
Returns the uptime in the bintime format.
void _Timecounter_Install(struct timecounter *tc)
Installs the timecounter.
void _Timecounter_Getnanouptime(struct timespec *ts)
Returns the uptime in the timespec format.
void _Timecounter_Getbintime(struct bintime *bt)
Returns the wall clock time in the bintime format.
void _Timecounter_Set_NTP_update_second(Timecounter_NTP_update_second handler)
Sets the NTP update second handler.
void _Timecounter_Getnanotime(struct timespec *ts)
Returns the wall clock time in the timespec format.
struct timecounter * _Timecounter
The current timecounter.
ISR Locks.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
Definition: timetc.h:46