Safe API Framework
0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Toggle main menu visibility
Loading...
Searching...
No Matches
rte_timer.h
Go to the documentation of this file.
1
17
#ifndef RTE_OS_TIMER_H
18
#define RTE_OS_TIMER_H
19
20
#include "
rte/utils/status/rte_status.h
"
21
#include "
rte/utils/types/rte_types.h
"
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
28
RTE_DECLARE_STORAGE
(rte_timer_storage_t, 64U);
29
31
typedef
struct
rte_timer_impl_s *
rte_timer_handle_t
;
32
34
typedef
enum
rte_timer_mode_e
35
{
36
RTE_TIMER_MODE_ONE_SHOT
= 0,
37
RTE_TIMER_MODE_PERIODIC
= 1
38
}
rte_timer_mode_t
;
39
49
typedef
void (*
rte_timer_callback_t
)(
rte_timer_handle_t
handle,
void
*user_ctx);
50
52
typedef
struct
rte_timer_config_s
53
{
54
rte_timer_mode_t
mode
;
55
rte_duration_ms_t
period_ms
;
56
rte_timer_callback_t
callback
;
57
void
*
user_ctx
;
58
}
rte_timer_config_t
;
59
73
rte_status_t
rte_timer_create
(rte_timer_storage_t *storage,
74
const
rte_timer_config_t
*config,
75
rte_timer_handle_t
*out_handle);
76
84
rte_status_t
rte_timer_start
(
rte_timer_handle_t
handle);
85
92
rte_status_t
rte_timer_stop
(
rte_timer_handle_t
handle);
93
100
rte_status_t
rte_timer_destroy
(
rte_timer_handle_t
handle);
101
110
rte_status_t
rte_timer_now
(
rte_timestamp_ms_t
*out_now_ms);
111
112
/*
113
* The OSAdapter vtable (rte_osadapter_timer_t) and rte_osadapter_timer_register()
114
* live in rte_osadapter/timer/rte_osadapter_timer.h, not here (ADR-021).
115
* This header is the consumer-facing surface only - a real application
116
* never needs to see the OSAdapter vtable shape; only the platform
117
* integrator wiring a concrete OSAdapter does.
118
*/
119
120
#ifdef __cplusplus
121
}
122
#endif
123
124
#endif
/* RTE_OS_TIMER_H */
125
/* TIMER */
rte_status_t
rte_status_t
Common result/status codes.
Definition
rte_status.h:27
rte_timer_now
rte_status_t rte_timer_now(rte_timestamp_ms_t *out_now_ms)
Returns the current monotonic time base used by all timers.
Definition
rte_timer.c:139
rte_timer_stop
rte_status_t rte_timer_stop(rte_timer_handle_t handle)
Stops a running timer; safe to call on an already-stopped timer.
Definition
rte_timer.c:105
rte_timer_start
rte_status_t rte_timer_start(rte_timer_handle_t handle)
Starts (or restarts) a created timer.
Definition
rte_timer.c:79
rte_timer_handle_t
struct rte_timer_impl_s * rte_timer_handle_t
Definition
rte_timer.h:31
rte_timer_mode_t
rte_timer_mode_t
Whether a timer fires once or repeatedly every period_ms.
Definition
rte_timer.h:35
rte_timer_create
rte_status_t rte_timer_create(rte_timer_storage_t *storage, const rte_timer_config_t *config, rte_timer_handle_t *out_handle)
Creates a timer bound to caller-owned storage. Does not start it.
Definition
rte_timer.c:44
rte_timer_destroy
rte_status_t rte_timer_destroy(rte_timer_handle_t handle)
Destroys a timer, releasing any OSAdapter resources bound to it.
Definition
rte_timer.c:122
rte_timer_callback_t
void(*) rte_timer_callback_t(rte_timer_handle_t handle, void *user_ctx)
Signature for a timer expiry callback.
Definition
rte_timer.h:49
RTE_TIMER_MODE_PERIODIC
@ RTE_TIMER_MODE_PERIODIC
Definition
rte_timer.h:37
RTE_TIMER_MODE_ONE_SHOT
@ RTE_TIMER_MODE_ONE_SHOT
Definition
rte_timer.h:36
RTE_DECLARE_STORAGE
#define RTE_DECLARE_STORAGE(type_name, byte_size)
Declares an opaque, fixed-size, aligned storage type for a service's handle. The real internal layout...
Definition
rte_types.h:69
rte_duration_ms_t
uint32_t rte_duration_ms_t
Definition
rte_types.h:27
rte_timestamp_ms_t
uint64_t rte_timestamp_ms_t
Definition
rte_types.h:30
rte_status.h
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
rte_types.h
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
rte_timer_config_t
Configuration for rte_timer_create().
Definition
rte_timer.h:53
rte_timer_config_t::callback
rte_timer_callback_t callback
Definition
rte_timer.h:56
rte_timer_config_t::mode
rte_timer_mode_t mode
Definition
rte_timer.h:54
rte_timer_config_t::period_ms
rte_duration_ms_t period_ms
Definition
rte_timer.h:55
rte_timer_config_t::user_ctx
void * user_ctx
Definition
rte_timer.h:57
include
rte
oal
timer
rte_timer.h
Generated by
1.18.0