Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
rte_task.c
Go to the documentation of this file.
1
10
12
14
17static const rte_osadapter_task_t *s_osadapter = NULL;
18
20
22
23
26{
27 rte_status_t lifecycle_status;
28
29 if (osadapter == NULL)
30 {
32 }
33 /* REQ-LIFECYCLE-001 (ADR-026): registering an OSAdapter is a setup-only
34 * action - refuse once the application's setup phase has been locked. */
35 lifecycle_status = rte_lifecycle_check_setup_allowed();
36 if (lifecycle_status != RTE_STATUS_OK)
37 {
38 return lifecycle_status;
39 }
40 s_osadapter = osadapter;
41 return RTE_STATUS_OK;
42}
43
44rte_status_t rte_task_create(rte_task_storage_t *storage,
45 const rte_task_config_t *config,
46 rte_task_handle_t *out_handle)
47{
48 if ((storage == NULL) || (config == NULL) || (out_handle == NULL))
49 {
51 }
52 if (config->entry == NULL)
53 {
55 }
56 *out_handle = NULL;
57 /* REQ-LIFECYCLE-001/003 (ADR-026, OSA rules): setup-only - refused and reported once the setup phase is locked. */
58 {
60
61 if (lifecycle_status != RTE_STATUS_OK)
62 {
63 return lifecycle_status;
64 }
65 }
66 if (s_osadapter == NULL)
67 {
69 }
70 if (s_osadapter->create == NULL)
71 {
73 }
74 return s_osadapter->create(storage, config, out_handle);
75}
76
78{
79 if (handle == NULL)
80 {
82 }
83 /* REQ-LIFECYCLE-001/003 (ADR-026, OSA rules): setup-only - refused and reported once the setup phase is locked. */
84 {
86
87 if (lifecycle_status != RTE_STATUS_OK)
88 {
89 return lifecycle_status;
90 }
91 }
92 if (s_osadapter == NULL)
93 {
95 }
96 if (s_osadapter->start == NULL)
97 {
99 }
100 return s_osadapter->start(handle);
101}
102
104{
105 if (handle == NULL)
106 {
108 }
109 if (s_osadapter == NULL)
110 {
112 }
113 if (s_osadapter->suspend == NULL)
114 {
116 }
117 return s_osadapter->suspend(handle);
118}
119
121{
122 if (handle == NULL)
123 {
125 }
126 if (s_osadapter == NULL)
127 {
129 }
130 if (s_osadapter->destroy == NULL)
131 {
133 }
134 return s_osadapter->destroy(handle);
135}
rte_status_t rte_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
rte_status_t
Common result/status codes.
Definition rte_status.h:27
@ RTE_STATUS_OK
Definition rte_status.h:28
@ RTE_STATUS_INVALID_PARAM
Definition rte_status.h:29
@ RTE_STATUS_NOT_SUPPORTED
Definition rte_status.h:34
@ RTE_STATUS_NOT_INITIALIZED
Definition rte_status.h:30
rte_status_t rte_task_suspend(rte_task_handle_t handle)
Suspends a running task.
Definition rte_task.c:103
struct rte_task_impl_s * rte_task_handle_t
Opaque handle to a created task, returned by rte_task_create().
Definition rte_task.h:32
rte_status_t rte_task_create(rte_task_storage_t *storage, const rte_task_config_t *config, rte_task_handle_t *out_handle)
Creates a task in the suspended state.
Definition rte_task.c:44
rte_status_t rte_task_start(rte_task_handle_t handle)
Starts a created task.
Definition rte_task.c:77
rte_status_t rte_task_destroy(rte_task_handle_t handle)
Terminates and destroys a task.
Definition rte_task.c:120
static const rte_osadapter_clocksync_t * s_osadapter
Process-wide application setup-phase lock (ADR-026).
OSAdapter interface for task and thread scheduling.
rte_status_t rte_osadapter_task_register(const rte_osadapter_task_t *adapter)
Registers the OSAdapter task implementation.
Definition rte_task.c:25
OS Abstraction Layer - Task/thread scheduling service.
OSAdapter task scheduling operations vtable.
Configuration for rte_task_create().
Definition rte_task.h:39
rte_task_entry_t entry
Definition rte_task.h:41