RTE RBC 2oo2 Reference Application
0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Toggle main menu visibility
Loading...
Searching...
No Matches
ab_gp_cycle_ticks.h
Go to the documentation of this file.
1
33
#ifndef AB_GP_CYCLE_TICKS_H
34
#define AB_GP_CYCLE_TICKS_H
35
36
#include <stdint.h>
37
38
#include "rte/oal/mutex/rte_mutex.h"
39
#include "rte/utils/status/rte_status.h"
40
#include "rte/utils/types/rte_types.h"
41
44
#define AB_GP_CYCLE_TICKS_LOCK_TIMEOUT_MS 10U
45
47
typedef
struct
48
{
49
rte_mutex_storage_t
storage
;
50
rte_mutex_handle_t
handle
;
51
uint32_t
count
;
52
}
ab_gp_cycle_ticks_t
;
53
61
rte_status_t
ab_gp_cycle_ticks_setup
(
ab_gp_cycle_ticks_t
*ticks);
62
71
rte_status_t
ab_gp_cycle_ticks_post
(
ab_gp_cycle_ticks_t
*ticks);
72
82
rte_status_t
ab_gp_cycle_ticks_take
(
ab_gp_cycle_ticks_t
*ticks, uint32_t *out_pending);
83
91
rte_status_t
ab_gp_cycle_ticks_teardown
(
ab_gp_cycle_ticks_t
*ticks);
92
93
#endif
/* AB_GP_CYCLE_TICKS_H */
ab_gp_cycle_ticks_take
rte_status_t ab_gp_cycle_ticks_take(ab_gp_cycle_ticks_t *ticks, uint32_t *out_pending)
Returns every pending tick and clears the count, as one critical section (cycle thread side).
Definition
ab_gp_cycle_ticks.c:57
ab_gp_cycle_ticks_teardown
rte_status_t ab_gp_cycle_ticks_teardown(ab_gp_cycle_ticks_t *ticks)
Destroys the mutex. Call only when no other task can post or take any more (the posting timer is dest...
Definition
ab_gp_cycle_ticks.c:83
ab_gp_cycle_ticks_setup
rte_status_t ab_gp_cycle_ticks_setup(ab_gp_cycle_ticks_t *ticks)
Creates the mutex and clears the count. Setup phase only (rte_mutex_create() is a setup-only resource...
Definition
ab_gp_cycle_ticks.c:9
ab_gp_cycle_ticks_post
rte_status_t ab_gp_cycle_ticks_post(ab_gp_cycle_ticks_t *ticks)
Adds one tick (timer callback side). The count saturates at UINT32_MAX.
Definition
ab_gp_cycle_ticks.c:30
ab_gp_cycle_ticks_t
Tick count and the mutex that guards it. Not volatile: every access to count holds the mutex.
Definition
ab_gp_cycle_ticks.h:48
ab_gp_cycle_ticks_t::handle
rte_mutex_handle_t handle
Definition
ab_gp_cycle_ticks.h:50
ab_gp_cycle_ticks_t::storage
rte_mutex_storage_t storage
Definition
ab_gp_cycle_ticks.h:49
ab_gp_cycle_ticks_t::count
uint32_t count
Definition
ab_gp_cycle_ticks.h:51
src
application
AB
GP
com
ab_gp_cycle_ticks.h
Generated by
1.18.0